Skip to main content

Operation

Struct Operation 

Source
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

Source

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.

Source

pub fn client(&self) -> &Client

The client this handle sends its commands through.

Source

pub fn get(&self, attributes: &[&str]) -> Result<YsonValue>

The whole operation document. See Client::get_operation.

§Errors

Returns ClientError if the request fails.

Source

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.

Source

pub fn suspended(&self) -> Result<bool>

Whether the operation is suspended. See Client::operation_suspended.

§Errors

Returns ClientError if the request fails.

Source

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.

Source

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.

Source

pub fn abort(&self, reason: Option<&str>) -> Result<()>

Stops the operation. See Client::abort_operation.

§Errors

Returns ClientError if the request fails.

Source

pub fn suspend(&self, abort_running_jobs: bool) -> Result<()>

Pauses the operation. See Client::suspend_operation.

§Errors

Returns ClientError if the request fails.

Source

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.

Source

pub fn complete(&self) -> Result<()>

Finishes the operation with what it has. See Client::complete_operation.

§Errors

Returns ClientError if the request fails.

Source

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.

Source

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.

Source

pub fn jobs(&self, state: Option<&str>, limit: u32) -> Result<Vec<JobInfo>>

The operation’s jobs. See Client::list_jobs.

§Errors

Returns ClientError if the request fails.

Source

pub fn job(&self, job_id: &str) -> Result<JobInfo>

One job of the operation. See Client::get_job.

§Errors

Returns ClientError if the request fails.

Source

pub fn job_input(&self, job_id: &str) -> Result<ResponseReader>

What a job read. See Client::get_job_input.

§Errors

Returns ClientError if the request fails.

Source

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.

Source

pub fn events(&self) -> Result<Vec<OperationEvent>>

The operation’s event log. See Client::list_operation_events.

§Errors

Returns ClientError if the request fails.

Source

pub fn statistics(&self) -> Result<YsonValue>

Everything the scheduler recorded about the jobs. See Client::job_statistics.

§Errors

Returns ClientError if the request fails.

Source

pub fn custom_statistics(&self) -> Result<YsonValue>

The statistics the jobs reported themselves. See Client::custom_statistics.

§Errors

Returns ClientError if the request fails.

Source

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.

Source

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.

Trait Implementations§

Source§

impl Clone for Operation

Source§

fn clone(&self) -> Operation

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Operation

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more