Skip to content

Commit ad5d667

Browse files
authored
feat: remove args from run_command_with_full_controls (#661)
1 parent f0b70a6 commit ad5d667

File tree

3 files changed

+4
-13
lines changed

3 files changed

+4
-13
lines changed

src/xpk/commands/run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def submit_job(args: Namespace) -> None:
126126
if args.time is not None:
127127
cmd += f' --time {args.time}'
128128

129-
return_code = run_command_with_full_controls(cmd, 'run task', args)
129+
return_code = run_command_with_full_controls(cmd, 'run task')
130130

131131
if return_code != 0:
132132
xpk_print(f'Running task returned ERROR {return_code}')

src/xpk/commands/shell.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ def shell(args: Namespace):
3838
if exisitng_shell_pod_name is None:
3939
return_code = connect_to_new_interactive_shell(args)
4040
else:
41-
return_code = connect_to_existing_interactive_shell(
42-
exisitng_shell_pod_name, args
43-
)
41+
return_code = connect_to_existing_interactive_shell(exisitng_shell_pod_name)
4442

4543
if return_code != 0:
4644
xpk_print(f'The command failed with code {return_code}.')
@@ -94,21 +92,17 @@ def connect_to_new_interactive_shell(args: Namespace) -> int:
9492
return run_command_with_full_controls(
9593
command=cmd,
9694
task='Creating new interactive shell and entering it',
97-
global_args=args,
9895
instructions=exit_instructions,
9996
)
10097

10198

102-
def connect_to_existing_interactive_shell(
103-
pod_name: str, args: Namespace
104-
) -> int:
99+
def connect_to_existing_interactive_shell(pod_name: str) -> int:
105100
return run_command_with_full_controls(
106101
command=(
107102
f'kubectl exec --stdin --tty {pod_name} --'
108103
f' {get_pod_template_interactive_command()}'
109104
),
110105
task='Entering existing interactive shell',
111-
global_args=args,
112106
instructions=exit_instructions,
113107
)
114108

src/xpk/core/commands.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import subprocess
1919
import sys
2020
import time
21-
from argparse import Namespace
2221

2322
from ..utils.objects import chunks
2423
from ..utils.file import make_tmp_files, write_tmp_file
@@ -301,7 +300,6 @@ def run_command_for_value(
301300
def run_command_with_full_controls(
302301
command: str,
303302
task: str,
304-
global_args: Namespace,
305303
instructions: str | None = None,
306304
) -> int:
307305
"""Run command in current shell with system out, in and error handles. Wait
@@ -310,13 +308,12 @@ def run_command_with_full_controls(
310308
Args:
311309
command: command to execute
312310
task: user-facing name of the task
313-
global_args: user provided arguments for running the command.
314311
verbose: shows stdout and stderr if set to true. Set to True by default.
315312
316313
Returns:
317314
0 if successful and 1 otherwise.
318315
"""
319-
if global_args.dry_run:
316+
if is_dry_run():
320317
xpk_print(
321318
f'Task: `{task}` is implemented by the following command'
322319
' not running since it is a dry run.'

0 commit comments

Comments
 (0)