def __locate_glexec( self ): """ Try to find glexec """ for glpath in ( os.environ.get( 'OSG_GLEXEC_LOCATION', '' ), '%s/sbin/glexec' % ( os.environ.get( 'GLITE_LOCATION', '/opt/glite' ) ), '%s/sbin/glexec' % ( os.environ.get( 'GLEXEC_LOCATION', '/opt/glite' ) ), '/usr/sbin/glexec' ): if glpath and os.path.exists( glpath ): self.__gl = glpath return S_OK() glpath = which( "glexec" ) if glpath: self.__gl = glpath return S_OK() return S_ERROR( "Unable to locate glexec" )
def _setCommand(self): """ set the command that will be executed """ self.command = self.executable if os.path.exists(os.path.basename(self.executable)): self.executable = os.path.basename(self.executable) if not os.access('%s/%s' % (os.getcwd(), self.executable), 5): os.chmod('%s/%s' % (os.getcwd(), self.executable), 0755) self.command = '%s/%s' % (os.getcwd(), self.executable) elif re.search('.py$', self.executable): self.command = '%s %s' % (sys.executable, self.executable) elif which(self.executable): self.command = self.executable if self.arguments: self.command = '%s %s' % (self.command, self.arguments) self.log.info('Command is: %s' % self.command)
def _setCommand( self ): """ set the command that will be executed """ self.command = self.executable if os.path.exists( os.path.basename( self.executable ) ): self.executable = os.path.basename( self.executable ) if not os.access( '%s/%s' % ( os.getcwd(), self.executable ), 5 ): os.chmod( '%s/%s' % ( os.getcwd(), self.executable ), 0755 ) self.command = '%s/%s' % ( os.getcwd(), self.executable ) elif re.search( '.py$', self.executable ): self.command = '%s %s' % ( sys.executable, self.executable ) elif which( self.executable ): self.command = self.executable if self.arguments: self.command = '%s %s' % ( self.command, self.arguments ) self.log.info( 'Command is: %s' % self.command )
def glexecLocate( self ): """Try to find glexec on the local system, if not found default to InProcess. """ glexecPath = "" if os.environ.has_key( 'OSG_GLEXEC_LOCATION' ): glexecPath = '%s' % ( os.environ['OSG_GLEXEC_LOCATION'] ) elif os.environ.has_key( 'GLITE_LOCATION' ): glexecPath = '%s/sbin/glexec' % ( os.environ['GLITE_LOCATION'] ) else: #try to locate the excutable in the PATH glexecPath = which( "glexec" ) if not glexecPath: self.log.info( 'Unable to locate glexec, site does not have GLITE_LOCATION nor OSG_GLEXEC_LOCATION defined' ) return S_ERROR( 'glexec not found' ) if not os.path.exists( glexecPath ): self.log.info( 'glexec not found at path %s' % ( glexecPath ) ) return S_ERROR( 'glexec not found' ) return S_OK( glexecPath )
def glexecLocate(self): """Try to find glexec on the local system, if not found default to InProcess. """ glexecPath = "" if os.environ.has_key('OSG_GLEXEC_LOCATION'): glexecPath = '%s' % (os.environ['OSG_GLEXEC_LOCATION']) elif os.environ.has_key('GLITE_LOCATION'): glexecPath = '%s/sbin/glexec' % (os.environ['GLITE_LOCATION']) else: #try to locate the excutable in the PATH glexecPath = which("glexec") if not glexecPath: self.log.info( 'Unable to locate glexec, site does not have GLITE_LOCATION nor OSG_GLEXEC_LOCATION defined' ) return S_ERROR('glexec not found') if not os.path.exists(glexecPath): self.log.info('glexec not found at path %s' % (glexecPath)) return S_ERROR('glexec not found') return S_OK(glexecPath)