Skip to main content

JobError

Enum JobError 

Source
pub enum JobError {
Show 18 variants Read(Error), Write { table: usize, source: Error, }, Yson { offset: u64, source: YsonError, }, TruncatedRecord { offset: u64, buffered: usize, }, RecordTooLarge { offset: u64, limit: usize, }, BadControlRecord { offset: u64, reason: String, }, Skiff(CodecError), BadSkiffSchema { table: usize, reason: String, }, BadSkiffControl { table: usize, column: &'static str, reason: String, }, SkiffOutputSchemaCount { sinks: usize, schemas: usize, }, SkiffWrite { table: usize, source: CodecError, }, UnsupportedDataFormat, WorkerRowFormatMismatch { writer: &'static str, row: &'static str, }, UnknownTable { index: usize, count: usize, names: Vec<String>, }, Serialize { table: usize, source: YsonError, }, TooManyStatistics { limit: usize, name: String, }, Statistics { reason: String, }, WriteAfterFinish { table: usize, },
}
Expand description

Something went wrong reading input or writing output.

Every variant is fatal to the job. YTsaurus judges a job by its exit code, so the right response is to report the error on stderr — where the operation UI shows it — and exit non-zero. crate::run does that for you.

Variants§

§

Read(Error)

Reading the input stream failed.

§

Write

Writing to an output table failed.

Treated as fatal: a partial write means the output table would be missing rows, and silently producing a truncated table is worse than failing the job.

Fields

§table: usize

Index of the output table that failed.

§source: Error

The underlying I/O error.

§

Yson

The input was not valid YSON.

Fields

§offset: u64

Offset of the failing record from the start of the stream.

§source: YsonError

The underlying parse error.

§

TruncatedRecord

The stream ended part-way through a record.

Fields

§offset: u64

Offset of the incomplete record from the start of the stream.

§buffered: usize

How many bytes of it had arrived.

§

RecordTooLarge

A single record was larger than the reader is willing to buffer.

Because a record must be contiguous in memory to be parsed, an implausibly large length prefix in corrupt input would otherwise be an out-of-memory abort. See crate::JobReader::with_max_record_bytes.

Fields

§offset: u64

Offset of the oversized record from the start of the stream.

§limit: usize

The configured limit, in bytes.

§

BadControlRecord

A control record carried an attribute value of the wrong type.

Fields

§offset: u64

Offset of the control record from the start of the stream.

§reason: String

What was wrong with it.

§

Skiff(CodecError)

The Skiff stream could not be framed or decoded.

§

BadSkiffSchema

The operation’s Skiff schema put system fields in an invalid layout.

Fields

§table: usize

The input-table schema that is malformed.

§reason: String

What violates the job-format rules.

§

BadSkiffControl

A Skiff system field carried a value that does not have its prescribed shape.

Fields

§table: usize

The input table that supplied the bad row.

§column: &'static str

The system field name.

§reason: String

What is malformed about its value.

§

SkiffOutputSchemaCount

The number of Skiff output descriptors did not match the format’s table schemas.

Fields

§sinks: usize

Number of output descriptors supplied by the caller.

§schemas: usize

Number of schemas supplied by the output format.

§

SkiffWrite

Writing or flushing a Skiff output table failed.

Fields

§table: usize

The output table that failed.

§source: CodecError

The framing, validation, or I/O failure.

§

UnsupportedDataFormat

This version of the worker runtime does not know a future ytsaurus_format::DataFormat variant yet.

§

WorkerRowFormatMismatch

A row’s representation did not match the writer’s selected format.

Fields

§writer: &'static str

Format selected by the writer.

§row: &'static str

Representation supplied by the caller.

§

UnknownTable

A row was written to an output table the job does not have.

Fields

§index: usize

The index that was asked for.

§count: usize

How many output tables the job actually has.

§names: Vec<String>

Declared table names, when the writer was built with crate::JobWriter::named. Turns a bare index into something the reader of the error can act on.

§

Serialize

Serializing a row failed.

Fields

§table: usize

Index of the destination output table.

§source: YsonError

The underlying serialization error.

§

TooManyStatistics

More custom statistics than a job is allowed to report.

The limit is on distinct names, not on writes: adding to one already recorded is always fine.

Fields

§limit: usize

The cluster’s limit.

§name: String

The name that did not fit.

§

Statistics

Sending custom statistics failed.

Separate from JobError::Write because descriptor 5 is not an output table, and reporting it as “output table 5” would send the reader looking for a table that does not exist.

Fields

§reason: String

What went wrong.

§

WriteAfterFinish

A row was written after crate::JobWriter::finish.

finish is the writer’s end: a row accepted after it would sit in the buffer and vanish when the job exits — a short table under exit code zero, the exact outcome finish exists to rule out. Refusing the row makes the bug the caller’s to see instead of the table’s to carry.

Fields

§table: usize

Index of the output table the late row was meant for.

Implementations§

Source§

impl JobError

Source

pub fn kind(&self) -> &'static str

A short, stable name for what went wrong.

Formatting a JobError allocates and produces a message that may change between versions. A job that quarantines bad rows wants neither: it wants a cheap, stable value to put in a reason column so the rejects table can be grouped and counted.

// Cheap and stable — safe to write into an output table.
let reason: &'static str = e.kind();
Source

pub fn is_row_local(&self) -> bool

Whether this error is about one bad row rather than the stream itself.

A job that quarantines bad rows should keep going for these and stop for the rest: a truncated stream or a failed write means every subsequent row is suspect, and carrying on would quietly produce a short output table.

if e.is_row_local() {
    // quarantine the row and continue
} else {
    return Err(e);
}

Trait Implementations§

Source§

impl Debug for JobError

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for JobError

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Error for JobError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.