1818import subprocess
1919import sys
2020import time
21- from argparse import Namespace
2221
2322from ..utils .objects import chunks
2423from ..utils .file import make_tmp_files , write_tmp_file
2524from ..utils .console import xpk_print
2625from ..utils .execution_context import is_dry_run
2726
2827
29- def run_commands (commands , jobname , per_command_name , batch = 10 , dry_run = False ):
28+ def run_commands (commands , jobname , per_command_name , batch = 10 ):
3029 """Run commands in groups of `batch`.
3130
3231 Args:
3332 commands: list of command.
3433 jobname: the name of the job.
3534 per_command_name: list of command names.
3635 batch: number of commands to run in parallel.
37- dry_run: enables dry_run if set to true.
3836
3937 Returns:
4038 0 if successful and 1 otherwise.
@@ -47,7 +45,7 @@ def run_commands(commands, jobname, per_command_name, batch=10, dry_run=False):
4745 f'Breaking up a total of { len (commands )} commands into'
4846 f' { len (commands_batched )} batches'
4947 )
50- if dry_run :
48+ if is_dry_run () :
5149 xpk_print ('Pretending all the jobs succeeded' )
5250 return 0
5351
@@ -302,7 +300,6 @@ def run_command_for_value(
302300def run_command_with_full_controls (
303301 command : str ,
304302 task : str ,
305- global_args : Namespace ,
306303 instructions : str | None = None ,
307304) -> int :
308305 """Run command in current shell with system out, in and error handles. Wait
@@ -311,13 +308,12 @@ def run_command_with_full_controls(
311308 Args:
312309 command: command to execute
313310 task: user-facing name of the task
314- global_args: user provided arguments for running the command.
315311 verbose: shows stdout and stderr if set to true. Set to True by default.
316312
317313 Returns:
318314 0 if successful and 1 otherwise.
319315 """
320- if global_args . dry_run :
316+ if is_dry_run () :
321317 xpk_print (
322318 f'Task: `{ task } ` is implemented by the following command'
323319 ' not running since it is a dry run.'
0 commit comments