diff --git a/cuebot/src/main/java/com/imageworks/spcue/dispatcher/CoreUnitDispatcher.java b/cuebot/src/main/java/com/imageworks/spcue/dispatcher/CoreUnitDispatcher.java index 7b3cd911f..1055234f6 100644 --- a/cuebot/src/main/java/com/imageworks/spcue/dispatcher/CoreUnitDispatcher.java +++ b/cuebot/src/main/java/com/imageworks/spcue/dispatcher/CoreUnitDispatcher.java @@ -90,6 +90,7 @@ public class CoreUnitDispatcher implements Dispatcher { private final long MEM_RESERVED_MIN; private final long MEM_GPU_RESERVED_DEFAULT; private final long MEM_GPU_RESERVED_MIN; + private final boolean SKIP_GPU_RESERVATION; private Environment env; @@ -105,6 +106,7 @@ public CoreUnitDispatcher(Environment env) { MEM_RESERVED_MIN = getLongProperty("dispatcher.memory.mem_reserved_min"); MEM_GPU_RESERVED_DEFAULT = getLongProperty("dispatcher.memory.mem_gpu_reserved_default"); MEM_GPU_RESERVED_MIN = getLongProperty("dispatcher.memory.mem_gpu_reserved_min"); + SKIP_GPU_RESERVATION = getBooleanProperty("dispatcher.gpu.skip_resource_reservation"); } /* @@ -115,12 +117,19 @@ private int getIntProperty(String property) { } /* - * Return an integer value from the opencue.properties given a key + * Return a long value from the opencue.properties given a key */ private long getLongProperty(String property) { return env.getRequiredProperty(property, Long.class); } + /* + * Return a boolean value from the opencue.properties given a key + */ + private boolean getBooleanProperty(String property) { + return env.getRequiredProperty(property, Boolean.class); + } + private Cache getOrCreateJobLock() { if (jobLock == null) { this.jobLock = CacheBuilder.newBuilder() @@ -188,7 +197,10 @@ private Set getGpuJobs(DispatchHost host, ShowInterface show) { getIntProperty("dispatcher.job_query_max")); if (jobs.size() == 0) { - host.removeGpu(); + // Only remove GPU resources if skip reservation is disabled (default behavior) + if (!SKIP_GPU_RESERVATION) { + host.removeGpu(); + } jobs = null; } } diff --git a/cuebot/src/main/resources/opencue.properties b/cuebot/src/main/resources/opencue.properties index 1d450d317..a22f44320 100644 --- a/cuebot/src/main/resources/opencue.properties +++ b/cuebot/src/main/resources/opencue.properties @@ -215,6 +215,11 @@ dispatcher.memory.mem_gpu_reserved_min = 0 # Default = 100GB dispatcher.memory.mem_gpu_reserved_max = 104857600 +# On job dispatch, skip GPU resource reservation when no GPU jobs are found +# Set to true to allow normal frames to use full host resources even when GPU is available +# Environment variable: CUEBOT_DISPATCHER_SKIP_GPU_RESERVATION +dispatcher.gpu.skip_resource_reservation=${CUEBOT_DISPATCHER_SKIP_GPU_RESERVATION:false} + # Whether to satisfy dependents (*_ON_FRAME and *_ON_LAYER) only on Frame success depend.satisfy_only_on_frame_success=true diff --git a/cuebot/src/test/resources/opencue.properties b/cuebot/src/test/resources/opencue.properties index 956332681..eae152544 100644 --- a/cuebot/src/test/resources/opencue.properties +++ b/cuebot/src/test/resources/opencue.properties @@ -95,5 +95,8 @@ dispatcher.memory.mem_gpu_reserved_default = 0 dispatcher.memory.mem_gpu_reserved_min = 0 dispatcher.memory.mem_gpu_reserved_max = 104857600 +# GPU reservation behavior in dispatcher (skip when no GPU jobs are found) +dispatcher.gpu.skip_resource_reservation=${CUEBOT_DISPATCHER_SKIP_GPU_RESERVATION:false} + # Loki log.loki.url = http://localhost/loki/api