Example #1
0
    def __init__(self, config):
        BasePlugin.__init__(self, config)

        self.locationDict = {}

        myThread = threading.currentThread()
        daoFactory = DAOFactory(package="WMCore.WMBS",
                                logger=myThread.logger,
                                dbinterface=myThread.dbi)
        self.locationAction = daoFactory(classname="Locations.GetSiteInfo")

        self.packageDir = None

        if os.path.exists(
                os.path.join(getWMBASE(),
                             'src/python/WMCore/WMRuntime/Unpacker.py')):
            self.unpacker = os.path.join(
                getWMBASE(), 'src/python/WMCore/WMRuntime/Unpacker.py')
        else:
            self.unpacker = os.path.join(getWMBASE(),
                                         'WMCore/WMRuntime/Unpacker.py')

        self.agent = getattr(config.Agent, 'agentName', 'WMAgent')
        self.sandbox = None

        self.scriptFile = config.JobSubmitter.submitScript

        self.defaultTaskPriority = getattr(config.BossAir,
                                           'defaultTaskPriority', 0)
        self.maxTaskPriority = getattr(config.BossAir, 'maxTaskPriority', 1e7)
        self.jobsPerSubmit = getattr(config.JobSubmitter, 'jobsPerSubmit', 200)
        self.extraMem = getattr(config.JobSubmitter, 'extraMemoryPerCore', 500)

        # Required for global pool accounting
        self.acctGroup = getattr(config.BossAir, 'acctGroup', "production")
        self.acctGroupUser = getattr(config.BossAir, 'acctGroupUser',
                                     "cmsdataops")

        # Build a requirement string.  All CMS resources match DESIRED_Sites on the START
        # expression side; however, there are currently some resources (T2_CH_CERN_HLT)
        # that are missing the REQUIRED_OS logic.  Hence, we duplicate it here.
        # TODO(bbockelm): Remove reqStr once HLT has upgraded.
        self.reqStr = (
            '((REQUIRED_OS=?="any") || '
            '(GLIDEIN_REQUIRED_OS =?= "any") || '
            'stringListMember(GLIDEIN_REQUIRED_OS, REQUIRED_OS)) && '
            '(AuthenticatedIdentity =!= "*****@*****.**")')
        if hasattr(config.BossAir, 'condorRequirementsString'):
            self.reqStr = config.BossAir.condorRequirementsString

        # x509 proxy handling
        proxy = Proxy({'logger': myThread.logger})
        self.x509userproxy = proxy.getProxyFilename()
        self.x509userproxysubject = proxy.getSubject()
        self.x509userproxyfqan = proxy.getAttributeFromProxy(
            self.x509userproxy)
        # Remove the x509 ads if the job is matching a volunteer resource
        self.x509Expr = 'ifThenElse("$$(GLIDEIN_CMSSite)" =?= "T3_CH_Volunteer",undefined,"%s")'

        return
Example #2
0
    def __init__(self, config):

        self.config = config

        BasePlugin.__init__(self, config)

        self.locationDict = {}

        myThread = threading.currentThread()
        daoFactory = DAOFactory(package="WMCore.WMBS", logger=myThread.logger, dbinterface=myThread.dbi)
        self.locationAction = daoFactory(classname="Locations.GetSiteInfo")

        self.packageDir = None

        if os.path.exists(os.path.join(getWMBASE(), "src/python/WMCore/WMRuntime/Unpacker.py")):
            self.unpacker = os.path.join(getWMBASE(), "src/python/WMCore/WMRuntime/Unpacker.py")
        else:
            self.unpacker = os.path.join(getWMBASE(), "WMCore/WMRuntime/Unpacker.py")

        self.agent = getattr(config.Agent, "agentName", "WMAgent")
        self.sandbox = None
        self.scriptFile = None
        self.submitDir = None
        self.removeTime = getattr(config.BossAir, "removeTime", 60)
        self.multiTasks = getattr(config.BossAir, "multicoreTaskTypes", [])

        # Build ourselves a pool
        self.pool = []
        self.input = multiprocessing.Queue()
        self.result = multiprocessing.Queue()
        self.nProcess = getattr(self.config.BossAir, "nCondorProcesses", 4)

        return
Example #3
0
    def __init__(self, config):

        BasePlugin.__init__(self, config)
        self.config = config

        self.pool = []
        self.createdReport = []
        self.myinput = None
        if getattr(config.BossAir, 'MockPlugin', None) == None:
            msg = "Missing required config.BossAir.MockPlugin section"
            raise BossAirPluginException(msg)

        self.nProcess = getattr(config.BossAir.MockPlugin,
                                'mockPluginProcesses', 4)
        self.jobRunTime = getattr(config.BossAir.MockPlugin, 'jobRunTime',
                                  120)  #default job running time is two hours
        logging.info('Job Running time set to minutes %s' % self.jobRunTime)

        self.fakeReport = getattr(config.BossAir.MockPlugin, 'fakeReport',
                                  None)
        if self.fakeReport == None:
            msg = 'config.BossAir.MockPlugin.fakeReport is a required parameter'
            raise BossAirPluginException(msg)
        elif not os.path.isfile(self.fakeReport):
            msg = 'Cannot find %s file' % self.fakeReport
            raise BossAirPluginException(msg)

        self.jobsScheduledEnd = {}

        self.states = [
            'New', 'Timeout', 'Submitted', 'Waiting', 'Ready', 'Scheduled',
            'Running', 'Done(failed)', 'Done', 'Aborted', 'Cleared',
            'Cancelled by user', 'Cancelled'
        ]
Example #4
0
    def __init__(self, config):
        BasePlugin.__init__(self, config)

        self.locationDict = {}

        myThread = threading.currentThread()
        daoFactory = DAOFactory(package="WMCore.WMBS",
                                logger=myThread.logger,
                                dbinterface=myThread.dbi)
        self.locationAction = daoFactory(classname="Locations.GetSiteInfo")

        self.packageDir = None

        # if agent is running in a container, Unpacker.py must come from a directory
        # on the host so the condor schedd can see it
        # config.General.workDir should always be bind mounted to the container
        if getattr(config.Agent, "isDocker", False):
            unpackerPath = os.path.join(config.General.workDir +
                                        "/Docker/WMRuntime/Unpacker.py")
        else:
            unpackerPath = os.path.join(
                getWMBASE(), 'src/python/WMCore/WMRuntime/Unpacker.py')

        if os.path.exists(unpackerPath):
            self.unpacker = unpackerPath
        else:
            self.unpacker = os.path.join(getWMBASE(),
                                         'WMCore/WMRuntime/Unpacker.py')

        self.agent = getattr(config.Agent, 'agentName', 'WMAgent')
        self.sandbox = None

        self.scriptFile = config.JobSubmitter.submitScript

        self.defaultTaskPriority = getattr(config.BossAir,
                                           'defaultTaskPriority', 0)
        self.maxTaskPriority = getattr(config.BossAir, 'maxTaskPriority', 1e7)
        self.jobsPerSubmit = getattr(config.JobSubmitter, 'jobsPerSubmit', 200)
        self.extraMem = getattr(config.JobSubmitter, 'extraMemoryPerCore', 500)

        # Required for global pool accounting
        self.acctGroup = getattr(config.BossAir, 'acctGroup', "production")
        self.acctGroupUser = getattr(config.BossAir, 'acctGroupUser',
                                     "cmsdataops")

        if hasattr(config.BossAir, 'condorRequirementsString'):
            self.reqStr = config.BossAir.condorRequirementsString
        else:
            self.reqStr = None

        # x509 proxy handling
        proxy = Proxy({'logger': myThread.logger})
        self.x509userproxy = proxy.getProxyFilename()

        # These are added now by the condor client
        #self.x509userproxysubject = proxy.getSubject()
        #self.x509userproxyfqan = proxy.getAttributeFromProxy(self.x509userproxy)

        return
Example #5
0
    def __init__(self, config):
        BasePlugin.__init__(self, config)

        self.locationDict = {}

        myThread = threading.currentThread()
        daoFactory = DAOFactory(package="WMCore.WMBS", logger=myThread.logger,
                                dbinterface=myThread.dbi)
        self.locationAction = daoFactory(classname="Locations.GetSiteInfo")

        self.packageDir = None

        if os.path.exists(os.path.join(getWMBASE(),
                                       'src/python/WMCore/WMRuntime/Unpacker.py')):
            self.unpacker = os.path.join(getWMBASE(),
                                         'src/python/WMCore/WMRuntime/Unpacker.py')
        else:
            self.unpacker = os.path.join(getWMBASE(),
                                         'WMCore/WMRuntime/Unpacker.py')

        self.agent = getattr(config.Agent, 'agentName', 'WMAgent')
        self.sandbox = None

        self.scriptFile = config.JobSubmitter.submitScript

        self.defaultTaskPriority = getattr(config.BossAir, 'defaultTaskPriority', 0)
        self.maxTaskPriority = getattr(config.BossAir, 'maxTaskPriority', 1e7)
        self.jobsPerSubmit = getattr(config.JobSubmitter, 'jobsPerSubmit', 200)
        self.extraMem = getattr(config.JobSubmitter, 'extraMemoryPerCore', 500)

        # Required for global pool accounting
        self.acctGroup = getattr(config.BossAir, 'acctGroup', "production")
        self.acctGroupUser = getattr(config.BossAir, 'acctGroupUser', "cmsdataops")

        # Build a requirement string.  All CMS resources match DESIRED_Sites on the START
        # expression side; however, there are currently some resources (T2_CH_CERN_HLT)
        # that are missing the REQUIRED_OS logic.  Hence, we duplicate it here.
        # TODO(bbockelm): Remove reqStr once HLT has upgraded.
        self.reqStr = ('((REQUIRED_OS=?="any") || '
                       '(GLIDEIN_REQUIRED_OS =?= "any") || '
                       'stringListMember(GLIDEIN_REQUIRED_OS, REQUIRED_OS)) && '
                       '(AuthenticatedIdentity =!= "*****@*****.**")')
        if hasattr(config.BossAir, 'condorRequirementsString'):
            self.reqStr = config.BossAir.condorRequirementsString

        # x509 proxy handling
        proxy = Proxy({'logger': myThread.logger})
        self.x509userproxy = proxy.getProxyFilename()
        self.x509userproxysubject = proxy.getSubject()
        self.x509userproxyfqan = proxy.getAttributeFromProxy(self.x509userproxy)
        # Remove the x509 ads if the job is matching a volunteer resource
        self.x509Expr = 'ifThenElse("$$(GLIDEIN_CMSSite)" =?= "T3_CH_Volunteer",undefined,"%s")'

        return
Example #6
0
 def stateMap():
     """
     For a given name, return a global state
 
 
     """
 
     stateDict = {'New': 'Pending',
                  'Gone': 'Error',
                  'Dead': 'Error'}
     
     # This call is optional but needs to for testing
     BasePlugin.verifyState(stateDict)
     return stateDict
Example #7
0
    def stateMap():
        """
        For a given name, return a global state


        """

        stateDict = {'New': 'Pending',
                     'Gone': 'Error',
                     'Dead': 'Error'}

        # This call is optional but needs to for testing
        BasePlugin.verifyState(stateDict)
        return stateDict
    def __init__(self, config):
        BasePlugin.__init__(self, config)

        self.locationDict = {}

        myThread = threading.currentThread()
        daoFactory = DAOFactory(package="WMCore.WMBS",
                                logger=myThread.logger,
                                dbinterface=myThread.dbi)
        self.locationAction = daoFactory(classname="Locations.GetSiteInfo")

        self.packageDir = None

        if os.path.exists(
                os.path.join(getWMBASE(),
                             'src/python/WMCore/WMRuntime/Unpacker.py')):
            self.unpacker = os.path.join(
                getWMBASE(), 'src/python/WMCore/WMRuntime/Unpacker.py')
        else:
            self.unpacker = os.path.join(getWMBASE(),
                                         'WMCore/WMRuntime/Unpacker.py')

        self.agent = getattr(config.Agent, 'agentName', 'WMAgent')
        self.sandbox = None

        self.scriptFile = config.JobSubmitter.submitScript

        self.defaultTaskPriority = getattr(config.BossAir,
                                           'defaultTaskPriority', 0)
        self.maxTaskPriority = getattr(config.BossAir, 'maxTaskPriority', 1e7)
        self.jobsPerSubmit = getattr(config.JobSubmitter, 'jobsPerSubmit', 200)

        # Required for global pool accounting
        self.acctGroup = getattr(config.BossAir, 'acctGroup', "production")
        self.acctGroupUser = getattr(config.BossAir, 'acctGroupUser',
                                     "cmsdataops")

        # Build a requirement string
        self.reqStr = "stringListMember(GLIDEIN_CMSSite, DESIRED_Sites) && ((REQUIRED_OS=?=\"any\") || (GLIDEIN_REQUIRED_OS=?=REQUIRED_OS)) && (TARGET.Cpus >= RequestCpus)"
        if hasattr(config.BossAir, 'condorRequirementsString'):
            self.reqStr = config.BossAir.condorRequirementsString

        # x509 proxy handling
        proxy = Proxy({'logger': myThread.logger})
        self.x509userproxy = proxy.getProxyFilename()
        self.x509userproxysubject = proxy.getSubject()

        return
    def __init__(self, config):
        BasePlugin.__init__(self, config)

        self.locationDict = {}

        myThread = threading.currentThread()
        daoFactory = DAOFactory(package="WMCore.WMBS", logger=myThread.logger,
                                dbinterface=myThread.dbi)
        self.locationAction = daoFactory(classname="Locations.GetSiteInfo")

        self.packageDir = None

        if os.path.exists(os.path.join(getWMBASE(),
                                       'src/python/WMCore/WMRuntime/Unpacker.py')):
            self.unpacker = os.path.join(getWMBASE(),
                                         'src/python/WMCore/WMRuntime/Unpacker.py')
        else:
            self.unpacker = os.path.join(getWMBASE(),
                                         'WMCore/WMRuntime/Unpacker.py')

        self.agent = getattr(config.Agent, 'agentName', 'WMAgent')
        self.sandbox = None

        self.scriptFile = config.JobSubmitter.submitScript

        self.defaultTaskPriority = getattr(config.BossAir, 'defaultTaskPriority', 0)
        self.maxTaskPriority = getattr(config.BossAir, 'maxTaskPriority', 1e7)
        self.jobsPerSubmit = getattr(config.JobSubmitter, 'jobsPerSubmit', 200)
        self.extraMem = getattr(config.JobSubmitter, 'extraMemoryPerCore', 500)

        # Required for global pool accounting
        self.acctGroup = getattr(config.BossAir, 'acctGroup', "production")
        self.acctGroupUser = getattr(config.BossAir, 'acctGroupUser', "cmsdataops")

        # Build a requirement string
        self.reqStr = ('stringListMember(GLIDEIN_CMSSite, DESIRED_Sites) '
                       '&& ((REQUIRED_OS=?="any") || stringListMember(GLIDEIN_REQUIRED_OS, REQUIRED_OS))'
                       '&& (TARGET.Cpus >= RequestCpus)')
        if hasattr(config.BossAir, 'condorRequirementsString'):
            self.reqStr = config.BossAir.condorRequirementsString

        # x509 proxy handling
        proxy = Proxy({'logger': myThread.logger})
        self.x509userproxy = proxy.getProxyFilename()
        self.x509userproxysubject = proxy.getSubject()

        return
Example #10
0
    def __init__(self, config):

        self.config = config

        BasePlugin.__init__(self, config)

        self.packageDir  = None
        self.unpacker    = os.path.join(getWMBASE(),
                                        'src/python/WMCore/WMRuntime/Unpacker.py')
        self.agent       = config.Agent.agentName
        self.sandbox     = None
        self.scriptFile  = None
        self.queue       = None
        self.resourceReq = None
        self.jobGroup    = None

        return
Example #11
0
    def __init__(self, config):

        self.config = config

        BasePlugin.__init__(self, config)

        self.packageDir = None
        self.unpacker = os.path.join(getWMBASE(),
                                     'WMCore/WMRuntime/Unpacker.py')
        self.agent = config.Agent.agentName
        self.sandbox = None
        self.scriptFile = None
        self.queue = None
        self.resourceReq = None
        self.jobGroup = None

        return
Example #12
0
    def __init__(self, config):

        self.config = config

        BasePlugin.__init__(self, config)

        self.packageDir  = None
        self.unpacker    = os.path.join(getWMBASE(),
                                        'WMCore/WMRuntime/Unpacker.py')
        self.agent       = config.Agent.agentName
        self.sandbox     = None
        self.scriptFile  = None
        self.queue       = None
        self.resourceReq = None
        self.jobGroup    = None
        self.basePrio    = getattr(config.BossAir, 'LsfBasePrio', 50)

        return
Example #13
0
    def __init__(self, config):

        BasePlugin.__init__(self, config)
        self.config = config

        self.pool = []
        self.createdReport = []
        self.myinput = None
        if getattr(config.BossAir, 'MockPlugin', None) == None:
            msg = "Missing required config.BossAir.MockPlugin section"
            raise BossAirPluginException( msg )

        self.nProcess = getattr(config.BossAir.MockPlugin, 'mockPluginProcesses', 4)
        self.jobRunTime = getattr(config.BossAir.MockPlugin, 'jobRunTime', 120) #default job running time is two hours
        logging.info('Job Running time set to minutes %s' % self.jobRunTime)

        self.fakeReport = getattr(config.BossAir.MockPlugin, 'fakeReport', None)
        if self.fakeReport == None:
            msg = 'config.BossAir.MockPlugin.fakeReport is a required parameter'
            raise BossAirPluginException( msg )
        elif not os.path.isfile(self.fakeReport):
            msg = 'Cannot find %s file' % self.fakeReport
            raise BossAirPluginException( msg )

        self.jobsScheduledEnd = {}

        self.states = [ 'New',
                        'Timeout',
                        'Submitted',
                        'Waiting',
                        'Ready',
                        'Scheduled',
                        'Running',
                        'Done(failed)',
                        'Done',
                        'Aborted',
                        'Cleared',
                        'Cancelled by user',
                        'Cancelled']
Example #14
0
    def stateMap():
        """
        For a given name, return a global state
        """

        stateDict = {'New': 'Pending',
                     'Timeout': 'Error',
                     'Submitted': 'Pending',
                     'Waiting': 'Pending',
                     'Ready': 'Pending',
                     'Scheduled': 'Pending',
                     'Running': 'Running',
                     'Done(failed)': 'Running',
                     'Done': 'Running',
                     'Aborted': 'Error',
                     'Cleared': 'Complete',
                     'Cancelled by user': '******',
                     'Cancelled': 'Error'
        }

        # This call is optional but needs to for testing
        BasePlugin.verifyState(stateDict)
        return stateDict
Example #15
0
    def stateMap():
        """
        For a given name, return a global state
        """

        stateDict = {'New': 'Pending',
                     'Timeout': 'Error',
                     'Submitted': 'Pending',
                     'Waiting': 'Pending',
                     'Ready': 'Pending',
                     'Scheduled': 'Pending',
                     'Running': 'Running',
                     'Done(failed)': 'Running',
                     'Done': 'Running',
                     'Aborted': 'Error',
                     'Cleared': 'Complete',
                     'Cancelled by user': '******',
                     'Cancelled': 'Error'
        }

        # This call is optional but needs to for testing
        BasePlugin.verifyState(stateDict)
        return stateDict
Example #16
0
    def testScramArchToOS(self):
        """
        _testScramArchToOS_

        Test the conversion of the ScramArch string to requiredOS
        """
        bp = BasePlugin(config=None)

        self.assertEqual(bp.scramArchtoRequiredOS('slc5_blah_blah'), 'rhel6')
        self.assertEqual(bp.scramArchtoRequiredOS('slc6_blah_blah'), 'rhel6')
        self.assertEqual(bp.scramArchtoRequiredOS('slc7_blah_blah'), 'rhel7')

        self.assertEqual(bp.scramArchtoRequiredOS(None), 'any')

        self.assertEqual(bp.scramArchtoRequiredOS(['slc6_blah_blah', 'slc7_blah_blah']), 'rhel6,rhel7')

        return
Example #17
0
    def __init__(self, config):

        self.config = config

        BasePlugin.__init__(self, config)

        self.locationDict = {}

        myThread = threading.currentThread()
        daoFactory = DAOFactory(package="WMCore.WMBS", logger = myThread.logger,
                                dbinterface = myThread.dbi)
        self.locationAction = daoFactory(classname = "Locations.GetSiteInfo")


        self.packageDir = None

        if os.path.exists(os.path.join(getWMBASE(),
                                       'src/python/WMCore/WMRuntime/Unpacker.py')):
            self.unpacker = os.path.join(getWMBASE(),
                                         'src/python/WMCore/WMRuntime/Unpacker.py')
        else:
            self.unpacker = os.path.join(getWMBASE(),
                                         'WMCore/WMRuntime/Unpacker.py')

        self.agent         = getattr(config.Agent, 'agentName', 'WMAgent')
        self.sandbox       = None
        self.scriptFile    = None
        self.submitDir     = None
        self.removeTime    = getattr(config.BossAir, 'removeTime', 60)
        self.useGSite      = getattr(config.BossAir, 'useGLIDEINSites', False)
        self.submitWMSMode = getattr(config.BossAir, 'submitWMSMode', False)
        self.errorThreshold= getattr(config.BossAir, 'submitErrorThreshold', 10)
        self.errorCount    = 0
        self.defaultTaskPriority = getattr(config.BossAir, 'defaultTaskPriority', 0)
        self.maxTaskPriority     = getattr(config.BossAir, 'maxTaskPriority', 1e7)

        # Required for global pool accounting
        self.acctGroup = getattr(config.BossAir, 'acctGroup', "production")
        self.acctGroupUser = getattr(config.BossAir, 'acctGroupUser', "cmsdataops")

        # Build ourselves a pool
        self.pool     = []
        self.input    = None
        self.result   = None
        self.nProcess = getattr(self.config.BossAir, 'nCondorProcesses', 4)

        # Set up my proxy and glexec stuff
        self.setupScript = getattr(config.BossAir, 'UISetupScript', None)
        self.proxy       = None
        self.serverCert  = getattr(config.BossAir, 'delegatedServerCert', None)
        self.serverKey   = getattr(config.BossAir, 'delegatedServerKey', None)
        self.myproxySrv  = getattr(config.BossAir, 'myproxyServer', None)
        self.proxyDir    = getattr(config.BossAir, 'proxyDir', '/tmp/')
        self.serverHash  = getattr(config.BossAir, 'delegatedServerHash', None)
        self.glexecPath  = getattr(config.BossAir, 'glexecPath', None)
        self.glexecWrapScript = getattr(config.BossAir, 'glexecWrapScript', None)
        self.glexecUnwrapScript = getattr(config.BossAir, 'glexecUnwrapScript', None)
        self.jdlProxyFile    = None # Proxy name to put in JDL (owned by submit user)
        self.glexecProxyFile = None # Copy of same file owned by submit user

        if self.glexecPath:
            if not (self.myproxySrv and self.proxyDir):
                raise WMException('glexec requires myproxyServer and proxyDir to be set.')
        if self.myproxySrv:
            if not (self.serverCert and self.serverKey):
                raise WMException('MyProxy server requires serverCert and serverKey to be set.')

        # Make the directory for the proxies
        if self.proxyDir and not os.path.exists(self.proxyDir):
            logging.debug("proxyDir not found: creating it.")
            try:
                os.makedirs(self.proxyDir, 0o1777)
            except Exception as ex:
                msg = "Error: problem when creating proxyDir directory - '%s'" % str(ex)
                raise BossAirPluginException(msg)
        elif not os.path.isdir(self.proxyDir):
            msg = "Error: proxyDir '%s' is not a directory" % self.proxyDir
            raise BossAirPluginException(msg)

        if self.serverCert and self.serverKey and self.myproxySrv:
            self.proxy = self.setupMyProxy()

        # Build a request string
        self.reqStr = "(Memory >= 1 && OpSys == \"LINUX\" ) && (Arch == \"INTEL\" || Arch == \"X86_64\") && stringListMember(GLIDEIN_CMSSite, DESIRED_Sites) && ((REQUIRED_OS==\"any\") || (GLIDEIN_REQUIRED_OS==REQUIRED_OS))"
        if hasattr(config.BossAir, 'condorRequirementsString'):
            self.reqStr = config.BossAir.condorRequirementsString

        return
Example #18
0
    def __init__(self, config):

        self.config = config

        BasePlugin.__init__(self, config)

        self.locationDict = {}

        myThread = threading.currentThread()
        daoFactory = DAOFactory(package="WMCore.WMBS", logger = myThread.logger,
                                dbinterface = myThread.dbi)
        self.locationAction = daoFactory(classname = "Locations.GetSiteInfo")


        self.packageDir = None

        if os.path.exists(os.path.join(getWMBASE(),
                                       'src/python/WMCore/WMRuntime/Unpacker.py')):
            self.unpacker = os.path.join(getWMBASE(),
                                         'src/python/WMCore/WMRuntime/Unpacker.py')
        else:
            self.unpacker = os.path.join(getWMBASE(),
                                         'WMCore/WMRuntime/Unpacker.py')

        self.agent         = getattr(config.Agent, 'agentName', 'WMAgent')
        self.sandbox       = None
        self.scriptFile    = None
        self.submitDir     = None
        self.removeTime    = getattr(config.BossAir, 'removeTime', 60)
        self.multiTasks    = getattr(config.BossAir, 'multicoreTaskTypes', [])
        self.useGSite      = getattr(config.BossAir, 'useGLIDEINSites', False)
        self.submitWMSMode = getattr(config.BossAir, 'submitWMSMode', False)
        self.errorThreshold= getattr(config.BossAir, 'submitErrorThreshold', 10)
        self.errorCount    = 0
        self.defaultTaskPriority = getattr(config.BossAir, 'defaultTaskPriority', 0)
        self.maxTaskPriority     = getattr(config.BossAir, 'maxTaskPriority', 1e7)

        # Build ourselves a pool
        self.pool     = []
        self.input    = None
        self.result   = None
        self.nProcess = getattr(self.config.BossAir, 'nCondorProcesses', 4)

        # Set up my proxy and glexec stuff
        self.setupScript = getattr(config.BossAir, 'UISetupScript', None)
        self.proxy       = None
        self.serverCert  = getattr(config.BossAir, 'delegatedServerCert', None)
        self.serverKey   = getattr(config.BossAir, 'delegatedServerKey', None)
        self.myproxySrv  = getattr(config.BossAir, 'myproxyServer', None)
        self.proxyDir    = getattr(config.BossAir, 'proxyDir', '/tmp/')
        self.serverHash  = getattr(config.BossAir, 'delegatedServerHash', None)
        self.glexecPath  = getattr(config.BossAir, 'glexecPath', None)
        self.glexecWrapScript = getattr(config.BossAir, 'glexecWrapScript', None)
        self.glexecUnwrapScript = getattr(config.BossAir, 'glexecUnwrapScript', None)
        self.jdlProxyFile    = None # Proxy name to put in JDL (owned by submit user)
        self.glexecProxyFile = None # Copy of same file owned by submit user

        if self.glexecPath:
            if not (self.myproxySrv and self.proxyDir):
                raise WMException('glexec requires myproxyServer and proxyDir to be set.')
        if self.myproxySrv:
            if not (self.serverCert and self.serverKey):
                raise WMException('MyProxy server requires serverCert and serverKey to be set.')

        # Make the directory for the proxies
        if self.proxyDir and not os.path.exists(self.proxyDir):
            logging.debug("proxyDir not found: creating it.")
            try:
                os.makedirs(self.proxyDir, 01777)
            except Exception, ex:
                msg = "Error: problem when creating proxyDir directory - '%s'" % str(ex)
                raise BossAirPluginException(msg)
Example #19
0
    def __init__(self, config):

        BasePlugin.__init__(self, config)

        self.states = ['New', 'Dead', 'Gone']
Example #20
0
    def testScramArchtoRequiredArch(self):
        """
        Test mapping of ScramArch to a given architecture
        """
        bp = BasePlugin(config=None)

        self.assertEqual(bp.scramArchtoRequiredArch('slc5_amd64_gcc481'),
                         'X86_64')
        self.assertEqual(bp.scramArchtoRequiredArch('slc6_amd64_gcc630'),
                         'X86_64')
        self.assertEqual(bp.scramArchtoRequiredArch('slc7_amd64_gcc10'),
                         'X86_64')
        self.assertEqual(bp.scramArchtoRequiredArch('slc7_aarch64_gcc700'),
                         'aarch64')
        self.assertEqual(bp.scramArchtoRequiredArch('slc7_ppc64le_gcc9'),
                         'ppc64le')
        self.assertIsNone(bp.scramArchtoRequiredArch(None))
        self.assertIsNone(bp.scramArchtoRequiredArch(None))
        with self.assertRaises(BossAirPluginException):
            bp.scramArchtoRequiredArch("slc7_BLAH_gcc700")

        self.assertEqual(
            bp.scramArchtoRequiredArch(
                ['slc5_amd64_gcc481', 'slc6_amd64_gcc630']), 'X86_64')
        self.assertEqual(
            bp.scramArchtoRequiredArch(
                ['slc7_amd64_gcc10', 'slc7_aarch64_gcc700']), 'X86_64')
        self.assertEqual(
            bp.scramArchtoRequiredArch([
                'slc7_amd64_gcc10', 'slc7_aarch64_gcc700', 'slc7_ppc64le_gcc9'
            ]), 'X86_64')
        self.assertEqual(
            bp.scramArchtoRequiredArch(
                ['slc7_aarch64_gcc700', 'slc7_ppc64le_gcc9']), 'ppc64le')

        return
Example #21
0
    def __init__(self, config):

        self.config = config

        BasePlugin.__init__(self, config)

        self.locationDict = {}

        myThread = threading.currentThread()
        daoFactory = DAOFactory(package="WMCore.WMBS", logger = myThread.logger,
                                dbinterface = myThread.dbi)
        self.locationAction = daoFactory(classname = "Locations.GetSiteInfo")


        self.packageDir = None

        if os.path.exists(os.path.join(getWMBASE(),
                                       'src/python/WMCore/WMRuntime/Unpacker.py')):
            self.unpacker = os.path.join(getWMBASE(),
                                         'src/python/WMCore/WMRuntime/Unpacker.py')
        else:
            self.unpacker = os.path.join(getWMBASE(),
                                         'WMCore/WMRuntime/Unpacker.py')

        self.agent         = getattr(config.Agent, 'agentName', 'WMAgent')
        self.sandbox       = None
        self.scriptFile    = None
        self.submitDir     = None
        self.removeTime    = getattr(config.BossAir, 'removeTime', 60)
        self.multiTasks    = getattr(config.BossAir, 'multicoreTaskTypes', [])
        self.useGSite      = getattr(config.BossAir, 'useGLIDEINSites', False)
        self.submitWMSMode = getattr(config.BossAir, 'submitWMSMode', False)
        self.errorThreshold= getattr(config.BossAir, 'submitErrorThreshold', 10)
        self.errorCount    = 0
        self.defaultTaskPriority = getattr(config.BossAir, 'defaultTaskPriority', 0)
        self.maxTaskPriority     = getattr(config.BossAir, 'maxTaskPriority', 1e7)

        # Build ourselves a pool
        self.pool     = []
        self.input    = None
        self.result   = None
        self.nProcess = getattr(self.config.BossAir, 'nCondorProcesses', 4)

        # Set up my proxy and glexec stuff
        self.setupScript = getattr(config.BossAir, 'UISetupScript', None)
        self.proxy       = None
        self.serverCert  = getattr(config.BossAir, 'delegatedServerCert', None)
        self.serverKey   = getattr(config.BossAir, 'delegatedServerKey', None)
        self.myproxySrv  = getattr(config.BossAir, 'myproxyServer', None)
        self.proxyDir    = getattr(config.BossAir, 'proxyDir', '/tmp/')
        self.serverHash  = getattr(config.BossAir, 'delegatedServerHash', None)
        self.glexecPath  = getattr(config.BossAir, 'glexecPath', None)
        self.glexecWrapScript = getattr(config.BossAir, 'glexecWrapScript', None)
        self.glexecUnwrapScript = getattr(config.BossAir, 'glexecUnwrapScript', None)
        self.jdlProxyFile    = None # Proxy name to put in JDL (owned by submit user)
        self.glexecProxyFile = None # Copy of same file owned by submit user

        if self.glexecPath:
            if not (self.myproxySrv and self.proxyDir):
                raise WMException('glexec requires myproxyServer and proxyDir to be set.')
        if self.myproxySrv:
            if not (self.serverCert and self.serverKey):
                raise WMException('MyProxy server requires serverCert and serverKey to be set.')

        # Make the directory for the proxies
        if self.proxyDir and not os.path.exists(self.proxyDir):
            logging.debug("proxyDir not found: creating it.")
            try:
                os.makedirs(self.proxyDir, 01777)
            except Exception, ex:
                msg = "Error: problem when creating proxyDir directory - '%s'" % str(ex)
                raise BossAirPluginException(msg)
Example #22
0
    def __init__(self, config):

        BasePlugin.__init__(self, config)

        self.states = ['New', 'Dead', 'Gone']
Example #23
0
    def __init__(self, config):

        self.config = config

        BasePlugin.__init__(self, config)

        self.locationDict = {}

        myThread = threading.currentThread()
        daoFactory = DAOFactory(package="WMCore.WMBS", logger = myThread.logger,
                                dbinterface = myThread.dbi)
        self.locationAction = daoFactory(classname = "Locations.GetSiteInfo")


        self.packageDir = None

        if os.path.exists(os.path.join(getWMBASE(),
                                       'src/python/WMCore/WMRuntime/Unpacker.py')):
            self.unpacker = os.path.join(getWMBASE(),
                                         'src/python/WMCore/WMRuntime/Unpacker.py')
        else:
            self.unpacker = os.path.join(getWMBASE(),
                                         'WMCore/WMRuntime/Unpacker.py')

        self.agent         = getattr(config.Agent, 'agentName', 'WMAgent')
        self.sandbox       = None
        self.scriptFile    = None
        self.submitDir     = None
        self.removeTime    = getattr(config.BossAir, 'removeTime', 60)
        self.useGSite      = getattr(config.BossAir, 'useGLIDEINSites', False)
        self.submitWMSMode = getattr(config.BossAir, 'submitWMSMode', False)
        self.errorThreshold= getattr(config.BossAir, 'submitErrorThreshold', 10)
        self.errorCount    = 0
        self.defaultTaskPriority = getattr(config.BossAir, 'defaultTaskPriority', 0)
        self.maxTaskPriority     = getattr(config.BossAir, 'maxTaskPriority', 1e7)

        # Required for global pool accounting
        self.acctGroup = getattr(config.BossAir, 'acctGroup', "production")
        self.acctGroupUser = getattr(config.BossAir, 'acctGroupUser', "cmsdataops")

        # Build ourselves a pool
        self.pool     = []
        self.input    = None
        self.result   = None
        self.nProcess = getattr(self.config.BossAir, 'nCondorProcesses', 4)

        # Set up my proxy and glexec stuff
        self.setupScript = getattr(config.BossAir, 'UISetupScript', None)
        self.proxy       = None
        self.serverCert  = getattr(config.BossAir, 'delegatedServerCert', None)
        self.serverKey   = getattr(config.BossAir, 'delegatedServerKey', None)
        self.myproxySrv  = getattr(config.BossAir, 'myproxyServer', None)
        self.proxyDir    = getattr(config.BossAir, 'proxyDir', '/tmp/')
        self.serverHash  = getattr(config.BossAir, 'delegatedServerHash', None)
        self.glexecPath  = getattr(config.BossAir, 'glexecPath', None)
        self.glexecWrapScript = getattr(config.BossAir, 'glexecWrapScript', None)
        self.glexecUnwrapScript = getattr(config.BossAir, 'glexecUnwrapScript', None)
        self.jdlProxyFile    = None # Proxy name to put in JDL (owned by submit user)
        self.glexecProxyFile = None # Copy of same file owned by submit user

        if self.glexecPath:
            if not (self.myproxySrv and self.proxyDir):
                raise WMException('glexec requires myproxyServer and proxyDir to be set.')
        if self.myproxySrv:
            if not (self.serverCert and self.serverKey):
                raise WMException('MyProxy server requires serverCert and serverKey to be set.')

        # Make the directory for the proxies
        if self.proxyDir and not os.path.exists(self.proxyDir):
            logging.debug("proxyDir not found: creating it.")
            try:
                os.makedirs(self.proxyDir, 0o1777)
            except Exception as ex:
                msg = "Error: problem when creating proxyDir directory - '%s'" % str(ex)
                raise BossAirPluginException(msg)
        elif not os.path.isdir(self.proxyDir):
            msg = "Error: proxyDir '%s' is not a directory" % self.proxyDir
            raise BossAirPluginException(msg)

        if self.serverCert and self.serverKey and self.myproxySrv:
            self.proxy = self.setupMyProxy()

        # Build a request string
        self.reqStr = "(Memory >= 1 && OpSys == \"LINUX\" ) && (Arch == \"INTEL\" || Arch == \"X86_64\") && stringListMember(GLIDEIN_CMSSite, DESIRED_Sites) && ((REQUIRED_OS==\"any\") || (GLIDEIN_REQUIRED_OS==REQUIRED_OS))"
        if hasattr(config.BossAir, 'condorRequirementsString'):
            self.reqStr = config.BossAir.condorRequirementsString

        return
    def __init__(self, config):
        BasePlugin.__init__(self, config)

        self.locationDict = {}

        myThread = threading.currentThread()
        daoFactory = DAOFactory(package="WMCore.WMBS",
                                logger=myThread.logger,
                                dbinterface=myThread.dbi)
        self.locationAction = daoFactory(classname="Locations.GetSiteInfo")

        self.packageDir = None

        # if agent is running in a container, Unpacker.py must come from a directory
        # on the host so the condor schedd can see it
        # config.General.workDir should always be bind mounted to the container
        if getattr(config.Agent, "isDocker", False):
            unpackerPath = os.path.join(config.General.workDir +
                                        "/Docker/WMRuntime/Unpacker.py")
        else:
            unpackerPath = os.path.join(
                getWMBASE(), 'src/python/WMCore/WMRuntime/Unpacker.py')

        if os.path.exists(unpackerPath):
            self.unpacker = unpackerPath
        else:
            self.unpacker = os.path.join(getWMBASE(),
                                         'WMCore/WMRuntime/Unpacker.py')

        self.agent = getattr(config.Agent, 'agentName', 'WMAgent')
        self.sandbox = None

        self.scriptFile = config.JobSubmitter.submitScript

        self.defaultTaskPriority = getattr(config.BossAir,
                                           'defaultTaskPriority', 0)
        self.maxTaskPriority = getattr(config.BossAir, 'maxTaskPriority', 1e7)
        self.jobsPerSubmit = getattr(config.JobSubmitter, 'jobsPerSubmit', 200)
        self.extraMem = getattr(config.JobSubmitter, 'extraMemoryPerCore', 500)

        # Required for global pool accounting
        self.acctGroup = getattr(config.BossAir, 'acctGroup', "production")
        self.acctGroupUser = getattr(config.BossAir, 'acctGroupUser',
                                     "cmsdataops")

        # Build a requirement string.  All CMS resources match DESIRED_Sites on the START
        # expression side; however, there are currently some resources (T2_CH_CERN_HLT)
        # that are missing the REQUIRED_OS logic.  Hence, we duplicate it here.
        # TODO(bbockelm): Remove reqStr once HLT has upgraded.
        self.reqStr = (
            '((REQUIRED_OS=?="any") || '
            '(GLIDEIN_REQUIRED_OS =?= "any") || '
            'stringListMember(GLIDEIN_REQUIRED_OS, REQUIRED_OS)) && '
            '(AuthenticatedIdentity =!= "*****@*****.**")')
        if hasattr(config.BossAir, 'condorRequirementsString'):
            self.reqStr = config.BossAir.condorRequirementsString

        # x509 proxy handling
        proxy = Proxy({'logger': myThread.logger})
        self.x509userproxy = proxy.getProxyFilename()

        # These are added now by the condor client
        #self.x509userproxysubject = proxy.getSubject()
        #self.x509userproxyfqan = proxy.getAttributeFromProxy(self.x509userproxy)

        return