예제 #1
0
def getJob(uniq):
    """Returns a Job object for the given job ID.
    This will only return one or zero active job.
    @type  uniq: str
    @param uniq: a unique job identifier
    @rtype:  Job
    @return: a Job object"""
    return Job(
        Cuebot.getStub('job').GetJob(job_pb2.JobGetJobRequest(id=uniq),
                                     timeout=Cuebot.Timeout).job)
예제 #2
0
def getJob(uniq):
    """Returns a Job object for the given job name.
    This will only return one or zero active job.
    @type  name: str
    @param name: A job name
    @rtype:  Job
    @return: Job object"""
    return Job(
        Cuebot.getStub('job').GetJob(job_pb2.JobGetJobRequest(id=uniq),
                                     timeout=Cuebot.Timeout).job)
예제 #3
0
    def testGetJob(self, getStubMock):
        arbitraryId = '00000000-0000-0000-0000-012345678980'
        stubMock = mock.Mock()
        stubMock.GetJob.return_value = job_pb2.JobGetJobResponse(job=job_pb2.Job(id=arbitraryId))
        getStubMock.return_value = stubMock

        job = opencue.api.getJob(arbitraryId)

        stubMock.GetJob.assert_called_with(
            job_pb2.JobGetJobRequest(id=arbitraryId), timeout=mock.ANY)
        self.assertEqual(arbitraryId, job.id())