コード例 #1
0
    def inject(self, task, pandajobspecs):
        """Injects in PanDA the taskbuffer objects containing the jobs specs.

           :arg TaskWorker.DataObject.Task task: the task to work on
           :arg list taskbuffer.JobSpecs pandajobspecs: the list of specs to inject
           :return: dictionary containining the injection resulting id's."""
        #check the number of the jobs. Panda does not allow to submit more than 5000 jobs
        if len(pandajobspecs) > 5000:
            msg = "Cannot submit jobs of task %s to Panda. More than 5000 jobs have been generated" % (
                task['tm_taskname'])
            raise PanDAException(msg)
        #pandajobspecs = pandajobspecs[0:2]
        status, injout = submitJobs(self.pandaurls['baseURLSSL'],
                                    jobs=pandajobspecs,
                                    proxy=task['user_proxy'],
                                    verbose=True)
        self.logger.info('PanDA submission exit code: %s' % status)
        if status != 0:
            msg = "Cannot submit jobs of task %s to Panda. Exit code %s " % (
                task['tm_taskname'], status)
            raise PanDAException(msg)
        jobsetdef = {}
        for jobid, defid, setid in injout:
            if setid['jobsetID'] in jobsetdef:
                jobsetdef[setid['jobsetID']].add(defid)
            else:
                jobsetdef[setid['jobsetID']] = set([defid])
        self.logger.debug(
            'Single PanDA injection resulted in %d distinct jobsets and %d jobdefs.'
            % (len(jobsetdef), sum([len(jobsetdef[k]) for k in jobsetdef])))
        return jobsetdef
コード例 #2
0
ファイル: PanDAInjection.py プロジェクト: khurtado/CRABServer
    def inject(self, task, pandajobspecs):
        """Injects in PanDA the taskbuffer objects containing the jobs specs.

           :arg TaskWorker.DataObject.Task task: the task to work on
           :arg list taskbuffer.JobSpecs pandajobspecs: the list of specs to inject
           :return: dictionary containining the injection resulting id's."""
        #pandajobspecs = pandajobspecs[0:2]
        status, injout = submitJobs(self.backendurls['baseURLSSL'], jobs=pandajobspecs, proxy=task['user_proxy'], verbose=True)
        self.logger.info('PanDA submission exit code: %s' % status)
        jobsetdef = {}
        for jobid, defid, setid in injout:
            if setid['jobsetID'] in jobsetdef:
                jobsetdef[setid['jobsetID']].add(defid)
            else:
                jobsetdef[setid['jobsetID']] = set([defid])
        self.logger.debug('Single PanDA injection resulted in %d distinct jobsets and %d jobdefs.' % (len(jobsetdef), sum([len(jobsetdef[k]) for k in jobsetdef])))
        return jobsetdef
コード例 #3
0
    def inject(self, task, pandajobspecs):
        """Injects in PanDA the taskbuffer objects containing the jobs specs.

           :arg TaskWorker.DataObject.Task task: the task to work on
           :arg list taskbuffer.JobSpecs pandajobspecs: the list of specs to inject
           :return: dictionary containining the injection resulting id's."""
        #check the number of the jobs. Panda does not allow to submit more than 5000 jobs
        if len(pandajobspecs) > 5000:
            msg = "Cannot submit jobs of task %s to Panda. More than 5000 jobs have been generated" % (task['tm_taskname'])
            raise PanDAException(msg)
        #pandajobspecs = pandajobspecs[0:2]
        status, injout = submitJobs(self.pandaurls['baseURLSSL'], jobs=pandajobspecs, proxy=task['user_proxy'], verbose=True)
        self.logger.info('PanDA submission exit code: %s' % status)
        if status != 0:
            msg = "Cannot submit jobs of task %s to Panda. Exit code %s " % (task['tm_taskname'], status)
            raise PanDAException(msg)
        jobsetdef = {}
        for jobid, defid, setid in injout:
            if setid['jobsetID'] in jobsetdef:
                jobsetdef[setid['jobsetID']].add(defid)
            else:
                jobsetdef[setid['jobsetID']] = set([defid])
        self.logger.debug('Single PanDA injection resulted in %d distinct jobsets and %d jobdefs.' % (len(jobsetdef), sum([len(jobsetdef[k]) for k in jobsetdef])))
        return jobsetdef