pub struct Operation { /* private fields */ }Expand description
A running — or finished — operation, and the client that can ask about it.
Obtained from Client::attach_operation. Every method is the Client
method of the same name with the id filled in, so nothing here can be done
only through the handle; the handle exists so that an operation can be
passed around as one thing, and so that reattaching to one has an obvious
spelling.
Dropping it does nothing, which is the opposite of
Transaction. A transaction that loses its handle is
aborted, because a transaction is a scope. An operation is meant to outlive
the process that started it — that is what makes reattaching worth having —
so this handle is a name and not a lease.
Implementations§
Source§impl Operation
impl Operation
Sourcepub fn id(&self) -> &str
pub fn id(&self) -> &str
The operation’s ID, as the cluster named it.
The thing to persist: it is what the web interface shows, and what
Client::attach_operation needs to build this handle again.
Sourcepub fn get(&self, attributes: &[&str]) -> Result<YsonValue>
pub fn get(&self, attributes: &[&str]) -> Result<YsonValue>
The whole operation document. See Client::get_operation.
§Errors
Returns ClientError if the request fails.
Sourcepub fn state(&self) -> Result<String>
pub fn state(&self) -> Result<String>
The current state, e.g. running or completed.
Note that a suspended operation still reports running; ask
Operation::suspended about that, or Operation::status about
both at once.
§Errors
Returns ClientError if the request fails.
Sourcepub fn suspended(&self) -> Result<bool>
pub fn suspended(&self) -> Result<bool>
Whether the operation is suspended. See Client::operation_suspended.
§Errors
Returns ClientError if the request fails.
Sourcepub fn status(&self) -> Result<OperationStatus>
pub fn status(&self) -> Result<OperationStatus>
The state and the suspension together. See Client::operation_status.
What a poll loop wants: the two are useless apart, and this asks for them in one request.
§Errors
Returns ClientError if the request fails.
Sourcepub fn wait(&self) -> Result<()>
pub fn wait(&self) -> Result<()>
Polls until the operation finishes. See Client::wait_for_operation.
§Errors
Returns ClientError::OperationFailed
if it ends as anything other than completed.
Sourcepub fn suspend(&self, abort_running_jobs: bool) -> Result<()>
pub fn suspend(&self, abort_running_jobs: bool) -> Result<()>
Pauses the operation. See Client::suspend_operation.
§Errors
Returns ClientError if the request fails.
Sourcepub fn resume(&self) -> Result<()>
pub fn resume(&self) -> Result<()>
Lets a suspended operation run again. See Client::resume_operation.
§Errors
Returns ClientError if the request fails,
including when the operation was not suspended.
Sourcepub fn complete(&self) -> Result<()>
pub fn complete(&self) -> Result<()>
Finishes the operation with what it has. See
Client::complete_operation.
§Errors
Returns ClientError if the request fails.
Sourcepub fn update_parameters(&self, parameters: &OperationParameters) -> Result<()>
pub fn update_parameters(&self, parameters: &OperationParameters) -> Result<()>
Changes the operation’s scheduling parameters while it runs. See
Client::update_operation_parameters.
§Errors
Returns ClientError if the request fails, or
ClientError::Config if parameters is
empty.
Sourcepub fn error(&self) -> Result<Option<String>>
pub fn error(&self) -> Result<Option<String>>
Why the operation ended as it did. See
Client::operation_result_error.
§Errors
Returns ClientError if the request fails.
Sourcepub fn job_input(&self, job_id: &str) -> Result<ResponseReader>
pub fn job_input(&self, job_id: &str) -> Result<ResponseReader>
Sourcepub fn job_stderr(&self, job_id: &str) -> Result<Vec<u8>>
pub fn job_stderr(&self, job_id: &str) -> Result<Vec<u8>>
What a job wrote to stderr. See Client::get_job_stderr.
§Errors
Returns ClientError if the request fails.
Sourcepub fn events(&self) -> Result<Vec<OperationEvent>>
pub fn events(&self) -> Result<Vec<OperationEvent>>
The operation’s event log. See Client::list_operation_events.
§Errors
Returns ClientError if the request fails.
Sourcepub fn statistics(&self) -> Result<YsonValue>
pub fn statistics(&self) -> Result<YsonValue>
Everything the scheduler recorded about the jobs. See
Client::job_statistics.
§Errors
Returns ClientError if the request fails.
Sourcepub fn custom_statistics(&self) -> Result<YsonValue>
pub fn custom_statistics(&self) -> Result<YsonValue>
The statistics the jobs reported themselves. See
Client::custom_statistics.
§Errors
Returns ClientError if the request fails.
Sourcepub fn statistic_sum(&self, name: &str) -> Result<Option<i64>>
pub fn statistic_sum(&self, name: &str) -> Result<Option<i64>>
The total of one custom statistic. See Client::statistic_sum.
§Errors
Returns ClientError if the request fails.
Sourcepub fn job_statistic_sum(&self, path: &str) -> Result<Option<i64>>
pub fn job_statistic_sum(&self, path: &str) -> Result<Option<i64>>
The total of one built-in statistic. See
Client::job_statistic_sum.
§Errors
Returns ClientError if the request fails.