def isJobPending(name): """Returns true if there is an active job in the cue in the pending state. @type name: str @param name: a job name @rtype: bool @return: true if the job exists""" return Cuebot.getStub('job').IsJobPending( job_pb2.JobIsJobPendingRequest(name=name), timeout=Cuebot.Timeout).value
def testIsJobPending(self, getStubMock): stubMock = mock.Mock() stubMock.IsJobPending.return_value = job_pb2.JobIsJobPendingResponse(value=True) getStubMock.return_value = stubMock self.assertTrue(opencue.api.isJobPending(TEST_SHOW_NAME)) stubMock.IsJobPending.return_value = job_pb2.JobIsJobPendingResponse(value=False) self.assertFalse(opencue.api.isJobPending(TEST_SHOW_NAME)) stubMock.IsJobPending.assert_called_with( job_pb2.JobIsJobPendingRequest(name=TEST_SHOW_NAME), timeout=mock.ANY)