@@ -90,6 +90,7 @@ public class CoreUnitDispatcher implements Dispatcher {
9090 private final long MEM_RESERVED_MIN ;
9191 private final long MEM_GPU_RESERVED_DEFAULT ;
9292 private final long MEM_GPU_RESERVED_MIN ;
93+ private final boolean SKIP_GPU_RESERVATION ;
9394
9495 private Environment env ;
9596
@@ -105,6 +106,7 @@ public CoreUnitDispatcher(Environment env) {
105106 MEM_RESERVED_MIN = getLongProperty ("dispatcher.memory.mem_reserved_min" );
106107 MEM_GPU_RESERVED_DEFAULT = getLongProperty ("dispatcher.memory.mem_gpu_reserved_default" );
107108 MEM_GPU_RESERVED_MIN = getLongProperty ("dispatcher.memory.mem_gpu_reserved_min" );
109+ SKIP_GPU_RESERVATION = getBooleanProperty ("dispatcher.gpu.skip_resource_reservation" );
108110 }
109111
110112 /*
@@ -115,12 +117,19 @@ private int getIntProperty(String property) {
115117 }
116118
117119 /*
118- * Return an integer value from the opencue.properties given a key
120+ * Return a long value from the opencue.properties given a key
119121 */
120122 private long getLongProperty (String property ) {
121123 return env .getRequiredProperty (property , Long .class );
122124 }
123125
126+ /*
127+ * Return a boolean value from the opencue.properties given a key
128+ */
129+ private boolean getBooleanProperty (String property ) {
130+ return env .getRequiredProperty (property , Boolean .class );
131+ }
132+
124133 private Cache <String , String > getOrCreateJobLock () {
125134 if (jobLock == null ) {
126135 this .jobLock = CacheBuilder .newBuilder ()
@@ -188,7 +197,10 @@ private Set<String> getGpuJobs(DispatchHost host, ShowInterface show) {
188197 getIntProperty ("dispatcher.job_query_max" ));
189198
190199 if (jobs .size () == 0 ) {
191- host .removeGpu ();
200+ // Only remove GPU resources if skip reservation is disabled (default behavior)
201+ if (!SKIP_GPU_RESERVATION ) {
202+ host .removeGpu ();
203+ }
192204 jobs = null ;
193205 }
194206 }
0 commit comments