pub struct TaskSpec<P> {Show 15 fields
pub payload: Arc<P>,
pub kind: Arc<str>,
pub pool: Arc<str>,
pub priority: Priority,
pub key: Option<Arc<str>>,
pub deadline: Option<Time>,
pub fixed_start: Option<FixedStart>,
pub duration_hint: Option<Duration>,
pub timeout: Option<Duration>,
pub retry: Option<RetryPolicy>,
pub deps: Vec<Dep>,
pub resources: SmallVec<[(Arc<str>, u32); 2]>,
pub tags: Vec<(Arc<str>, Arc<str>)>,
pub labels: Vec<(Arc<str>, Arc<str>)>,
pub tenant: Option<Arc<str>>,
}Expand description
Everything the engine needs to schedule one task.
Built with TaskSpec::new and the chained setters; all fields are public for direct use.
Fields§
§payload: Arc<P>The work itself, handed to the executor unchanged.
kind: Arc<str>Free-form category; duration statistics are learned per (pool, kind).
pool: Arc<str>Pool that runs the task (default "default").
priority: PriorityPriority class.
key: Option<Arc<str>>Optional unique key: deduplicates submissions while the task is live or retained, and lets dependents refer to it by name.
deadline: Option<Time>Soft deadline for completion; urgency rises as its latest start time approaches.
fixed_start: Option<FixedStart>Start at (or close to) a given time, with capacity reserved in advance.
duration_hint: Option<Duration>Expected runtime; when absent the engine uses learned statistics.
timeout: Option<Duration>Per-attempt timeout.
retry: Option<RetryPolicy>None uses the pool default.
deps: Vec<Dep>Tasks that must finish first (see Dep).
resources: SmallVec<[(Arc<str>, u32); 2]>Shared resources needed while running: (resource name, amount).
Labels passed through to executors (e.g. traceparent, tenant).
labels: Vec<(Arc<str>, Arc<str>)>Worker labels this task requires: it runs only on a worker group whose labels include
every (name, value) pair (see Core::set_group_capacity).
tenant: Option<Arc<str>>Tenant the task belongs to, for weighted fair sharing of pools with
PoolConfig::fairness.
Implementations§
Source§impl<P> TaskSpec<P>
impl<P> TaskSpec<P>
Sourcepub fn map_payload<Q>(self, payload: Arc<Q>) -> TaskSpec<Q>
pub fn map_payload<Q>(self, payload: Arc<Q>) -> TaskSpec<Q>
Same task description with a different payload type.
Sourcepub fn from_arc(payload: Arc<P>) -> Self
pub fn from_arc(payload: Arc<P>) -> Self
Like TaskSpec::new with an already shared payload.
Sourcepub fn fixed_start(self, f: FixedStart) -> Self
pub fn fixed_start(self, f: FixedStart) -> Self
Set a fixed start.
Sourcepub fn duration_hint(self, d: Duration) -> Self
pub fn duration_hint(self, d: Duration) -> Self
Set the expected runtime.
Sourcepub fn retry(self, r: RetryPolicy) -> Self
pub fn retry(self, r: RetryPolicy) -> Self
Set the retry policy.
Sourcepub fn resource(self, name: impl Into<Arc<str>>, amount: u32) -> Self
pub fn resource(self, name: impl Into<Arc<str>>, amount: u32) -> Self
Require amount units of a resource while running.