示例#1
0
 def getJob(self, jobId, withTroves=True, withConfigs=True):
     try:
         return self.jobStore.getJob(jobId,
                                     withTroves=withTroves,
                                     withConfigs=withConfigs)
     except KeyError:
         raise errors.JobNotFound(jobId)
示例#2
0
 def getJobs(self, jobIds, withTroves=True, withConfigs=True):
     try:
         return self.jobStore.getJobs(jobIds,
                                      withTroves=withTroves,
                                      withConfigs=withConfigs)
     except KeyError, err:
         raise errors.JobNotFound(err.args[0])
示例#3
0
    def convertToJobIds(self, items):
        """
            Converts a list of mixed jobIds and uuids to jobIds
            @param jobIdUUIDList: list of jobIds or uuids, or an
            @return list of jobIds
        """
        uuids = [x for x in items if isinstance(x, str) and len(x) == 32]

        try:
            d = dict(
                itertools.izip(uuids, self.jobStore.getJobIdsFromUUIDs(uuids)))
        except KeyError, err:
            raise errors.JobNotFound(err.args[0])
示例#4
0
 def getConfig(self, jobId, context=''):
     try:
         return self.jobStore.getConfig(jobId, context)
     except KeyError, err:
         raise errors.JobNotFound(err.args[0])
示例#5
0
            d = dict(
                itertools.izip(uuids, self.jobStore.getJobIdsFromUUIDs(uuids)))
        except KeyError, err:
            raise errors.JobNotFound(err.args[0])

        jobIds = []
        for jobIdUUId in items:
            if isinstance(jobIdUUId, int):
                jobIds.append(jobIdUUId)
            elif jobIdUUId in d:
                jobIds.append(d[jobIdUUId])
            else:
                try:
                    jobId = int(jobIdUUId)
                except ValueError:
                    raise errors.JobNotFound(jobIdUUId)
                jobIds.append(jobId)

        return jobIds

    def getJobsByState(self, state, withTroves=True):
        return self.jobStore.getJobsByState(state, withTroves=withTroves)

    def popJobFromQueue(self):
        try:
            jobId = self.jobQueue.pop()
        except IndexError:
            return None
        self.commit()
        return self.getJob(jobId)