def setMaxCores(self, cores): """Sets the maximum number of cores that this layer requires. @type cores: float @param cores: Core units, 100 reserves 1 core""" return self.stub.SetMaxCores(job_pb2.LayerSetMaxCoresRequest( layer=self.data, cores=cores / 100.0), timeout=Cuebot.Timeout)
def testSetMaxCores(self, getStubMock): stubMock = mock.Mock() stubMock.SetMaxCores.return_value = job_pb2.LayerSetMaxCoresResponse() getStubMock.return_value = stubMock testCores = 100 testCoresActual = testCores/100.0 layer = opencue.wrappers.layer.Layer( job_pb2.Layer(name=TEST_LAYER_NAME)) layer.setMaxCores(testCores) stubMock.SetMaxCores.assert_called_with( job_pb2.LayerSetMaxCoresRequest(layer=layer.data, cores=testCoresActual), timeout=mock.ANY)