Beispiel #1
0
def retrieveJob(site):
    function = "getJob"
    node = {}
    node['siteName'] = site
    node['mem'] = 1000
    node['node'] = socket.getfqdn()

    data = sendCommand(function, node, _logger)
    jobD = parse_qs(data)  # jobD indicates it's a job in dictionary format, not a JobSpec object
    return jobD
def retrieveJob(site):
    function = "getJob"
    node = {}
    node['siteName'] = site
    node['mem'] = 1000
    node['node'] = socket.getfqdn()

    data = sendCommand(function, node, _logger)
    jobD = urlparse.parse_qs(data)  # jobD indicates it's a job in dictionary format, not a JobSpec object
    return jobD
    def sendDDMCallbacks(self):

        #Output dataset
        #TODO: This module should be decoupled from taskBuffer - there should be a web call
        dataset = taskBuffer.queryDatasetWithMap({'name': self.__datasetName}) 

        node={}
        node['vuid'] = dataset.vuid
        node['site'] = self.__site
        
        function="datasetCompleted"
        data = sendCommand(function, node)
        
        assert data == "True", "DDM Callback did not return as expected for OUTPUT dataset. data = %s" %data
    def sendDDMCallbacks(self):

        #Output dataset
        #TODO: This module should be decoupled from taskBuffer - there should be a web call
        dataset = taskBuffer.queryDatasetWithMap({'name': self.__datasetName})

        node = {}
        node['vuid'] = dataset.vuid
        node['site'] = self.__site

        function = "datasetCompleted"
        data = sendCommand(function, node)

        assert data == "True", "DDM Callback did not return as expected for OUTPUT dataset. data = %s" % data
    def __finishJob(self, job, jobID):

        files_xml = ""
        files_meta = ""
        for file in job.Files:
            if file.type in ['output', 'log']:

                file.GUID = uuid.uuid1()
                srm = "srm://srm-eosatlas.cern.ch/eos/atlas/atlasdatadisk/rucio/panda/"
                path = self.__calculate_path(file.lfn)
                pfn = srm + path + file.lfn

                _logger.info("pfn: %s" % pfn)
                files_xml += self.__XMLTEMPLATE_FILE.format(lfn=file.lfn,
                                                            guid=file.GUID,
                                                            srm=srm,
                                                            pfn=pfn)
                files_meta += self.__XMLTEMPLATE_FILEMETA.format(
                    guid=file.GUID, lfn=file.lfn)

        xml = self.__XMLTEMPLATE_BASE.format(info=files_xml)
        _logger.info("%s" % xml)
        meta = self.__XMLTEMPLATE_BASE.format(
            info=self.__XMLTEMPLATE_META.format(files=files_meta))
        _logger.info("%s" % meta)

        node = {}
        node['jobId'] = jobID
        node['state'] = 'finished'
        #node['state']='failed'
        #node['pilotErrorCode']=1200
        #node['pilotErrorCode']=-1202
        node['pilotErrorDiag'] = 'aaaaaaaaaaaaaaaaaaaaaaa'
        node['metaData'] = meta
        node['siteName'] = self.__site
        node['attemptNr'] = 0
        node['jobMetrics'] = "aaaaa=2 bbbb=3"
        node['coreCount'] = 10
        node['xml'] = xml

        function = "updateJob"
        data = sendCommand(function, node)
        _logger.info("%s" % data)
    def __finishJob(self, job, jobID):

        files_xml = ""
        files_meta = "" 
        for file in job.Files:
            if file.type in ['output', 'log']:
            
                file.GUID = uuid.uuid1()
                srm = "srm://srm-eosatlas.cern.ch/eos/atlas/atlasdatadisk/rucio/panda/"
                path = self.__calculate_path(file.lfn)
                pfn = srm+path+file.lfn

                _logger.info("pfn: %s"%pfn)
                files_xml += self.__XMLTEMPLATE_FILE.format(lfn=file.lfn, guid=file.GUID, srm=srm, pfn=pfn)
                files_meta += self.__XMLTEMPLATE_FILEMETA.format(guid=file.GUID, lfn=file.lfn)
        
        xml = self.__XMLTEMPLATE_BASE.format(info=files_xml)
        _logger.info("%s"%xml)
        meta = self.__XMLTEMPLATE_BASE.format(info=self.__XMLTEMPLATE_META.format(files=files_meta))
        _logger.info("%s"%meta)

        node = {}
        node['jobId'] = jobID
        node['state'] = 'finished'
        #node['state']='failed'
        #node['pilotErrorCode']=1200
        #node['pilotErrorCode']=-1202
        node['pilotErrorDiag'] = 'aaaaaaaaaaaaaaaaaaaaaaa'
        node['metaData'] = meta
        node['siteName'] = self.__site
        node['attemptNr'] = 0
        node['jobMetrics'] = "aaaaa=2 bbbb=3"
        node['coreCount'] = 10
        node['xml'] = xml
        
        function = "updateJob"
        data = sendCommand(function, node)
        _logger.info("%s"%data)