Skip to main content

Module remote

Module remote 

Source
Expand description

A run delivered to an agent in another channel (#1988, spec §3.2).

Each AgentMux publishes turn events to its own broker, so the instance that fired a run can’t see the turn of a pane another channel holds. The ledger is shared, though, and the run id is the delivery’s request_id: the receiving instance finds the open row by it, marks it running with its own pane’s account, notes itself in links.followed_by_channel and follows the turn on its own broker (RunLedger::follow_forwarded).

The firing instance only watches the row (RunLedger::check_remote): a run nobody followed (a receiver on an older build) is closed after the no-turn timeout, cost unknown, as before; a run whose follower’s process is gone is interrupted. That process counts only while it is still the srv that wrote the claim (process_identity::srv_alive): a pid another program reused reads as gone. Every close is the conditional job_run_finish, so whichever side writes first wins and the other changes nothing.

Stopping such a run. A timeout, or a cancel_other overlap, can’t interrupt the pane from the firing instance, and closing the row there would free its place while the agent goes on working. So the firing instance asks the following one (RunLedger::request_remote_stop, a RemoteStopHook the server installs), notes the ask in links.stop_requested, and leaves the row open. The following instance (RunLedger::stop_followed_here) closes the row with the status asked for and interrupts the pane, as a local stop does. When the ask can’t be delivered the reason goes in links.stop_error and it is tried again.

Whose stop it is. The ask over HTTP names only the run, the pane and the asking channel. What the follower acts on is the note in the shared ledger, which only the instance that fired the run writes, so another channel that guesses a run id, or names the right channel, stops nothing: the row has to carry a stop its own origin asked for.

Structs§

FollowedBy
Who follows a run, from its links.
RemoteStop
A stop for a run another channel follows, as it is asked of that channel.

Enums§

Verdict
What the firing instance does with a watched cross-channel run.

Constants§

FOLLOWED_AT_MS
FOLLOWED_BY_CHANNEL
The links keys the following instance writes: its channel, its process id, and when it took the run.
FOLLOWED_BY_PID
FOLLOWER_GONE
The summary of a run whose following instance stopped during it.
NOT_FOLLOWED
The summary of a run no instance followed.
STOP_ERROR
STOP_REQUESTED
The links keys of a stop the firing instance asked for, and of why the ask could not be delivered.

Functions§

followed_by
Who follows run, if anyone.
verdict
Judge a watched run, armed at armed_at_ms. Pure, with the follower check (pid, followed_at_ms) passed in, so the rules are testable.

Type Aliases§

RemoteStopHook
How the server delivers a RemoteStop (it needs the shared registry and an HTTP client, which the ledger has not). It reports back through RunLedger::remote_stop_done or RunLedger::remote_stop_failed.