@@ -336,28 +336,30 @@ def submit(self, func, resource_specification, *args, **kwargs):
336
336
if resource_specification and isinstance (resource_specification , dict ):
337
337
logger .debug ("Got resource specification: {}" .format (resource_specification ))
338
338
339
- acceptable_resource_types = ['cores' , 'memory' , 'disk' ]
340
- keys = list (resource_specification .keys ())
341
- if len (keys ) != 3 :
342
- logger .error ("Task resource specification requires "
339
+ acceptable_resource_types = set (['cores' , 'memory' , 'disk' ])
340
+ keys = set (resource_specification .keys ())
341
+ if self .autolabel :
342
+ if not keys .issubset (acceptable_resource_types ):
343
+ logger .error ("Task resource specification only accepts "
344
+ "three types of resources: cores, memory, and disk" )
345
+ raise ExecutorError (self , "Task resource specification only accepts "
346
+ "three types of resources: cores, memory, and disk" )
347
+
348
+ elif keys != acceptable_resource_types :
349
+ logger .error ("Running with `autolabel=False`. In this mode, "
350
+ "task resource specification requires "
343
351
"three resources to be specified simultaneously: cores, memory, and disk" )
344
352
raise ExecutorError (self , "Task resource specification requires "
345
353
"three resources to be specified simultaneously: cores, memory, and disk, "
346
- "and only takes these three resource types." )
347
-
348
- if not all (k .lower () in acceptable_resource_types for k in keys ):
349
- logger .error ("Task resource specification only accepts "
350
- "three types of resources: cores, memory, and disk" )
351
- raise ExecutorError (self , "Task resource specification requires "
352
- "three resources to be specified simultaneously: cores, memory, and disk, "
353
- "and only takes these three resource types." )
354
+ "and only takes these three resource types, when running with `autolabel=False`. "
355
+ "Try setting autolabel=True if you are unsure of the resource usage" )
354
356
355
357
for k in keys :
356
- if k . lower () == 'cores' :
358
+ if k == 'cores' :
357
359
cores = resource_specification [k ]
358
- elif k . lower () == 'memory' :
360
+ elif k == 'memory' :
359
361
memory = resource_specification [k ]
360
- elif k . lower () == 'disk' :
362
+ elif k == 'disk' :
361
363
disk = resource_specification [k ]
362
364
363
365
self .task_counter += 1
0 commit comments