Exemplo n.º 1
0
def findJob(name):
    """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: a Job object"""
    return Job(
        Cuebot.getStub('job').FindJob(job_pb2.JobFindJobRequest(name=name),
                                      timeout=Cuebot.Timeout).job)
Exemplo n.º 2
0
    def testFindJob(self, getStubMock):
        stubMock = mock.Mock()
        stubMock.FindJob.return_value = job_pb2.JobFindJobResponse(
            job=job_pb2.Job(name=TEST_JOB_NAME))
        getStubMock.return_value = stubMock

        job = opencue.api.findJob(TEST_JOB_NAME)

        stubMock.FindJob.assert_called_with(
            job_pb2.JobFindJobRequest(name=TEST_JOB_NAME), timeout=mock.ANY)
        self.assertEqual(TEST_JOB_NAME, job.name())