def launchSpec(spec): """Launch a new job with the given spec xml data. This call returns immediately but there is guarantee that the job was written to the database. @type spec: str @param spec: XML string containing job spec @rtype: List<str> @return: List of job names that were submitted """ return Cuebot.getStub('job').LaunchSpec( job_pb2.JobLaunchSpecRequest(spec=spec), timeout=Cuebot.Timeout).names
def testLaunchSpec(self, getStubMock): spec = 'arbitrary-spec' stubMock = mock.Mock() stubMock.LaunchSpec.return_value = job_pb2.JobLaunchSpecResponse( names=[TEST_JOB_NAME]) getStubMock.return_value = stubMock jobNames = opencue.api.launchSpec(spec) stubMock.LaunchSpec.assert_called_with( job_pb2.JobLaunchSpecRequest(spec=spec), timeout=mock.ANY) self.assertEqual([TEST_JOB_NAME], jobNames)