Skip to content

Commit 0dc2045

Browse files
authored
Fix cmdline parsing error on Windows system (#4422)
1 parent e0d3439 commit 0dc2045

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

swift/ui/llm_train/runtime.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ def close_tb(logging_dir):
429429
def refresh_tasks(running_task=None):
430430
output_dir = running_task if not running_task or 'pid:' not in running_task else None
431431
process_name = 'swift'
432-
negative_name = 'swift.exe'
432+
negative_names = ['swift.exe', 'swift-script.py']
433433
cmd_name = ['pt', 'sft', 'rlhf']
434434
process = []
435435
selected = None
@@ -438,10 +438,12 @@ def refresh_tasks(running_task=None):
438438
cmdlines = proc.cmdline()
439439
except (psutil.ZombieProcess, psutil.AccessDenied, psutil.NoSuchProcess):
440440
cmdlines = []
441-
if any([process_name in cmdline
442-
for cmdline in cmdlines]) and not any([negative_name in cmdline
443-
for cmdline in cmdlines]) and any( # noqa
444-
[cmdline in cmd_name for cmdline in cmdlines]): # noqa
441+
if any([
442+
process_name in cmdline for cmdline in cmdlines # noqa
443+
]) and not any([ # noqa
444+
negative_name in cmdline for negative_name in negative_names # noqa
445+
for cmdline in cmdlines # noqa
446+
]) and any([cmdline in cmd_name for cmdline in cmdlines]): # noqa
445447
process.append(Runtime.construct_running_task(proc))
446448
if output_dir is not None and any( # noqa
447449
[output_dir == cmdline for cmdline in cmdlines]): # noqa

0 commit comments

Comments
 (0)