Struct prefect::Job

source ·
pub struct Job {
    pub job_type: Cow<'static, str>,
    pub priority: i32,
    pub weight: u32,
    pub run_at: Option<OffsetDateTime>,
    pub payload: Vec<u8>,
    pub retries: Retries,
    pub timeout: Duration,
    pub heartbeat_increment: Duration,
}
Expand description

A job to be submitted to the queue.

Fields

job_type: Cow<'static, str>

The name of the job, which matches the name used in the JobRunner for the job.

priority: i32

Jobs with higher priority will be executed first.

weight: u32

Jobs that are expected to take more processing resources can be given a higher weight to account for this. A worker counts the job’s weight (1, by default) against its maximum concurrency when deciding how many jobs it can execute. For example, a worker with a max_concurrency of 10 would run three jobs at a time if each had a weight of three.

For example, a video transcoding task might alter the weight depending on the resolution of the video or the processing requirements of the codec for each run.

run_at: Option<OffsetDateTime>

When to run the job. None means to run it right away.

payload: Vec<u8>

The payload to pass to the job when it runs.

retries: Retries

Retry behavior when the job fails.

timeout: Duration

How long to allow the job to run before it is considered failed.

heartbeat_increment: Duration

How much extra time a heartbeat will add to the expiration time.

Implementations

Create a JobBuilder for the given job_type.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

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

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more