def setValue(act, value): if act.type == opencue.api.filter_pb2.MOVE_JOB_TO_GROUP: act.groupValue = opencue.proxy(value) act.valueType = opencue.api.filter_pb2.GROUP_TYPE elif act.type == opencue.api.filter_pb2.PAUSE_JOB: act.booleanValue = value act.valueType = opencue.api.filter_pb2.BOOLEAN_TYPE elif act.type in (opencue.api.filter_pb2.SET_JOB_PRIORITY, opencue.api.filter_pb2.SET_ALL_RENDER_LAYER_MEMORY): act.integerValue = int(value) act.valueType = opencue.api.filter_pb2.INTEGER_TYPE elif act.type in (opencue.api.filter_pb2.SET_JOB_MIN_CORES, opencue.api.filter_pb2.SET_JOB_MAX_CORES, opencue.api.filter_pb2.SET_ALL_RENDER_LAYER_CORES): act.floatValue = float(value) act.valueType = opencue.api.filter_pb2.FLOAT_TYPE elif act.type == opencue.api.filter_pb2.SET_ALL_RENDER_LAYER_TAGS: act.stringValue = value act.valueType = opencue.api.filter_pb2.STRING_TYPE elif act.type == opencue.api.filter_pb2.STOP_PROCESSING: act.valueType = opencue.api.filter_pb2.NONE_TYPE else: raise TypeError("invalid action type: %s" % act.type)
def testProxyUniqueId(self, getStubMock): """convert a string and class name to proxy""" id = 'A0000000-0000-0000-0000-000000000000' stubMock = mock.Mock() stubMock.GetGroup.return_value = job_pb2.GroupGetGroupResponse(group=job_pb2.Group(id=id)) getStubMock.return_value = stubMock proxy = opencue.proxy(id, 'Group') stubMock.GetGroup.assert_called_with(job_pb2.GroupGetGroupRequest(id=id)) self.assertEqual(id, proxy.group.id)
def testProxyUniqueIdArray(self, getStubMock): """convert a list of strings and a class name to a proxy""" ids = ['A0000000-0000-0000-0000-000000000000', 'B0000000-0000-0000-0000-000000000000'] stubMock = mock.Mock() stubMock.GetGroup.side_effect = lambda request : job_pb2.GroupGetGroupResponse( group=job_pb2.Group(id=request.id)) getStubMock.return_value = stubMock proxyList = opencue.proxy(ids, 'Group') stubMock.GetGroup.assert_has_calls([ mock.call(job_pb2.GroupGetGroupRequest(id=ids[0])), mock.call(job_pb2.GroupGetGroupRequest(id=ids[1])), ]) self.assertEqual(ids, [proxy.group.id for proxy in proxyList])
def transferHosts(src, dst): hosts = opencue.proxy(src).getHosts() logger.debug("transferring %d hosts from %s to %s" % (len(hosts), opencue.rep(src), opencue.rep(dst))) dst.proxy.reparentHosts(hosts)