@@ -194,7 +194,7 @@ def __init__(
194194 max_workers = max_workers ,
195195 cache_directory = cache_directory ,
196196 max_cores = max_cores ,
197- resource_dict = resource_dict ,
197+ executor_kwargs = resource_dict ,
198198 pmi_mode = pmi_mode ,
199199 flux_executor = flux_executor ,
200200 flux_executor_nesting = flux_executor_nesting ,
@@ -221,7 +221,7 @@ def __init__(
221221 max_workers = max_workers ,
222222 cache_directory = cache_directory ,
223223 max_cores = max_cores ,
224- resource_dict = resource_dict ,
224+ executor_kwargs = resource_dict ,
225225 pmi_mode = pmi_mode ,
226226 flux_executor = flux_executor ,
227227 flux_executor_nesting = flux_executor_nesting ,
@@ -404,7 +404,7 @@ def __init__(
404404 pmi_mode = pmi_mode ,
405405 init_function = init_function ,
406406 max_workers = max_workers ,
407- resource_dict = resource_dict ,
407+ executor_kwargs = resource_dict ,
408408 pysqa_config_directory = pysqa_config_directory ,
409409 backend = "flux" ,
410410 )
@@ -420,7 +420,7 @@ def __init__(
420420 backend = "flux" ,
421421 max_cores = max_cores ,
422422 cache_directory = cache_directory ,
423- resource_dict = resource_dict ,
423+ executor_kwargs = resource_dict ,
424424 flux_executor = None ,
425425 pmi_mode = pmi_mode ,
426426 flux_executor_nesting = False ,
@@ -441,7 +441,7 @@ def __init__(
441441 max_workers = max_workers ,
442442 cache_directory = cache_directory ,
443443 max_cores = max_cores ,
444- resource_dict = resource_dict ,
444+ executor_kwargs = resource_dict ,
445445 pmi_mode = None ,
446446 flux_executor = None ,
447447 flux_executor_nesting = False ,
@@ -463,7 +463,7 @@ def create_flux_executor(
463463 max_workers : Optional [int ] = None ,
464464 max_cores : Optional [int ] = None ,
465465 cache_directory : Optional [str ] = None ,
466- resource_dict : Optional [dict ] = None ,
466+ executor_kwargs : Optional [dict ] = None ,
467467 pmi_mode : Optional [str ] = None ,
468468 flux_executor = None ,
469469 flux_executor_nesting : bool = False ,
@@ -484,7 +484,7 @@ def create_flux_executor(
484484 max_cores is recommended, as computers have a limited number of compute cores.
485485 max_cores (int): defines the number cores which can be used in parallel
486486 cache_directory (str, optional): The directory to store cache files. Defaults to "executorlib_cache".
487- resource_dict (dict): A dictionary of resources required by the task . With the following keys:
487+ executor_kwargs (dict): A dictionary of arguments required by the executor . With the following keys:
488488 - cores (int): number of MPI cores to be used for each function call
489489 - threads_per_core (int): number of OpenMP threads to be used for each function call
490490 - gpus_per_core (int): number of GPUs per worker - defaults to 0
@@ -524,29 +524,31 @@ def create_flux_executor(
524524 validate_max_workers ,
525525 )
526526
527- if resource_dict is None :
528- resource_dict = {}
529- cores_per_worker = resource_dict .get ("cores" , 1 )
530- resource_dict ["cache_directory" ] = cache_directory
531- resource_dict ["hostname_localhost" ] = hostname_localhost
532- resource_dict ["log_obj_size" ] = log_obj_size
527+ if executor_kwargs is None :
528+ executor_kwargs = {}
529+ cores_per_worker = executor_kwargs .get ("cores" , 1 )
530+ executor_kwargs ["cache_directory" ] = cache_directory
531+ executor_kwargs ["hostname_localhost" ] = hostname_localhost
532+ executor_kwargs ["log_obj_size" ] = log_obj_size
533533 check_init_function (block_allocation = block_allocation , init_function = init_function )
534534 check_pmi (backend = "flux_allocation" , pmi = pmi_mode )
535- check_oversubscribe (oversubscribe = resource_dict .get ("openmpi_oversubscribe" , False ))
535+ check_oversubscribe (
536+ oversubscribe = executor_kwargs .get ("openmpi_oversubscribe" , False )
537+ )
536538 check_command_line_argument_lst (
537- command_line_argument_lst = resource_dict .get ("slurm_cmd_args" , [])
539+ command_line_argument_lst = executor_kwargs .get ("slurm_cmd_args" , [])
538540 )
539541 check_wait_on_shutdown (wait_on_shutdown = wait )
540- if "openmpi_oversubscribe" in resource_dict :
541- del resource_dict ["openmpi_oversubscribe" ]
542- if "slurm_cmd_args" in resource_dict :
543- del resource_dict ["slurm_cmd_args" ]
544- resource_dict ["pmi_mode" ] = pmi_mode
545- resource_dict ["flux_executor" ] = flux_executor
546- resource_dict ["flux_executor_nesting" ] = flux_executor_nesting
547- resource_dict ["flux_log_files" ] = flux_log_files
542+ if "openmpi_oversubscribe" in executor_kwargs :
543+ del executor_kwargs ["openmpi_oversubscribe" ]
544+ if "slurm_cmd_args" in executor_kwargs :
545+ del executor_kwargs ["slurm_cmd_args" ]
546+ executor_kwargs ["pmi_mode" ] = pmi_mode
547+ executor_kwargs ["flux_executor" ] = flux_executor
548+ executor_kwargs ["flux_executor_nesting" ] = flux_executor_nesting
549+ executor_kwargs ["flux_log_files" ] = flux_log_files
548550 if block_allocation :
549- resource_dict ["init_function" ] = init_function
551+ executor_kwargs ["init_function" ] = init_function
550552 max_workers = validate_number_of_cores (
551553 max_cores = max_cores ,
552554 max_workers = max_workers ,
@@ -556,18 +558,18 @@ def create_flux_executor(
556558 validate_max_workers (
557559 max_workers = max_workers ,
558560 cores = cores_per_worker ,
559- threads_per_core = resource_dict .get ("threads_per_core" , 1 ),
561+ threads_per_core = executor_kwargs .get ("threads_per_core" , 1 ),
560562 )
561563 return BlockAllocationTaskScheduler (
562564 max_workers = max_workers ,
563- executor_kwargs = resource_dict ,
565+ executor_kwargs = executor_kwargs ,
564566 spawner = FluxPythonSpawner ,
565567 restart_limit = restart_limit ,
566568 )
567569 else :
568570 return OneProcessTaskScheduler (
569571 max_cores = max_cores ,
570572 max_workers = max_workers ,
571- executor_kwargs = resource_dict ,
573+ executor_kwargs = executor_kwargs ,
572574 spawner = FluxPythonSpawner ,
573575 )
0 commit comments