Sections A-C of TOMO_QUEUE_TESTING.md's checklist, run against a live sim session: params-restored-per-job, legacy queue migration, empty/all-done no-ops, start_index semantics, exception/SIGKILL crash-resume, resume- before-fresh ordering, and concurrent queue edits from a second client. All 10 tests pass together with no cross-test interference. The flomni_sim fixture and _bootstrap.py factor out what it takes to construct a live Flomni against the sim (builtins/reload bootstrap, side-effect neutralization, RT-feedback/fsamx setup) for reuse by both in-process tests and the SIGKILL-based subprocess tests. Also adds the AI_docs/ handoff docs (testing checklist results, command- jobs plan with the action-registry decisions) that this work updated. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
37 lines
1.3 KiB
Python
37 lines
1.3 KiB
Python
"""Standalone script: connect to the running sim and call
|
|
flomni.tomo_queue_execute(). Run as a real OS subprocess (its own main
|
|
thread) rather than a Python thread inside the test process: BECIPythonClient
|
|
's live-update machinery installs a SIGINT handler per scan request, which
|
|
Python only allows from a process's real main thread (see
|
|
_queue_helpers.ProgressSampler for the same constraint hit from the thread
|
|
side). Section B/C tests spawn this and SIGKILL it (or edit the queue
|
|
concurrently from a second client) to simulate a crashed kernel / a second
|
|
operator session.
|
|
|
|
Usage: python _run_queue_subprocess.py <services_config_path> [start_index]
|
|
Exit code is 0 on a clean run, 1 if tomo_queue_execute() raised.
|
|
"""
|
|
|
|
import sys
|
|
|
|
from _bootstrap import build_flomni, shutdown
|
|
|
|
|
|
def main() -> int:
|
|
services_config_path = sys.argv[1]
|
|
start_index = int(sys.argv[2]) if len(sys.argv) > 2 else 0
|
|
|
|
bec, flomni = build_flomni(services_config_path)
|
|
try:
|
|
flomni.tomo_queue_execute(start_index=start_index)
|
|
except Exception as exc: # noqa: BLE001 - reported via exit code, not re-raised
|
|
print(f"_run_queue_subprocess: tomo_queue_execute() raised: {exc}", file=sys.stderr)
|
|
return 1
|
|
finally:
|
|
shutdown(bec)
|
|
return 0
|
|
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|