Skip to content

Commit 96f54b7

Browse files
committed
Fixes for --remote_shell
1 parent 9a1453a commit 96f54b7

4 files changed

Lines changed: 10 additions & 9 deletions

File tree

automation/script/remote_run.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,14 +192,9 @@ def remote_run(self_module, i):
192192
if skip_ssh_key_file:
193193
remote_inputs['skip_ssh_key_file'] = skip_ssh_key_file
194194

195-
# If a remote shell is specified, wrap all commands to execute inside it
195+
# If a remote shell is specified, pass it to the remote-run-commands script
196196
if remote_shell:
197-
all_cmds = remote_pre_run_cmds + run_cmds + remote_post_run_cmds
198-
combined = " ; ".join(all_cmds)
199-
escaped = combined.replace('\\', '\\\\').replace('"', '\\"')
200-
run_cmds = [f'{remote_shell} -c "{escaped}"']
201-
remote_pre_run_cmds = []
202-
remote_post_run_cmds = []
197+
remote_inputs["shell"] = remote_shell
203198

204199
# Execute the remote command
205200
mlc_remote_input = {

script/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MLCommons Automation Scripts
22

3-
*Last updated: 2026-06-21 19:18:29*
3+
*Last updated: 2026-06-22 04:52:55*
44

55
This directory contains automation scripts for MLPerf benchmarks, AI/ML workflows, and development operations.
66

script/remote-run-commands/customize.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,12 @@ def preprocess(i):
127127
else:
128128
safe_cmd_string = shlex.quote(cmd_string)
129129

130-
ssh_run_command = f"{ssh_cmd_str} {user}@{host} {password_string} {safe_cmd_string}"
130+
remote_shell = env.get('MLC_SSH_REMOTE_SHELL', '')
131+
if remote_shell:
132+
# Pipe commands to the specified shell on the remote to avoid nested quoting issues
133+
ssh_run_command = f"printf '%s\\n' {safe_cmd_string} | {ssh_cmd_str} {user}@{host} {password_string} {remote_shell}"
134+
else:
135+
ssh_run_command = f"{ssh_cmd_str} {user}@{host} {password_string} {safe_cmd_string}"
131136

132137
env['MLC_SSH_CMD'] = ssh_run_command
133138

script/remote-run-commands/meta.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,4 @@ input_mapping:
4949
skip_ssh_key_file: MLC_SKIP_SSH_KEY_FILE
5050
ssh_key_file: MLC_SSH_KEY_FILE
5151
user: MLC_SSH_USER
52+
shell: MLC_SSH_REMOTE_SHELL

0 commit comments

Comments
 (0)