Skip to content

Commit 8d59ea7

Browse files
authored
Fix mlc_run_cmd (#194)
1 parent a74ccf9 commit 8d59ea7

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

mlc/main.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,11 @@ def search(self, i):
7474
return {'return': 0, 'list': result}
7575
#indices
7676

77+
mlc_run_cmd = None
7778

7879
def mlc_expand_short(action, target = "script"):
79-
80+
global mlc_run_cmd
81+
mlc_run_cmd = shlex.join(sys.argv)
8082
# Insert the positional argument into sys.argv for the main function
8183
sys.argv.insert(1, action)
8284
sys.argv.insert(2, target)
@@ -166,18 +168,21 @@ def configure_logging(args):
166168

167169

168170
def build_run_args(args):
171+
global mlc_run_cmd
169172
res = utils.convert_args_to_dictionary(getattr(args, 'extra', []))
170173
if res['return'] > 0:
171174
return res
172175

173176
run_args = res['args_dict']
174-
run_args['mlc_run_cmd'] = shlex.join(sys.argv)
177+
if not mlc_run_cmd:
178+
mlc_run_cmd = shlex.join(sys.argv)
179+
run_args['mlc_run_cmd'] = mlc_run_cmd
175180

176181
if args.command in ['pull', 'rm', 'add', 'find'] and args.target == "repo":
177182
run_args['repo'] = args.details
178183

179184
if args.command in ['docker', 'docker-run', 'experiment', 'remote-run', 'doc', 'lint'] and args.target == "run":
180-
run_args['target'] = 'script'
185+
#run_args['target'] = 'script' #dont modify this as script might have target as in input
181186
args.target = "script"
182187

183188
if args.details and not utils.is_uid(args.details) and not run_args.get("tags") and args.target in ["script", "cache"]:

0 commit comments

Comments
 (0)