77 check_init_function ,
88 check_plot_dependency_graph ,
99 check_refresh_rate ,
10+ check_wait_on_shutdown ,
1011 validate_number_of_cores ,
1112)
1213from executorlib .standalone .interactive .spawner import MpiExecSpawner
@@ -60,6 +61,7 @@ class SingleNodeExecutor(BaseExecutor):
6061 plot_dependency_graph_filename (str): Name of the file to store the plotted graph in.
6162 export_workflow_filename (str): Name of the file to store the exported workflow graph in.
6263 log_obj_size (bool): Enable debug mode which reports the size of the communicated objects.
64+ wait (bool): Whether to wait for the completion of all tasks before shutting down the executor.
6365
6466 Examples:
6567 ```
@@ -97,6 +99,7 @@ def __init__(
9799 plot_dependency_graph_filename : Optional [str ] = None ,
98100 export_workflow_filename : Optional [str ] = None ,
99101 log_obj_size : bool = False ,
102+ wait : bool = True ,
100103 ):
101104 """
102105 The executorlib.SingleNodeExecutor leverages either the message passing interface (MPI), the SLURM workload
@@ -142,6 +145,7 @@ def __init__(
142145 plot_dependency_graph_filename (str): Name of the file to store the plotted graph in.
143146 export_workflow_filename (str): Name of the file to store the exported workflow graph in.
144147 log_obj_size (bool): Enable debug mode which reports the size of the communicated objects.
148+ wait (bool): Whether to wait for the completion of all tasks before shutting down the executor.
145149
146150 """
147151 default_resource_dict : dict = {
@@ -169,6 +173,7 @@ def __init__(
169173 block_allocation = block_allocation ,
170174 init_function = init_function ,
171175 log_obj_size = log_obj_size ,
176+ wait = wait ,
172177 ),
173178 max_cores = max_cores ,
174179 refresh_rate = refresh_rate ,
@@ -190,6 +195,7 @@ def __init__(
190195 block_allocation = block_allocation ,
191196 init_function = init_function ,
192197 log_obj_size = log_obj_size ,
198+ wait = wait ,
193199 )
194200 )
195201
@@ -232,6 +238,7 @@ class TestClusterExecutor(BaseExecutor):
232238 plot_dependency_graph_filename (str): Name of the file to store the plotted graph in.
233239 export_workflow_filename (str): Name of the file to store the exported workflow graph in.
234240 log_obj_size (bool): Enable debug mode which reports the size of the communicated objects.
241+ wait (bool): Whether to wait for the completion of all tasks before shutting down the executor.
235242
236243 Examples:
237244 ```
@@ -269,6 +276,7 @@ def __init__(
269276 plot_dependency_graph_filename : Optional [str ] = None ,
270277 export_workflow_filename : Optional [str ] = None ,
271278 log_obj_size : bool = False ,
279+ wait : bool = True ,
272280 ):
273281 """
274282 The executorlib.api.TestClusterExecutor is designed to test the file based communication used in the
@@ -307,6 +315,7 @@ def __init__(
307315 plot_dependency_graph_filename (str): Name of the file to store the plotted graph in.
308316 export_workflow_filename (str): Name of the file to store the exported workflow graph in.
309317 log_obj_size (bool): Enable debug mode which reports the size of the communicated objects.
318+ wait (bool): Whether to wait for the completion of all tasks before shutting down the executor.
310319
311320 """
312321 default_resource_dict : dict = {
@@ -346,6 +355,7 @@ def __init__(
346355 init_function = init_function ,
347356 disable_dependencies = disable_dependencies ,
348357 execute_function = execute_in_subprocess ,
358+ wait = wait ,
349359 )
350360 )
351361 else :
@@ -379,6 +389,7 @@ def create_single_node_executor(
379389 block_allocation : bool = False ,
380390 init_function : Optional [Callable ] = None ,
381391 log_obj_size : bool = False ,
392+ wait : bool = True ,
382393) -> Union [OneProcessTaskScheduler , BlockAllocationTaskScheduler ]:
383394 """
384395 Create a single node executor
@@ -413,6 +424,7 @@ def create_single_node_executor(
413424 of the individual function.
414425 init_function (None): optional function to preset arguments for functions which are submitted later
415426 log_obj_size (bool): Enable debug mode which reports the size of the communicated objects.
427+ wait (bool): Whether to wait for the completion of all tasks before shutting down the executor.
416428
417429 Returns:
418430 InteractiveStepExecutor/ InteractiveExecutor
@@ -429,6 +441,7 @@ def create_single_node_executor(
429441 check_command_line_argument_lst (
430442 command_line_argument_lst = resource_dict .get ("slurm_cmd_args" , [])
431443 )
444+ check_wait_on_shutdown (wait_on_shutdown = wait )
432445 if "threads_per_core" in resource_dict :
433446 del resource_dict ["threads_per_core" ]
434447 if "gpus_per_core" in resource_dict :
0 commit comments