{"issue":{"state":"closed","pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"milestone":null,"user":{"avatar_url":"https://secure.gravatar.com/avatar/74b77df74c44fe13257dd76ca5f64cb6?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"74b77df74c44fe13257dd76ca5f64cb6","url":"https://api.github.com/users/graciani","login":"graciani","id":693012},"labels":[{"name":"Bug","color":"e10c02","url":"https://api.github.com/repos/DIRACGrid/DIRAC/labels/Bug"},{"name":"WMS","color":"ededed","url":"https://api.github.com/repos/DIRACGrid/DIRAC/labels/WMS"}],"assignee":{"avatar_url":"https://secure.gravatar.com/avatar/a353cc7f5184a2db78b87089b4e428e3?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"a353cc7f5184a2db78b87089b4e428e3","url":"https://api.github.com/users/atsareg","login":"atsareg","id":679892},"updated_at":"2011-11-14T21:39:00Z","comments":1,"closed_at":"2011-11-14T21:39:00Z","url":"https://api.github.com/repos/DIRACGrid/DIRAC/issues/262","body":"In the current implementation, a newly installed SiteDirector Agent with already configured queues will failed to startup.\r\n\r\nThe problem is the following, AgentModule does the initialization in the following order:\r\n\r\n\r\n  def am_initialize( self, *initArgs ):\r\n    agentName = self.am_getModuleParam( 'fullName' )\r\n    result = self.initialize( *initArgs )\r\n    if result == None:\r\n      return S_ERROR( \"Error while initializing %s module: initialize must return S_OK/S_ERROR\" % agentName )\r\n    if not result[ 'OK' ]:\r\n      return S_ERROR( \"Error while initializing %s: %s\" % ( agentName, result[ 'Message' ] ) )\r\n    _checkDir( self.am_getControlDirectory() )\r\n    _checkDir( self.am_getWorkDirectory() )\r\n\r\nwhich means first it calls the Agent initialize method and then creates the control and work Directories.\r\n\r\nBut the initialize method of the SiteDirector includes:\r\n\r\n    result = self.getQueues()\r\n\r\nthat uses:\r\n\r\n          qwDir = os.path.join( self.workingDirectory, queue )\r\n          if not os.path.exists( qwDir ):\r\n            os.mkdir( qwDir )\r\n\r\nthis fails since the AgentModule has not yet created the workingDir.\r\n\r\nI think the best fix is to create call the getQueues method not in the initialize but on the beginExecution() method of the Agent that at the same time it will update the list of queues previous to each iteration.\r\n\r\nRicardo","html_url":"https://github.com/DIRACGrid/DIRAC/issues/262","title":"SiteDirector will not startup","number":262,"id":2145372,"created_at":"2011-11-04T16:03:46Z"},"action":"closed"}