diff --git a/backend/app/worker/fluksio_worker.py b/backend/app/worker/fluksio_worker.py index 458f652..4124902 100644 --- a/backend/app/worker/fluksio_worker.py +++ b/backend/app/worker/fluksio_worker.py @@ -48,7 +48,24 @@ PROTOCOL = 1 HEARTBEAT_S = 10.0 #: Reconnection backs off to this and no further. MAX_BACKOFF_S = 30.0 -WORKER_MAIN = Path(__file__).with_name("worker_main.py") + + +def _worker_main() -> Path: + """The user-code runner: beside this file once deployed, or in a checkout. + + On a worker host the two files sit together, which is what the install + instructions say. Run straight from a clone and the runner is one directory + over, in the engine's own package — worth finding, so trying this out does + not start with copying files around. + """ + here = Path(__file__).resolve().parent + for candidate in (here / "worker_main.py", here.parent / "flow" / "worker_main.py"): + if candidate.exists(): + return candidate + return here / "worker_main.py" + + +WORKER_MAIN = _worker_main() class Subprocess: