docs(cron): name hermes_bootstrap as the pre-ack relaunch in the worker docstrings
After the previous commit the worker's pre-ack recovery is the import of hermes_bootstrap, not run_agent's copy; the module docstring and the relaunch test still credited run_agent. Also restore the scheduler comment's original wrap (whitespace-only churn from the first pick). (Lead fold: quality + thermo + reuse lenses, Low.)
This commit is contained in:
@@ -4442,9 +4442,10 @@ if __name__ == "__main__":
|
||||
parser.add_argument("--external-worker-file", type=Path, required=True)
|
||||
parser.add_argument("--ack-file", type=Path, required=True)
|
||||
args = parser.parse_args()
|
||||
# The gateway spawns this worker with stdout on DEVNULL and stderr on a capture file it
|
||||
# only reads back if we die before the ack; without a log handler every adoption/ack
|
||||
# failure below would otherwise be invisible to the persistent log.
|
||||
# The gateway spawns this worker with stdout on DEVNULL and stderr on a
|
||||
# capture file it only reads back if we die before the ack; without a
|
||||
# log handler every adoption/ack failure below would otherwise be
|
||||
# invisible to the persistent log.
|
||||
try:
|
||||
from hermes_logging import setup_logging
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
``sys.executable -m cron.scheduler --external-worker-file ...``
|
||||
(``cron/scheduler.py::_launch_external_cron_worker``) is a full Hermes entry point that
|
||||
does not go through ``hermes_bootstrap``, and it imports Hermes packages the moment it
|
||||
reaches ``hermes_bootstrap`` only from its ``__main__``, and it imports Hermes packages the moment it
|
||||
starts. ``cron/scheduler_worker_env.py`` restores the committed generation's
|
||||
``site-packages`` on its ``PYTHONPATH`` so those imports resolve, but a pinned path is not a
|
||||
boot: the worker holds no lease on the generation, so the PM collector may remove it
|
||||
@@ -30,9 +30,8 @@ and may relaunch the process into a fresh one (``hermes_cli/venv_sync.py::relaun
|
||||
tree a killed ``hermes update`` half-wrote. ``finish_worker_boot()`` runs it from
|
||||
the worker's ``__main__`` before the payload is read, so a relaunch replays the whole worker: the
|
||||
payload is still on disk and the marker still set, and the new process boots its dependencies
|
||||
again. Left to ``run_agent``'s import inside ``run_one_job``, the relaunch came after the ack, with
|
||||
the payload deleted and the marker consumed: the new process died on ``ruamel`` and the adopted
|
||||
run was left ``unknown``.
|
||||
again. ``hermes_bootstrap`` re-runs the (idempotent) dependency boot; the package-init call above
|
||||
must stay, because ``cron.jobs`` needs dependencies before ``__main__`` can run.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
@@ -810,7 +810,7 @@ runpy.run_module("cron.scheduler", run_name="__main__", alter_sys=True)
|
||||
|
||||
@pytest.mark.parametrize("cause", ["source_update", "interrupted_pull"])
|
||||
def test_relaunch_replays_the_worker_before_its_ack(tmp_path, cause):
|
||||
"""``run_agent``'s import may relaunch the process: ``hermes_bootstrap`` finishing a source
|
||||
"""Importing ``hermes_bootstrap`` may relaunch the process: finishing a source
|
||||
update (into an ``-I`` interpreter that ignores the pinned PYTHONPATH), or the restore of a
|
||||
tree a killed ``hermes update`` half-wrote. Reached inside ``run_one_job``, either came after
|
||||
the ack: the payload was deleted, the marker consumed, and the new process died on ``ruamel``
|
||||
|
||||
Reference in New Issue
Block a user