executorlib 1.8.2__py3-none-any.whl → 1.9.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
executorlib/_version.py CHANGED
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '1.8.2'
32
- __version_tuple__ = version_tuple = (1, 8, 2)
31
+ __version__ = version = '1.9.1'
32
+ __version_tuple__ = version_tuple = (1, 9, 1)
33
33
 
34
34
  __commit_id__ = commit_id = None
executorlib/api.py CHANGED
@@ -8,6 +8,7 @@ functionality is considered internal and might change during minor releases.
8
8
  from executorlib.executor.single import TestClusterExecutor
9
9
  from executorlib.standalone.command import get_command_path
10
10
  from executorlib.standalone.interactive.communication import (
11
+ ExecutorlibSocketError,
11
12
  SocketInterface,
12
13
  interface_bootup,
13
14
  interface_connect,
@@ -32,4 +33,5 @@ __all__: list[str] = [
32
33
  "MpiExecSpawner",
33
34
  "SocketInterface",
34
35
  "SubprocessSpawner",
36
+ "ExecutorlibSocketError",
35
37
  ]
@@ -9,9 +9,14 @@ from executorlib.standalone.inputcheck import (
9
9
  check_plot_dependency_graph,
10
10
  check_pmi,
11
11
  check_refresh_rate,
12
+ check_restart_limit,
12
13
  check_wait_on_shutdown,
13
14
  validate_number_of_cores,
14
15
  )
16
+ from executorlib.standalone.validate import (
17
+ validate_resource_dict,
18
+ validate_resource_dict_with_optional_keys,
19
+ )
15
20
  from executorlib.task_scheduler.interactive.blockallocation import (
16
21
  BlockAllocationTaskScheduler,
17
22
  )
@@ -34,17 +39,23 @@ class FluxJobExecutor(BaseExecutor):
34
39
  cache_directory (str, optional): The directory to store cache files. Defaults to "executorlib_cache".
35
40
  max_cores (int): defines the number cores which can be used in parallel
36
41
  resource_dict (dict): A dictionary of resources required by the task. With the following keys:
37
- - cores (int): number of MPI cores to be used for each function call
38
- - threads_per_core (int): number of OpenMP threads to be used for each function call
39
- - gpus_per_core (int): number of GPUs per worker - defaults to 0
40
- - cwd (str/None): current working directory where the parallel python task is executed
41
- - num_nodes (int, optional): The number of compute nodes to use for executing the task.
42
- Defaults to None.
43
- - exclusive (bool): Whether to exclusively reserve the compute nodes, or allow sharing
44
- compute notes. Defaults to False.
45
- - error_log_file (str): Name of the error log file to use for storing exceptions raised
46
- by the Python functions submitted to the Executor.
47
- - restart_limit (int): The maximum number of restarting worker processes. Default: 0
42
+ * cores (int): number of MPI cores to be used for each function call
43
+ * threads_per_core (int): number of OpenMP threads to be used for each function call
44
+ * gpus_per_core (int): number of GPUs per worker - defaults to 0
45
+ * cwd (str): current working directory where the parallel python task is executed
46
+ * cache_key (str): Rather than using the internal hashing of executorlib the user can
47
+ provide an external cache_key to identify tasks on the file system.
48
+ * cache_directory (str): The directory to store cache files.
49
+ * num_nodes (int): number of compute nodes used for the evaluation of the Python function.
50
+ * exclusive (bool): boolean flag to reserve exclusive access to selected compute nodes -
51
+ do not allow other tasks to use the same compute node.
52
+ * error_log_file (str): path to the error log file, primarily used to merge the log of
53
+ multiple tasks in one file.
54
+ * run_time_limit (int): the maximum time the execution of the submitted Python function is
55
+ allowed to take in seconds.
56
+ * priority (int): the queuing system priority assigned to a given Python function to
57
+ influence the scheduling.
58
+ *`slurm_cmd_args (list): Additional command line arguments for the srun call (SLURM only)
48
59
  pmi_mode (str): PMI interface to use (OpenMPI v5 requires pmix) default is None
49
60
  flux_executor (flux.job.FluxExecutor): Flux Python interface to submit the workers to flux
50
61
  flux_executor_nesting (bool): Provide hierarchically nested Flux job scheduler inside the submitted function.
@@ -69,6 +80,8 @@ class FluxJobExecutor(BaseExecutor):
69
80
  export_workflow_filename (str): Name of the file to store the exported workflow graph in.
70
81
  log_obj_size (bool): Enable debug mode which reports the size of the communicated objects.
71
82
  wait (bool): Whether to wait for the completion of all tasks before shutting down the executor.
83
+ restart_limit (int): The maximum number of restarting worker processes.
84
+ openmpi_oversubscribe (bool): adds the `--oversubscribe` command flag (OpenMPI and SLURM) - default False
72
85
 
73
86
  Examples:
74
87
  ```
@@ -111,6 +124,8 @@ class FluxJobExecutor(BaseExecutor):
111
124
  export_workflow_filename: Optional[str] = None,
112
125
  log_obj_size: bool = False,
113
126
  wait: bool = True,
127
+ restart_limit: int = 0,
128
+ openmpi_oversubscribe: bool = False,
114
129
  ):
115
130
  """
116
131
  The executorlib.FluxJobExecutor leverages either the message passing interface (MPI), the SLURM workload manager
@@ -126,16 +141,24 @@ class FluxJobExecutor(BaseExecutor):
126
141
  cache_directory (str, optional): The directory to store cache files. Defaults to "executorlib_cache".
127
142
  max_cores (int): defines the number cores which can be used in parallel
128
143
  resource_dict (dict): A dictionary of resources required by the task. With the following keys:
129
- - cores (int): number of MPI cores to be used for each function call
130
- - threads_per_core (int): number of OpenMP threads to be used for each function call
131
- - gpus_per_core (int): number of GPUs per worker - defaults to 0
132
- - cwd (str/None): current working directory where the parallel python task is executed
133
- - num_nodes (int, optional): The number of compute nodes to use for executing the task.
134
- Defaults to None.
135
- - exclusive (bool): Whether to exclusively reserve the compute nodes, or allow sharing
136
- compute notes. Defaults to False.
137
- - error_log_file (str): Name of the error log file to use for storing exceptions
138
- raised by the Python functions submitted to the Executor.
144
+ * cores (int): number of MPI cores to be used for each function call
145
+ * threads_per_core (int): number of OpenMP threads to be used for each function call
146
+ * gpus_per_core (int): number of GPUs per worker - defaults to 0
147
+ * cwd (str): current working directory where the parallel python task is executed
148
+ * cache_key (str): Rather than using the internal hashing of executorlib the user can
149
+ provide an external cache_key to identify tasks on the file system.
150
+ * cache_directory (str): The directory to store cache files.
151
+ * num_nodes (int): number of compute nodes used for the evaluation of the Python
152
+ function.
153
+ * exclusive (bool): boolean flag to reserve exclusive access to selected compute nodes
154
+ - do not allow other tasks to use the same compute node.
155
+ * error_log_file (str): path to the error log file, primarily used to merge the log of
156
+ multiple tasks in one file.
157
+ * run_time_limit (int): the maximum time the execution of the submitted Python
158
+ function is allowed to take in seconds.
159
+ * priority (int): the queuing system priority assigned to a given Python function to
160
+ influence the scheduling.
161
+ * slurm_cmd_args (list): Additional command line arguments for the srun call.
139
162
  pmi_mode (str): PMI interface to use (OpenMPI v5 requires pmix) default is None
140
163
  flux_executor (flux.job.FluxExecutor): Flux Python interface to submit the workers to flux
141
164
  flux_executor_nesting (bool): Provide hierarchically nested Flux job scheduler inside the submitted function.
@@ -160,6 +183,9 @@ class FluxJobExecutor(BaseExecutor):
160
183
  export_workflow_filename (str): Name of the file to store the exported workflow graph in.
161
184
  log_obj_size (bool): Enable debug mode which reports the size of the communicated objects.
162
185
  wait (bool): Whether to wait for the completion of all tasks before shutting down the executor.
186
+ validator (callable): A function to validate the resource_dict.
187
+ restart_limit (int): The maximum number of restarting worker processes.
188
+ openmpi_oversubscribe (bool): adds the `--oversubscribe` command flag (OpenMPI and SLURM) - default False
163
189
 
164
190
  """
165
191
  default_resource_dict: dict = {
@@ -167,14 +193,18 @@ class FluxJobExecutor(BaseExecutor):
167
193
  "threads_per_core": 1,
168
194
  "gpus_per_core": 0,
169
195
  "cwd": None,
170
- "openmpi_oversubscribe": False,
196
+ "openmpi_oversubscribe": openmpi_oversubscribe,
171
197
  "slurm_cmd_args": [],
172
198
  }
173
199
  if resource_dict is None:
174
200
  resource_dict = {}
201
+ validate_resource_dict(resource_dict=resource_dict)
175
202
  resource_dict.update(
176
203
  {k: v for k, v in default_resource_dict.items() if k not in resource_dict}
177
204
  )
205
+ check_restart_limit(
206
+ restart_limit=restart_limit, block_allocation=block_allocation
207
+ )
178
208
  if not disable_dependencies:
179
209
  super().__init__(
180
210
  executor=DependencyTaskScheduler(
@@ -182,7 +212,7 @@ class FluxJobExecutor(BaseExecutor):
182
212
  max_workers=max_workers,
183
213
  cache_directory=cache_directory,
184
214
  max_cores=max_cores,
185
- resource_dict=resource_dict,
215
+ executor_kwargs=resource_dict,
186
216
  pmi_mode=pmi_mode,
187
217
  flux_executor=flux_executor,
188
218
  flux_executor_nesting=flux_executor_nesting,
@@ -192,12 +222,14 @@ class FluxJobExecutor(BaseExecutor):
192
222
  init_function=init_function,
193
223
  log_obj_size=log_obj_size,
194
224
  wait=wait,
225
+ restart_limit=restart_limit,
195
226
  ),
196
227
  max_cores=max_cores,
197
228
  refresh_rate=refresh_rate,
198
229
  plot_dependency_graph=plot_dependency_graph,
199
230
  plot_dependency_graph_filename=plot_dependency_graph_filename,
200
231
  export_workflow_filename=export_workflow_filename,
232
+ validator=validate_resource_dict,
201
233
  )
202
234
  )
203
235
  else:
@@ -208,7 +240,7 @@ class FluxJobExecutor(BaseExecutor):
208
240
  max_workers=max_workers,
209
241
  cache_directory=cache_directory,
210
242
  max_cores=max_cores,
211
- resource_dict=resource_dict,
243
+ executor_kwargs=resource_dict,
212
244
  pmi_mode=pmi_mode,
213
245
  flux_executor=flux_executor,
214
246
  flux_executor_nesting=flux_executor_nesting,
@@ -218,6 +250,8 @@ class FluxJobExecutor(BaseExecutor):
218
250
  init_function=init_function,
219
251
  log_obj_size=log_obj_size,
220
252
  wait=wait,
253
+ validator=validate_resource_dict,
254
+ restart_limit=restart_limit,
221
255
  )
222
256
  )
223
257
 
@@ -237,15 +271,23 @@ class FluxClusterExecutor(BaseExecutor):
237
271
  cache_directory (str, optional): The directory to store cache files. Defaults to "executorlib_cache".
238
272
  max_cores (int): defines the number cores which can be used in parallel
239
273
  resource_dict (dict): A dictionary of resources required by the task. With the following keys:
240
- - cores (int): number of MPI cores to be used for each function call
241
- - threads_per_core (int): number of OpenMP threads to be used for each function call
242
- - gpus_per_core (int): number of GPUs per worker - defaults to 0
243
- - cwd (str/None): current working directory where the parallel python task is executed
244
- - openmpi_oversubscribe (bool): adds the `--oversubscribe` command line flag (OpenMPI and
245
- SLURM only) - default False
246
- - slurm_cmd_args (list): Additional command line arguments for the srun call (SLURM only)
247
- - error_log_file (str): Name of the error log file to use for storing exceptions raised
248
- by the Python functions submitted to the Executor.
274
+ * cores (int): number of MPI cores to be used for each function call
275
+ * threads_per_core (int): number of OpenMP threads to be used for each function call
276
+ * gpus_per_core (int): number of GPUs per worker - defaults to 0
277
+ * cwd (str): current working directory where the parallel python task is executed
278
+ * cache_key (str): Rather than using the internal hashing of executorlib the user can
279
+ provide an external cache_key to identify tasks on the file system.
280
+ * cache_directory (str): The directory to store cache files.
281
+ * num_nodes (int): number of compute nodes used for the evaluation of the Python function.
282
+ * exclusive (bool): boolean flag to reserve exclusive access to selected compute nodes -
283
+ do not allow other tasks to use the same compute node.
284
+ * error_log_file (str): path to the error log file, primarily used to merge the log of
285
+ multiple tasks in one file.
286
+ * run_time_limit (int): the maximum time the execution of the submitted Python function is
287
+ allowed to take in seconds.
288
+ * priority (int): the queuing system priority assigned to a given Python function to
289
+ influence the scheduling.
290
+ *`slurm_cmd_args (list): Additional command line arguments for the srun call (SLURM only)
249
291
  pysqa_config_directory (str, optional): path to the pysqa config directory (only for pysqa based backend).
250
292
  pmi_mode (str): PMI interface to use (OpenMPI v5 requires pmix) default is None
251
293
  hostname_localhost (boolean): use localhost instead of the hostname to establish the zmq connection. In the
@@ -268,6 +310,7 @@ class FluxClusterExecutor(BaseExecutor):
268
310
  export_workflow_filename (str): Name of the file to store the exported workflow graph in.
269
311
  log_obj_size (bool): Enable debug mode which reports the size of the communicated objects.
270
312
  wait (bool): Whether to wait for the completion of all tasks before shutting down the executor.
313
+ openmpi_oversubscribe (bool): adds the `--oversubscribe` command flag (OpenMPI and SLURM) - default False
271
314
 
272
315
  Examples:
273
316
  ```
@@ -308,6 +351,7 @@ class FluxClusterExecutor(BaseExecutor):
308
351
  export_workflow_filename: Optional[str] = None,
309
352
  log_obj_size: bool = False,
310
353
  wait: bool = True,
354
+ openmpi_oversubscribe: bool = False,
311
355
  ):
312
356
  """
313
357
  The executorlib.FluxClusterExecutor leverages either the message passing interface (MPI), the SLURM workload
@@ -323,16 +367,24 @@ class FluxClusterExecutor(BaseExecutor):
323
367
  cache_directory (str, optional): The directory to store cache files. Defaults to "executorlib_cache".
324
368
  max_cores (int): defines the number cores which can be used in parallel
325
369
  resource_dict (dict): A dictionary of resources required by the task. With the following keys:
326
- - cores (int): number of MPI cores to be used for each function call
327
- - threads_per_core (int): number of OpenMP threads to be used for each function call
328
- - gpus_per_core (int): number of GPUs per worker - defaults to 0
329
- - cwd (str/None): current working directory where the parallel python task is executed
330
- - openmpi_oversubscribe (bool): adds the `--oversubscribe` command line flag (OpenMPI
331
- and SLURM only) - default False
332
- - slurm_cmd_args (list): Additional command line arguments for the srun call (SLURM
333
- only)
334
- - error_log_file (str): Name of the error log file to use for storing exceptions
335
- raised by the Python functions submitted to the Executor.
370
+ * cores (int): number of MPI cores to be used for each function call
371
+ * threads_per_core (int): number of OpenMP threads to be used for each function call
372
+ * gpus_per_core (int): number of GPUs per worker - defaults to 0
373
+ * cwd (str): current working directory where the parallel python task is executed
374
+ * cache_key (str): Rather than using the internal hashing of executorlib the user can
375
+ provide an external cache_key to identify tasks on the file system.
376
+ * cache_directory (str): The directory to store cache files.
377
+ * num_nodes (int): number of compute nodes used for the evaluation of the Python
378
+ function.
379
+ * exclusive (bool): boolean flag to reserve exclusive access to selected compute nodes
380
+ - do not allow other tasks to use the same compute node.
381
+ * error_log_file (str): path to the error log file, primarily used to merge the log of
382
+ multiple tasks in one file.
383
+ * run_time_limit (int): the maximum time the execution of the submitted Python
384
+ function is allowed to take in seconds.
385
+ * priority (int): the queuing system priority assigned to a given Python function to
386
+ influence the scheduling.
387
+ * slurm_cmd_args (list): Additional command line arguments for the srun call.
336
388
  pysqa_config_directory (str, optional): path to the pysqa config directory (only for pysqa based backend).
337
389
  pmi_mode (str): PMI interface to use (OpenMPI v5 requires pmix) default is None
338
390
  hostname_localhost (boolean): use localhost instead of the hostname to establish the zmq connection. In the
@@ -355,6 +407,7 @@ class FluxClusterExecutor(BaseExecutor):
355
407
  export_workflow_filename (str): Name of the file to store the exported workflow graph in.
356
408
  log_obj_size (bool): Enable debug mode which reports the size of the communicated objects.
357
409
  wait (bool): Whether to wait for the completion of all tasks before shutting down the executor.
410
+ openmpi_oversubscribe (bool): adds the `--oversubscribe` command flag (OpenMPI and SLURM) - default False
358
411
 
359
412
  """
360
413
  default_resource_dict: dict = {
@@ -362,11 +415,13 @@ class FluxClusterExecutor(BaseExecutor):
362
415
  "threads_per_core": 1,
363
416
  "gpus_per_core": 0,
364
417
  "cwd": None,
365
- "openmpi_oversubscribe": False,
418
+ "openmpi_oversubscribe": openmpi_oversubscribe,
366
419
  "slurm_cmd_args": [],
420
+ "run_time_limit": None,
367
421
  }
368
422
  if resource_dict is None:
369
423
  resource_dict = {}
424
+ validate_resource_dict_with_optional_keys(resource_dict=resource_dict)
370
425
  resource_dict.update(
371
426
  {k: v for k, v in default_resource_dict.items() if k not in resource_dict}
372
427
  )
@@ -388,9 +443,10 @@ class FluxClusterExecutor(BaseExecutor):
388
443
  pmi_mode=pmi_mode,
389
444
  init_function=init_function,
390
445
  max_workers=max_workers,
391
- resource_dict=resource_dict,
446
+ executor_kwargs=resource_dict,
392
447
  pysqa_config_directory=pysqa_config_directory,
393
448
  backend="flux",
449
+ validator=validate_resource_dict_with_optional_keys,
394
450
  )
395
451
  )
396
452
  else:
@@ -404,7 +460,7 @@ class FluxClusterExecutor(BaseExecutor):
404
460
  backend="flux",
405
461
  max_cores=max_cores,
406
462
  cache_directory=cache_directory,
407
- resource_dict=resource_dict,
463
+ executor_kwargs=resource_dict,
408
464
  flux_executor=None,
409
465
  pmi_mode=pmi_mode,
410
466
  flux_executor_nesting=False,
@@ -416,6 +472,7 @@ class FluxClusterExecutor(BaseExecutor):
416
472
  disable_dependencies=disable_dependencies,
417
473
  wait=wait,
418
474
  refresh_rate=refresh_rate,
475
+ validator=validate_resource_dict_with_optional_keys,
419
476
  )
420
477
  )
421
478
  else:
@@ -425,7 +482,7 @@ class FluxClusterExecutor(BaseExecutor):
425
482
  max_workers=max_workers,
426
483
  cache_directory=cache_directory,
427
484
  max_cores=max_cores,
428
- resource_dict=resource_dict,
485
+ executor_kwargs=resource_dict,
429
486
  pmi_mode=None,
430
487
  flux_executor=None,
431
488
  flux_executor_nesting=False,
@@ -439,6 +496,7 @@ class FluxClusterExecutor(BaseExecutor):
439
496
  plot_dependency_graph=plot_dependency_graph,
440
497
  plot_dependency_graph_filename=plot_dependency_graph_filename,
441
498
  export_workflow_filename=export_workflow_filename,
499
+ validator=validate_resource_dict,
442
500
  )
443
501
  )
444
502
 
@@ -447,7 +505,7 @@ def create_flux_executor(
447
505
  max_workers: Optional[int] = None,
448
506
  max_cores: Optional[int] = None,
449
507
  cache_directory: Optional[str] = None,
450
- resource_dict: Optional[dict] = None,
508
+ executor_kwargs: Optional[dict] = None,
451
509
  pmi_mode: Optional[str] = None,
452
510
  flux_executor=None,
453
511
  flux_executor_nesting: bool = False,
@@ -457,6 +515,8 @@ def create_flux_executor(
457
515
  init_function: Optional[Callable] = None,
458
516
  log_obj_size: bool = False,
459
517
  wait: bool = True,
518
+ validator: Callable = validate_resource_dict,
519
+ restart_limit: int = 0,
460
520
  ) -> Union[OneProcessTaskScheduler, BlockAllocationTaskScheduler]:
461
521
  """
462
522
  Create a flux executor
@@ -467,17 +527,24 @@ def create_flux_executor(
467
527
  max_cores is recommended, as computers have a limited number of compute cores.
468
528
  max_cores (int): defines the number cores which can be used in parallel
469
529
  cache_directory (str, optional): The directory to store cache files. Defaults to "executorlib_cache".
470
- resource_dict (dict): A dictionary of resources required by the task. With the following keys:
471
- - cores (int): number of MPI cores to be used for each function call
472
- - threads_per_core (int): number of OpenMP threads to be used for each function call
473
- - gpus_per_core (int): number of GPUs per worker - defaults to 0
474
- - cwd (str/None): current working directory where the parallel python task is executed
475
- - num_nodes (int, optional): The number of compute nodes to use for executing the task.
476
- Defaults to None.
477
- - exclusive (bool): Whether to exclusively reserve the compute nodes, or allow sharing
478
- compute notes. Defaults to False.
479
- - error_log_file (str): Name of the error log file to use for storing exceptions raised
480
- by the Python functions submitted to the Executor.
530
+ executor_kwargs (dict): A dictionary of arguments required by the executor. With the following keys:
531
+ * cores (int): number of MPI cores to be used for each function call
532
+ * threads_per_core (int): number of OpenMP threads to be used for each function call
533
+ * gpus_per_core (int): number of GPUs per worker - defaults to 0
534
+ * cwd (str): current working directory where the parallel python task is executed
535
+ * cache_key (str): Rather than using the internal hashing of executorlib the user can
536
+ provide an external cache_key to identify tasks on the file system.
537
+ * cache_directory (str): The directory to store cache files.
538
+ * num_nodes (int): number of compute nodes used for the evaluation of the Python function.
539
+ * exclusive (bool): boolean flag to reserve exclusive access to selected compute nodes -
540
+ do not allow other tasks to use the same compute node.
541
+ * error_log_file (str): path to the error log file, primarily used to merge the log of
542
+ multiple tasks in one file.
543
+ * run_time_limit (int): the maximum time the execution of the submitted Python function is
544
+ allowed to take in seconds.
545
+ * priority (int): the queuing system priority assigned to a given Python function to
546
+ influence the scheduling.
547
+ *`slurm_cmd_args (list): Additional command line arguments for the srun call (SLURM only)
481
548
  pmi_mode (str): PMI interface to use (OpenMPI v5 requires pmix) default is None
482
549
  flux_executor (flux.job.FluxExecutor): Flux Python interface to submit the workers to flux
483
550
  flux_executor_nesting (bool): Provide hierarchically nested Flux job scheduler inside the submitted function.
@@ -496,6 +563,7 @@ def create_flux_executor(
496
563
  init_function (None): optional function to preset arguments for functions which are submitted later
497
564
  log_obj_size (bool): Enable debug mode which reports the size of the communicated objects.
498
565
  wait (bool): Whether to wait for the completion of all tasks before shutting down the executor.
566
+ restart_limit (int): The maximum number of restarting worker processes.
499
567
 
500
568
  Returns:
501
569
  InteractiveStepExecutor/ InteractiveExecutor
@@ -505,29 +573,31 @@ def create_flux_executor(
505
573
  validate_max_workers,
506
574
  )
507
575
 
508
- if resource_dict is None:
509
- resource_dict = {}
510
- cores_per_worker = resource_dict.get("cores", 1)
511
- resource_dict["cache_directory"] = cache_directory
512
- resource_dict["hostname_localhost"] = hostname_localhost
513
- resource_dict["log_obj_size"] = log_obj_size
576
+ if executor_kwargs is None:
577
+ executor_kwargs = {}
578
+ cores_per_worker = executor_kwargs.get("cores", 1)
579
+ executor_kwargs["cache_directory"] = cache_directory
580
+ executor_kwargs["hostname_localhost"] = hostname_localhost
581
+ executor_kwargs["log_obj_size"] = log_obj_size
514
582
  check_init_function(block_allocation=block_allocation, init_function=init_function)
515
583
  check_pmi(backend="flux_allocation", pmi=pmi_mode)
516
- check_oversubscribe(oversubscribe=resource_dict.get("openmpi_oversubscribe", False))
584
+ check_oversubscribe(
585
+ oversubscribe=executor_kwargs.get("openmpi_oversubscribe", False)
586
+ )
517
587
  check_command_line_argument_lst(
518
- command_line_argument_lst=resource_dict.get("slurm_cmd_args", [])
588
+ command_line_argument_lst=executor_kwargs.get("slurm_cmd_args", [])
519
589
  )
520
590
  check_wait_on_shutdown(wait_on_shutdown=wait)
521
- if "openmpi_oversubscribe" in resource_dict:
522
- del resource_dict["openmpi_oversubscribe"]
523
- if "slurm_cmd_args" in resource_dict:
524
- del resource_dict["slurm_cmd_args"]
525
- resource_dict["pmi_mode"] = pmi_mode
526
- resource_dict["flux_executor"] = flux_executor
527
- resource_dict["flux_executor_nesting"] = flux_executor_nesting
528
- resource_dict["flux_log_files"] = flux_log_files
591
+ if "openmpi_oversubscribe" in executor_kwargs:
592
+ del executor_kwargs["openmpi_oversubscribe"]
593
+ if "slurm_cmd_args" in executor_kwargs:
594
+ del executor_kwargs["slurm_cmd_args"]
595
+ executor_kwargs["pmi_mode"] = pmi_mode
596
+ executor_kwargs["flux_executor"] = flux_executor
597
+ executor_kwargs["flux_executor_nesting"] = flux_executor_nesting
598
+ executor_kwargs["flux_log_files"] = flux_log_files
529
599
  if block_allocation:
530
- resource_dict["init_function"] = init_function
600
+ executor_kwargs["init_function"] = init_function
531
601
  max_workers = validate_number_of_cores(
532
602
  max_cores=max_cores,
533
603
  max_workers=max_workers,
@@ -537,17 +607,20 @@ def create_flux_executor(
537
607
  validate_max_workers(
538
608
  max_workers=max_workers,
539
609
  cores=cores_per_worker,
540
- threads_per_core=resource_dict.get("threads_per_core", 1),
610
+ threads_per_core=executor_kwargs.get("threads_per_core", 1),
541
611
  )
542
612
  return BlockAllocationTaskScheduler(
543
613
  max_workers=max_workers,
544
- executor_kwargs=resource_dict,
614
+ executor_kwargs=executor_kwargs,
545
615
  spawner=FluxPythonSpawner,
616
+ validator=validator,
617
+ restart_limit=restart_limit,
546
618
  )
547
619
  else:
548
620
  return OneProcessTaskScheduler(
549
621
  max_cores=max_cores,
550
622
  max_workers=max_workers,
551
- executor_kwargs=resource_dict,
623
+ executor_kwargs=executor_kwargs,
552
624
  spawner=FluxPythonSpawner,
625
+ validator=validator,
553
626
  )