Example #1
0
 def createDependencyOnLayer(self, layer):
     """Create and return a job on layer dependency
     @type  layer: opencue.wrappers.layer.Layer
     @param layer: the layer you want this job to depend on
     @rtype:  opencue.wrappers.Depend
     @return: the new dependency"""
     response = self.stub.CreateDependencyOnLayer(
         job_pb2.JobCreateDependencyOnLayerRequest(job=self.data, layer=layer.data),
         timeout=Cuebot.Timeout)
     return opencue.wrappers.depend.Depend(response.depend)
Example #2
0
    def testCreateDependencyOnLayer(self, getStubMock):
        dependId = 'ddd-dddd-ddd'
        dependLayer = 'testLayer'
        stubMock = mock.Mock()
        stubMock.CreateDependencyOnLayer.return_value = job_pb2.JobCreateDependencyOnLayerResponse(
            depend=depend_pb2.Depend(id=dependId))
        getStubMock.return_value = stubMock

        onLayer = job_pb2.Layer(name=dependLayer)
        job = opencue.wrappers.job.Job(
            job_pb2.Job(name=TEST_JOB_NAME))
        depend = job.createDependencyOnLayer(onLayer)

        stubMock.CreateDependencyOnLayer.assert_called_with(
            job_pb2.JobCreateDependencyOnLayerRequest(job=job.data, layer=onLayer),
            timeout=mock.ANY)
        self.assertEqual(depend.id(), dependId)