Skip to content

Commit 0ef0fd5

Browse files
jdbloomclaude
andcommitted
fix(runner): only report ARGoS crash on non-zero exit code
ARGoS exits with rc=0 on normal completion. The watchdog was treating any ARGoS exit before Python as a crash, skipping remaining tests. Now only kills Python and reports crash when rc != 0. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6aed339 commit 0ef0fd5

1 file changed

Lines changed: 23 additions & 20 deletions

File tree

run_baseline_experiments.py

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -296,26 +296,29 @@ def run_experiment(exp_name, config, test_mode=False, model_path=None):
296296
while main_proc.poll() is None:
297297
if argos_proc.poll() is not None:
298298
argos_rc = argos_proc.returncode
299-
argos_log_file.flush()
300-
argos_stderr = ""
301-
try:
302-
argos_stderr = open(argos_log_path).read()[-2000:]
303-
except FileNotFoundError:
304-
argos_stderr = "(argos.log was cleaned up by diagnostics)"
305-
306-
print(f" [ERROR] {exp_name}: ARGoS died (rc={argos_rc}) — killing Python", flush=True)
307-
print(f" [ERROR] ARGoS stderr: {argos_stderr[-500:]}", flush=True)
308-
# Log to diagnostics file
309-
diag_path = os.path.join(data_root, "argos_crash.log")
310-
with open(diag_path, "w") as f:
311-
f.write(f"ARGoS exit code: {argos_rc}\n")
312-
f.write(f"Time: {time.strftime('%Y-%m-%d %H:%M:%S')}\n")
313-
f.write(f"Episodes completed: {count_episodes(exp_name)}\n")
314-
f.write(f"Elapsed: {time.time() - start:.0f}s\n")
315-
f.write(f"Stderr:\n{argos_stderr}\n")
316-
main_proc.kill()
317-
main_proc.wait(timeout=10)
318-
raise RuntimeError(f"ARGoS crashed (rc={argos_rc}): {argos_stderr[-200:]}")
299+
if argos_rc != 0:
300+
# Actual crash — non-zero exit code
301+
argos_log_file.flush()
302+
argos_stderr = ""
303+
try:
304+
argos_stderr = open(argos_log_path).read()[-2000:]
305+
except FileNotFoundError:
306+
argos_stderr = "(argos.log was cleaned up by diagnostics)"
307+
308+
print(f" [ERROR] {exp_name}: ARGoS crashed (rc={argos_rc})", flush=True)
309+
print(f" [ERROR] ARGoS stderr: {argos_stderr[-500:]}", flush=True)
310+
diag_path = os.path.join(data_root, "argos_crash.log")
311+
with open(diag_path, "w") as f:
312+
f.write(f"ARGoS exit code: {argos_rc}\n")
313+
f.write(f"Time: {time.strftime('%Y-%m-%d %H:%M:%S')}\n")
314+
f.write(f"Episodes completed: {count_episodes(exp_name)}\n")
315+
f.write(f"Elapsed: {time.time() - start:.0f}s\n")
316+
f.write(f"Stderr:\n{argos_stderr}\n")
317+
main_proc.kill()
318+
main_proc.wait(timeout=10)
319+
raise RuntimeError(f"ARGoS crashed (rc={argos_rc}): {argos_stderr[-200:]}")
320+
# rc=0 means ARGoS finished normally — wait for Python to finish too
321+
break
319322
time.sleep(1)
320323
finally:
321324
argos_log_file.close()

0 commit comments

Comments
 (0)