Skip to content

Commit

Permalink
Add layer max cores. (#1125)
Browse files Browse the repository at this point in the history
  • Loading branch information
akim-ruslanov committed Jun 4, 2022
1 parent a929b90 commit 81a272a
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 13 deletions.
2 changes: 1 addition & 1 deletion VERSION.in
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.17
0.18
12 changes: 11 additions & 1 deletion cuebot/src/main/java/com/imageworks/spcue/dao/LayerDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public interface LayerDao {
LayerInterface findLayer(JobInterface job, String name);

/**
* update the number of cores the layer requires
* update the number of min cores the layer requires
*
* @param layer
* @param val
Expand Down Expand Up @@ -270,6 +270,16 @@ public interface LayerDao {
*/
void updateMinGpuMemory(JobInterface job, long mem, LayerType type);

/**
* Update all layers of the set type in the specified job
* with the new max cores requirement.
*
* @param job
* @param cores
* @param type
*/
void updateMaxCores(JobInterface job, int cores, LayerType type);

/**
* Update all layers of the set type in the specified job
* with the new min cores requirement.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,13 @@ public void updateMinCores(JobInterface job, int cores, LayerType type) {
cores, job.getJobId(), type.toString());
}

@Override
public void updateMaxCores(JobInterface job, int cores, LayerType type) {
getJdbcTemplate().update(
"UPDATE layer SET int_cores_max=? WHERE pk_job=? AND str_type=?",
cores, job.getJobId(), type.toString());
}

@Override
public void updateMinGpus(JobInterface job, int gpus, LayerType type) {
getJdbcTemplate().update(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,10 +396,14 @@ public boolean applyAction(ActionEntity action, JobDetail job, Context context)
layerDao.updateMinMemory(job, (int) action.intValue, LayerType.RENDER);
break;

case SET_ALL_RENDER_LAYER_CORES:
case SET_ALL_RENDER_LAYER_MIN_CORES:
layerDao.updateMinCores(job, Convert.coresToCoreUnits(action.floatValue), LayerType.RENDER);
break;

case SET_ALL_RENDER_LAYER_MAX_CORES:
layerDao.updateMaxCores(job, Convert.coresToCoreUnits(action.floatValue), LayerType.RENDER);
break;

case SET_MEMORY_OPTIMIZER:
List<LayerInterface> layers = layerDao.getLayers(job);
for (LayerInterface layer : layers) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ public void testApplyActionSetRenderCoreLayers() {
filterDao.insertFilter(f);

ActionEntity a1 = new ActionEntity();
a1.type = ActionType.SET_ALL_RENDER_LAYER_CORES;
a1.type = ActionType.SET_ALL_RENDER_LAYER_MIN_CORES;
a1.filterId = f.getFilterId();
a1.valueType = ActionValueType.FLOAT_TYPE;
a1.floatValue = 40f;
Expand Down
24 changes: 19 additions & 5 deletions cuegui/cuegui/FilterDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,11 +480,22 @@ def createAction(self):
2)
value = int(value * 1048576)

elif actionType in (opencue.api.filter_pb2.SET_ALL_RENDER_LAYER_CORES,):
elif actionType in (opencue.api.filter_pb2.SET_ALL_RENDER_LAYER_MIN_CORES,):
(value, choice) = QtWidgets.QInputDialog.getDouble(
self,
"Create Action",
"How many cores should every render layer require?",
"How many min cores should every render layer require?",
1,
0.1,
100,
2)
value = float(value)

elif actionType in (opencue.api.filter_pb2.SET_ALL_RENDER_LAYER_MAX_CORES,):
(value, choice) = QtWidgets.QInputDialog.getDouble(
self,
"Create Action",
"How many max cores should every render layer require?",
1,
0.1,
100,
Expand Down Expand Up @@ -728,7 +739,8 @@ def __setValue(self, value=None):

elif self.rpcObject.type() in (opencue.api.filter_pb2.SET_JOB_MAX_CORES,
opencue.api.filter_pb2.SET_JOB_MIN_CORES,
opencue.api.filter_pb2.SET_ALL_RENDER_LAYER_CORES):
opencue.api.filter_pb2.SET_ALL_RENDER_LAYER_MIN_CORES,
opencue.api.filter_pb2.SET_ALL_RENDER_LAYER_MAX_CORES):
value = float(widget.value())

elif self.rpcObject.type() in (opencue.api.filter_pb2.SET_ALL_RENDER_LAYER_TAGS,):
Expand Down Expand Up @@ -765,7 +777,8 @@ def updateWidgets(self):
widget.editingFinished.connect(self.__setValue) # pylint: disable=no-member

elif self.rpcObject.type() in (opencue.api.filter_pb2.SET_ALL_RENDER_LAYER_MEMORY,
opencue.api.filter_pb2.SET_ALL_RENDER_LAYER_CORES):
opencue.api.filter_pb2.SET_ALL_RENDER_LAYER_MIN_CORES,
opencue.api.filter_pb2.SET_ALL_RENDER_LAYER_MAX_CORES):
widget = NoWheelDoubleSpinBox(self.parent())
widget.setDecimals(2)
widget.setSingleStep(.10)
Expand Down Expand Up @@ -817,7 +830,8 @@ def updateWidgets(self):
elif self.rpcObject.type() in (opencue.api.filter_pb2.SET_ALL_RENDER_LAYER_TAGS,):
self.__widgets["ActionValue"].setText(self.rpcObject.value())

elif self.rpcObject.type() in (opencue.api.filter_pb2.SET_ALL_RENDER_LAYER_CORES,
elif self.rpcObject.type() in (opencue.api.filter_pb2.SET_ALL_RENDER_LAYER_MIN_CORES,
opencue.api.filter_pb2.SET_ALL_RENDER_LAYER_MAX_CORES,
opencue.api.filter_pb2.SET_JOB_MAX_CORES,
opencue.api.filter_pb2.SET_JOB_MIN_CORES):
self.__widgets["ActionValue"].setValue(float(str(self.rpcObject.value())))
Expand Down
9 changes: 7 additions & 2 deletions proto/filter.proto
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,15 @@ enum ActionType {
SET_ALL_RENDER_LAYER_TAGS = 6;
// Sets all layer minimum memory for any layer with the type "Render"
SET_ALL_RENDER_LAYER_MEMORY = 7;
// Sets all min cores for any layer with the type "Render"
SET_ALL_RENDER_LAYER_CORES = 8;
// This field is deprecated, use SET_ALL_RENDER_LAYER_MIN_CORES and
// SET_ALL_RENDER_LAYER_MAX_CORES instead.
SET_ALL_RENDER_LAYER_CORES = 8 [deprecated = true];
// Set memory optimizer
SET_MEMORY_OPTIMIZER = 9;
// Sets all min cores for any layer with the type "Render"
SET_ALL_RENDER_LAYER_MIN_CORES = 10;
// Sets all max cores for any layer with the type "Render"
SET_ALL_RENDER_LAYER_MAX_CORES = 11;
};

enum ActionValueType {
Expand Down
6 changes: 4 additions & 2 deletions pycue/opencue/wrappers/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ class ActionType(enum.IntEnum):
SET_JOB_PRIORITY = filter_pb2.SET_JOB_PRIORITY
SET_ALL_RENDER_LAYER_TAGS = filter_pb2.SET_ALL_RENDER_LAYER_TAGS
SET_ALL_RENDER_LAYER_MEMORY = filter_pb2.SET_ALL_RENDER_LAYER_MEMORY
SET_ALL_RENDER_LAYER_CORES = filter_pb2.SET_ALL_RENDER_LAYER_CORES
SET_ALL_RENDER_LAYER_MIN_CORES = filter_pb2.SET_ALL_RENDER_LAYER_MIN_CORES
SET_ALL_RENDER_LAYER_MAX_CORES = filter_pb2.SET_ALL_RENDER_LAYER_MAX_CORES
SET_MEMORY_OPTIMIZER = filter_pb2.SET_MEMORY_OPTIMIZER

class ActionValueType(enum.IntEnum):
Expand Down Expand Up @@ -390,7 +391,8 @@ def setTypeAndValue(self, actionType, value):

elif actionType in (filter_pb2.SET_JOB_MIN_CORES,
filter_pb2.SET_JOB_MAX_CORES,
filter_pb2.SET_ALL_RENDER_LAYER_CORES):
filter_pb2.SET_ALL_RENDER_LAYER_MIN_CORES,
filter_pb2.SET_ALL_RENDER_LAYER_MAX_CORES):
self.data.float_value = float(value)
self.data.value_type = filter_pb2.FLOAT_TYPE

Expand Down

0 comments on commit 81a272a

Please sign in to comment.