Expand description
The operation handle, and what its commands take and answer. The operation object, and the filters and parameters its commands take.
An operation used to be a String here, and every command took one. That is
still true — Client carries the whole lifecycle over an id — but a string
is a poor thing to hand to a function, and it is nothing to reattach to.
Operation is the handle: a client and an id, with the same commands on
it, obtained either from an id you just started or from one you persisted
before the process died.
let id = client.start_vanilla(&spec)?;
std::fs::write("run.id", &id)?; // survive a restart
// …later, in a process that did not start it:
let op = client.attach_operation(std::fs::read_to_string("run.id")?);
op.suspend(false)?;
op.resume()?;
op.wait()?;§What the cluster says about the lifecycle
Measured on a local cluster, because none of it is obvious:
- Suspension is not a state. A suspended operation still reports
running;suspendedis a separate attribute, which is whatOperation::suspendedreads — andOperation::statusreads beside the state, in one request, because a poll loop needs both. Polling the state alone will never tell you an operation is paused. - Suspend is idempotent, resume is not. Suspending a suspended operation
answers
{}; resuming one that is not suspended fails with code 201,Operation is in "running" state. - Complete is not idempotent, and behaves like
Client::abort_operation: the second one is answeredNo such operation. - Once the scheduler has let the operation go, every one of these answers
No such operation— the rule is “the scheduler still has it”, not “it has not finished”.
Structs§
- Operation
- A running — or finished — operation, and the client that can ask about it.
- Operation
Event - One entry of an operation’s event log, as
list_operation_eventsreports it. - Operation
Filter - Which operations
Client::list_operationsshould return. - Operation
Info - One operation, as
Client::list_operationsreports it. - Operation
List - The answer to
Client::list_operations. - Operation
Parameters - What
Client::update_operation_parametersshould change. - Operation
Status - What an operation is doing, as
Client::operation_statusreports it.