Beispiel #1
0
    def checkCondorSetup(self):
        """
        Check the local machine for a properly set up and running condor install
        """

        # check for locally running schedd
        cmd = 'ps xau | grep -i condor_schedd | grep -v grep'
        cmdOut = runCommand(cmd)
        if cmdOut == None:
            msg  = self.msgPre + 'condor_schedd is not running on this machine.\n'
            msg += self.msgPre + 'Please use a machine with condor installed and running\n'
            msg += self.msgPre + 'condor_schedd or change the Scheduler in your crab.cfg.'
            common.logger.debug( msg)
            raise CrabException(msg)

        self.checkExecutableInPath('condor_q')
        self.checkExecutableInPath('condor_submit')
        self.checkExecutableInPath('condor_version')

        # get version number
        cmd = 'condor_version'
        cmdOut = runCommand(cmd)
        if cmdOut != None :
            pass
            #tmp = cmdOut.find('CondorVersion') + 15
            #version = cmdOut[tmp:tmp+6].split('.')
            #version_master = int(version[0])
            #version_major  = int(version[1])
            #version_minor  = int(version[2])
        else :
            msg  = self.msgPre + 'condor_version was not able to determine the installed condor version.\n'
            msg += self.msgPre + 'Please use a machine with a properly installed condor\n'
            msg += self.msgPre + 'or change the Scheduler in your crab.cfg.'
            common.logger.debug( msg)
            raise CrabException(msg)

        self.checkExecutableInPath('condor_config_val')
        self.checkCondorVariablePointsToFile('GRIDMANAGER')
        self.checkCondorVariablePointsToFile('GT2_GAHP', alternateName='GAHP')
        self.checkCondorVariablePointsToFile('GRID_MONITOR')
        self.checkCondorVariableIsTrue('ENABLE_GRID_MONITOR')

        return
Beispiel #2
0
    def checkCondorSetup(self):
        """
        Check the local machine for a properly set up and running condor install
        """

        # check for locally running schedd
        cmd = 'ps xau | grep -i condor_schedd | grep -v grep'
        cmdOut = runCommand(cmd)
        if cmdOut == None:
            msg  = self.msgPre + 'condor_schedd is not running on this machine.\n'
            msg += self.msgPre + 'Please use a machine with condor installed and running\n'
            msg += self.msgPre + 'condor_schedd or change the Scheduler in your crab.cfg.'
            common.logger.debug( msg)
            raise CrabException(msg)

        self.checkExecutableInPath('condor_q')
        self.checkExecutableInPath('condor_submit')
        self.checkExecutableInPath('condor_version')

        # get version number
        cmd = 'condor_version'
        cmdOut = runCommand(cmd)
        if cmdOut != None :
            pass
            #tmp = cmdOut.find('CondorVersion') + 15
            #version = cmdOut[tmp:tmp+6].split('.')
            #version_master = int(version[0])
            #version_major  = int(version[1])
            #version_minor  = int(version[2])
        else :
            msg  = self.msgPre + 'condor_version was not able to determine the installed condor version.\n'
            msg += self.msgPre + 'Please use a machine with a properly installed condor\n'
            msg += self.msgPre + 'or change the Scheduler in your crab.cfg.'
            common.logger.debug( msg)
            raise CrabException(msg)

        self.checkExecutableInPath('condor_config_val')
        self.checkCondorVariablePointsToFile('GRIDMANAGER')
        self.checkCondorVariablePointsToFile('GT2_GAHP', alternateName='GAHP')
        self.checkCondorVariablePointsToFile('GRID_MONITOR')
        self.checkCondorVariableIsTrue('ENABLE_GRID_MONITOR')

        return
Beispiel #3
0
    def checkCondorVariablePointsToFile(self, name, alternateName=None):
        """
        check for condor variable
        """

        cmd = 'condor_config_val ' + name
        cmdOut = runCommand(cmd)
        if alternateName and not cmdOut:
            cmd = 'condor_config_val ' + alternateName
            cmdOut = runCommand(cmd)
        if cmdOut:
            cmdOut = cmdOut.strip()
        if not cmdOut or not os.path.isfile(cmdOut) :
            msg  = self.msgPre + 'the variable ' + name
            msg += ' is not properly set for the condor installation.\n'
            msg += self.msgPre + 'Please ask the administrator of the local condor '
            msg += 'installation  to set the variable ' + name + ' properly, '
            msg += 'use another machine with a properly installed condor\n'
            msg += 'or change the Scheduler in your crab.cfg.'
            common.logger.debug( msg)
            raise CrabException(msg)
Beispiel #4
0
    def checkCondorVariablePointsToFile(self, name, alternateName=None):
        """
        check for condor variable
        """

        cmd = 'condor_config_val ' + name
        cmdOut = runCommand(cmd)
        if alternateName and not cmdOut:
            cmd = 'condor_config_val ' + alternateName
            cmdOut = runCommand(cmd)
        if cmdOut:
            cmdOut = cmdOut.strip()
        if not cmdOut or not os.path.isfile(cmdOut) :
            msg  = self.msgPre + 'the variable ' + name
            msg += ' is not properly set for the condor installation.\n'
            msg += self.msgPre + 'Please ask the administrator of the local condor '
            msg += 'installation  to set the variable ' + name + ' properly, '
            msg += 'use another machine with a properly installed condor\n'
            msg += 'or change the Scheduler in your crab.cfg.'
            common.logger.debug( msg)
            raise CrabException(msg)
Beispiel #5
0
    def checkExecutableInPath(self, name):
        """
        check if executable is in PATH
        """

        cmd = 'which '+name
        cmdOut = runCommand(cmd)
        if cmdOut == None:
            msg  = self.msgPre + name + ' is not in the $PATH on this machine.\n'
            msg += self.msgPre + 'Please use a machine with a properly installed condor\n'
            msg += self.msgPre + 'or change the Scheduler in your crab.cfg.'
            common.logger.debug( msg)
            raise CrabException(msg)
Beispiel #6
0
    def checkExecutableInPath(self, name):
        """
        check if executable is in PATH
        """

        cmd = 'which '+name
        cmdOut = runCommand(cmd)
        if cmdOut == None:
            msg  = self.msgPre + name + ' is not in the $PATH on this machine.\n'
            msg += self.msgPre + 'Please use a machine with a properly installed condor\n'
            msg += self.msgPre + 'or change the Scheduler in your crab.cfg.'
            common.logger.debug( msg)
            raise CrabException(msg)
Beispiel #7
0
    def queryCondorVariable(self, name, default):
        """
        check for condor variable
        """

        cmd = 'condor_config_val '+name
        cmdOut = runCommand(cmd)
        if cmdOut:
       # out = popen2.Popen3(cmd, 1)
       # exitCode = out.wait()
       # cmdOut = out.fromchild.readline().strip()
       # if exitCode != 0 :
            cmdOut = str(default)

        return cmdOut
Beispiel #8
0
    def queryCondorVariable(self, name, default):
        """
        check for condor variable
        """

        cmd = 'condor_config_val '+name
        cmdOut = runCommand(cmd)
        if cmdOut:
       # out = popen2.Popen3(cmd, 1)
       # exitCode = out.wait()
       # cmdOut = out.fromchild.readline().strip()
       # if exitCode != 0 :
            cmdOut = str(default)

        return cmdOut
Beispiel #9
0
    def checkCondorVariableIsTrue(self, name):
        """
        check for condor variable
        """

        cmd = 'condor_config_val '+name
        cmdOut = runCommand(cmd)
        if cmdOut == 'TRUE' :
            msg  = self.msgPre + 'the variable ' + name
            msg += ' is not set to true for the condor installation.\n'
            msg += self.msgPre + 'Please ask the administrator of the local condor installation '
            msg += 'to set the variable ' + name + ' to true, '
            msg += 'use another machine with a properly installed condor or '
            msg += 'change the Scheduler in your crab.cfg.'
            common.logger.debug( msg)
            raise CrabException(msg)
Beispiel #10
0
    def checkCondorVariableIsTrue(self, name):
        """
        check for condor variable
        """

        cmd = 'condor_config_val '+name
        cmdOut = runCommand(cmd)
        if cmdOut == 'TRUE' :
            msg  = self.msgPre + 'the variable ' + name
            msg += ' is not set to true for the condor installation.\n'
            msg += self.msgPre + 'Please ask the administrator of the local condor installation '
            msg += 'to set the variable ' + name + ' to true, '
            msg += 'use another machine with a properly installed condor or '
            msg += 'change the Scheduler in your crab.cfg.'
            common.logger.debug( msg)
            raise CrabException(msg)
    def configure(self, cfg_params):
        """
        Configure the scheduler with the config settings from the user
        """
   
        # this line needs to be before the call to SchedulerGrid.configure
        # because that calls SchedulerRemoteglidin in turn and
        # sshControlPersist needs to be defined then :-(
        self.sshControlPersist =  cfg_params.get('USER.ssh_control_persist','3600')
        if self.sshControlPersist.lower() == "no" or \
                self.sshControlPersist.lower() == "yes" or \
                self.sshControlPersist.isdigit() :
            pass
        else:
            msg = "Error: invalid value '%s' for USER.ssh_control_persist " % \
                self.sshControlPersist
            raise CrabException(msg)

        SchedulerGrid.configure(self, cfg_params)

        self.proxyValid=0
        self.dontCheckProxy=int(cfg_params.get("GRID.dont_check_proxy",'0'))
        self.space_token = cfg_params.get("USER.space_token",None)
        self.proxyServer= 'myproxy.cern.ch'
        self.group = cfg_params.get("GRID.group", None)
        self.role = cfg_params.get("GRID.role", None)
        self.VO = cfg_params.get('GRID.virtual_organization','cms')
        self.allowOverflow = cfg_params.get('GRID.allow_overflow', '1')
        self.max_rss = cfg_params.get('GRID.max_rss','2000')

        self.checkProxy()


        try:
            tmp =  cfg_params['CMSSW.datasetpath']
            if tmp.lower() == 'none':
                self.datasetPath = None
                self.selectNoInput = 1
            else:
                self.datasetPath = tmp
                self.selectNoInput = 0
        except KeyError:
            msg = "Error: datasetpath not defined "
            raise CrabException(msg)

        if cfg_params.get('GRID.ce_black_list', None) or \
           cfg_params.get('GRID.ce_white_list', None) :
            msg="BEWARE: scheduler REMOTEGLIDEIN ignores CE black/white lists."
            msg+="\n Remove them from crab configuration to proceed."
            msg+="\n Use GRID.se_white_list and/or GRID.se_black_list instead"
            raise CrabException(msg)


        # make sure proxy FQAN has not changed since last time
        command =  "eval `scram unsetenv -sh`; voms-proxy-info -identity -fqan 2>/dev/null"
        command += " | head -2"
        identity = runCommand(command)
        idfile = common.work_space.shareDir() + "GridIdentity"
        if os.access(idfile, os.F_OK) :
            # identity file exists from previous commands
            f=open(idfile, 'r')
            idFromFile=f.read()
            f.close()
        else :
            # create it
            f=open(idfile, 'w')
            f.write(identity)
            f.close()
            idFromFile = identity

        if identity != idFromFile:
            msg =  "Wrong Grid Credentials:\n%s" % identity
            msg += "\nMake sure you have "
            msg += " DN, FQAN =\n%s" % idFromFile
            raise CrabException(msg)

        return
    def configure(self, cfg_params):
        """
        Configure the scheduler with the config settings from the user
        """

        # this line needs to be before the call to SchedulerGrid.configure
        # because that calls SchedulerRemoteglidin in turn and
        # sshControlPersist needs to be defined then :-(
        self.sshControlPersist = cfg_params.get('USER.ssh_control_persist',
                                                '3600')
        if self.sshControlPersist.lower() == "no" or \
                self.sshControlPersist.lower() == "yes" or \
                self.sshControlPersist.isdigit() :
            pass
        else:
            msg = "Error: invalid value '%s' for USER.ssh_control_persist " % \
                self.sshControlPersist
            raise CrabException(msg)

        SchedulerGrid.configure(self, cfg_params)

        self.proxyValid = 0
        self.dontCheckProxy = int(cfg_params.get("GRID.dont_check_proxy", '0'))
        self.space_token = cfg_params.get("USER.space_token", None)
        self.proxyServer = 'myproxy.cern.ch'
        self.group = cfg_params.get("GRID.group", None)
        self.role = cfg_params.get("GRID.role", None)
        self.VO = cfg_params.get('GRID.virtual_organization', 'cms')
        self.allowOverflow = cfg_params.get('GRID.allow_overflow', '1')
        self.max_rss = cfg_params.get('GRID.max_rss', '2000')

        self.checkProxy()

        try:
            tmp = cfg_params['CMSSW.datasetpath']
            if tmp.lower() == 'none':
                self.datasetPath = None
                self.selectNoInput = 1
            else:
                self.datasetPath = tmp
                self.selectNoInput = 0
        except KeyError:
            msg = "Error: datasetpath not defined "
            raise CrabException(msg)

        if cfg_params.get('GRID.ce_black_list', None) or \
           cfg_params.get('GRID.ce_white_list', None) :
            msg = "BEWARE: scheduler REMOTEGLIDEIN ignores CE black/white lists."
            msg += "\n Remove them from crab configuration to proceed."
            msg += "\n Use GRID.se_white_list and/or GRID.se_black_list instead"
            raise CrabException(msg)

        # make sure proxy FQAN has not changed since last time
        command = "voms-proxy-info -identity -fqan 2>/dev/null"
        command += " | head -2"
        identity = runCommand(command)
        idfile = common.work_space.shareDir() + "GridIdentity"
        if os.access(idfile, os.F_OK):
            # identity file exists from previous commands
            f = open(idfile, 'r')
            idFromFile = f.read()
            f.close()
        else:
            # create it
            f = open(idfile, 'w')
            f.write(identity)
            f.close()
            idFromFile = identity

        if identity != idFromFile:
            msg = "Wrong Grid Credentials:\n%s" % identity
            msg += "\nMake sure you have "
            msg += " DN, FQAN =\n%s" % idFromFile
            raise CrabException(msg)

        return
 def userName(self):
     """ return the user name """
     tmp=runCommand("voms-proxy-info -identity 2>/dev/null")
     return tmp.strip()
Beispiel #14
0
 def userName(self):
     """ return the user name """
     tmp = runCommand("voms-proxy-info -identity 2>/dev/null")
     return tmp.strip()