Skip to content

Commit e8ecce8

Browse files
author
Tian-hao Zhang
committed
fixed isue with incorrect arguments for triaingin
1 parent 9cf43fc commit e8ecce8

3 files changed

Lines changed: 1004 additions & 432 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ sql_app.db
1414
uploads
1515
pytorch_connectomics
1616
server_api/chatbot/faiss_index/
17+
.logs/

server_pytc/services/model.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,18 +120,30 @@ def _get_runtime_snapshot(kind: str) -> dict[str, Any]:
120120
is_running = bool(process and process.poll() is None)
121121
with _runtime_lock:
122122
state = _runtime_state[kind]
123+
phase = state["phase"]
124+
exit_code = state["exitCode"]
125+
ended_at = state["endedAt"]
126+
127+
# Reconcile: if the process has exited but the log-reader thread
128+
# hasn't updated the state yet, derive phase from the process itself.
129+
if not is_running and phase == "running" and process is not None:
130+
rc = process.returncode
131+
phase = "finished" if rc == 0 else "failed"
132+
exit_code = rc
133+
ended_at = state["endedAt"] or _utc_now()
134+
123135
lines = list(state["lines"])
124136
snapshot = {
125137
"isRunning": is_running,
126-
"phase": state["phase"],
138+
"phase": phase,
127139
"pid": process.pid if is_running else state["pid"],
128-
"exitCode": state["exitCode"],
140+
"exitCode": exit_code,
129141
"command": state["command"],
130142
"cwd": state["cwd"],
131143
"configPath": state["configPath"],
132144
"configOriginPath": state["configOriginPath"],
133145
"startedAt": state["startedAt"],
134-
"endedAt": state["endedAt"],
146+
"endedAt": ended_at,
135147
"lastUpdatedAt": state["lastUpdatedAt"],
136148
"lineCount": state["lineCount"],
137149
"lastError": state["lastError"],
@@ -367,10 +379,8 @@ def start_training(payload: dict):
367379
command = [
368380
sys.executable,
369381
str(script_path),
370-
"--config",
382+
"--config-file",
371383
temp_filepath,
372-
"--mode",
373-
"train",
374384
]
375385
command.extend(
376386
_build_cli_arguments(
@@ -573,10 +583,9 @@ def start_inference(payload: dict):
573583
command = [
574584
sys.executable,
575585
str(script_path),
576-
"--config",
586+
"--config-file",
577587
temp_filepath,
578-
"--mode",
579-
"test",
588+
"--inference",
580589
]
581590
command.extend(
582591
_build_cli_arguments(

0 commit comments

Comments
 (0)