Skip to main content

Module ctx

Module ctx 

Source
Expand description

Messages on a command task’s context channel: schedr dag-ctx and schedr.script asking the agent for the run’s parameters and information (decisions 143-148).

A command task inherits one end of a datagram socket pair (SCHEDR_CTX_FD). Each call makes a fresh stream socket pair, sends one end to the agent over it (SCM_RIGHTS, one datagram) and talks on the other: a connection of its own, which no other process can join. On that connection the framing is the runner channel’s (a 4-byte big-endian length, then UTF-8 JSON tagged by type), capped at MAX_CTX_MESSAGE_SIZE. The caller says CtxRequest::Hello first, with its protocol (CTX_PROTOCOL); the agent answers CtxAnswer::Welcome or CtxAnswer::Refused, then one answer per request until the caller closes it.

Structs§

CtxRun
The run information a task’s processes can read (schedr dag-ctx run get).

Enums§

CtxAnswer
The agent’s answer to a CtxRequest.
CtxRequest
A request from a process of the task to the agent.

Constants§

CTX_FD_ENV
The environment variable with a command task’s descriptor of its context channel.
CTX_PROTOCOL
The context channel’s protocol (decision 148): the agent accepts a caller speaking the same one, whatever its schedr version. Within a protocol, changes are only additions (a new request, a new field), and either side ignores fields it doesn’t know; anything else is a new protocol, a new value of an enumerated field included (a run kind: an older caller can’t read it). hello’s shape never changes, so a refusal can always be told.
MAX_CTX_MESSAGE_SIZE
The largest message on a context connection, in bytes (params are at most 64 KiB as JSON, decision 135; tags and escaping can grow them).