Skip to content

Latest commit

 

History

History
45 lines (43 loc) · 12.2 KB

File metadata and controls

45 lines (43 loc) · 12.2 KB

Glossary

Quick reference for terms used throughout the taskmill documentation.

Term Definition
Domain A typed module builder (Domain<D>) that bundles typed executors, domain-wide defaults (priority, retry policy, group, TTL, tags), optional concurrency cap, and scoped application state. The unit of composition in taskmill — define once, register anywhere. Task type names are automatically prefixed with "{domain_name}::" at registration time (e.g. "thumbnail""media::thumbnail"). See Quick Start.
DomainKey A marker trait (pub trait DomainKey) implemented on a zero-sized struct that gives a domain a compile-time identity. Provides a NAME constant used to namespace task types in the database (e.g. "media").
DomainHandle A typed, clonable runtime handle (DomainHandle<D>) returned by scheduler.domain::<D>(). All submission, cancellation, query, and event-subscription operations go through the handle, which auto-prefixes task types and applies domain defaults. See Quick Start.
Task type prefix The "{domain_name}::" namespace prepended to every task type when a domain is registered with the scheduler. Prevents collisions between domains that independently choose the same short type name. Stored in the database as the full qualified name (e.g. "media::thumbnail").
Blocked A task status indicating the task has unresolved dependencies and cannot be dispatched. Blocked tasks transition to pending when all their dependencies complete successfully, or to DependencyFailed if a dependency fails (depending on the failure policy). See Quick Start.
Backpressure Slowing down new work when the system is already busy. Taskmill uses pressure sources to detect load and throttle policies to decide which tasks to defer.
Delayed task A task with a run_after timestamp that defers dispatch until that time arrives. If the timestamp is in the past (e.g., after a restart), the task runs immediately. See Quick Start.
Dependency edge A record in the task_deps junction table representing that one task depends on another. An edge (A, B) means "task A cannot start until task B completes." Edges are removed when the dependency completes or fails, and are cleaned up on startup if they reference tasks that no longer exist.
DependencyFailurePolicy Controls what happens to a dependent task when one of its dependencies fails permanently. Cancel (default) moves the dependent to history as DependencyFailed and cascades to other dependents. Fail does the same without cascading. Ignore unblocks the dependent anyway. See Configuration.
Deduplication (dedup) Preventing the same task from being queued twice. Taskmill generates a SHA-256 key from the task type and payload; a second submission with the same key is silently ignored. See Persistence & Recovery.
Dispatch Moving a task from "waiting in line" (pending) to "actively running." The scheduler dispatches tasks in priority order (or effective priority order when aging is enabled), subject to concurrency limits, group weights, and backpressure.
EWMA Exponentially Weighted Moving Average — a smoothing technique that gives recent measurements more weight than old ones. Taskmill uses EWMA to smooth resource readings so the scheduler doesn't overreact to momentary spikes. See IO & Backpressure.
TypedExecutor Your code that performs the actual work for a task type. Implements TypedExecutor<T> and receives a deserialized payload: async fn execute(&self, payload: T, ctx: DomainTaskContext<'_, T::Domain>). Register with Domain::task::<T>(executor). See Quick Start.
IO budget An estimate of how many bytes a task will read and write (disk and/or network), submitted alongside the task. The scheduler uses IO budgets to avoid overwhelming the disk. See IO & Backpressure.
Pile-up prevention The mechanism that skips a recurring task instance when the previous instance hasn't been dispatched yet, preventing unbounded queue growth under sustained load. See Quick Start.
Priority aging An anti-starvation mechanism that gradually promotes pending tasks in effective priority over time. Configured via AgingConfig on SchedulerBuilder::priority_aging(). The stored priority is never mutated — effective priority is computed at dispatch time. See Priorities & Preemption.
Preemption Pausing lower-priority work so higher-priority work can run immediately. Preempted tasks resume automatically once the urgent work finishes. See Priorities & Preemption.
Pressure source Anything that signals the system is busy — disk IO, network throughput, memory usage, API rate limits, battery level. Returns a value from 0.0 (idle) to 1.0 (saturated). See IO & Backpressure.
Rate limit A token-bucket cap on how many tasks start per unit of time, independent of concurrency. Scoped by task type and/or group. Configured via RateLimit::per_second(n) / per_minute(n) with optional .with_burst(b). See Configuration — Rate limiting.
Task group A named set of tasks that share a concurrency limit, rate limit, and/or scheduling weight. For example, you might limit uploads to a specific S3 bucket to 3 concurrent and 100/sec, or give it 3x the scheduling weight of other groups. See Priorities & Preemption.
Group weight A relative scheduling weight assigned to a task group for weighted fair scheduling. Weights are relative — (A:3, B:1) gives A 75% and B 25% of capacity. Groups without an explicit weight use default_group_weight (default: 1). Configurable at build time and runtime.
Fair scheduling A dispatch strategy that allocates slots proportionally to group weights using a three-pass loop: fair per-group allocation, greedy fill, and urgent threshold override. Enabled when any group weights are configured. See Priorities & Preemption.
Urgent threshold A priority level in AgingConfig at which aged tasks may bypass group weight allocation during fair dispatch. Tasks that age past this threshold are dispatched in the urgent pass regardless of their group's weight allocation, but still respect max_concurrency.
task_deps The SQLite junction table that stores dependency edges between tasks. Each row (task_id, depends_on_id) means the task cannot start until the dependency completes. Edges survive restarts and are cleaned up automatically when dependencies resolve or on startup. See Persistence & Recovery.
Throttle policy Rules that map system pressure to dispatch decisions. The default policy defers background tasks when pressure exceeds 50% and normal tasks when it exceeds 75%, but never blocks high-priority work. See Priorities & Preemption.
TTL (time-to-live) A duration after which a task automatically expires if it hasn't started running. Configurable per-task, per-type, or as a global default. See Configuration.
TtlFrom Controls when the TTL clock starts: Submission (at submit time, the default) or FirstAttempt (when the task is first dispatched). See Configuration.
Recurring schedule The configuration that controls how a recurring task re-submits itself: interval (or delay between runs), maximum number of occurrences, and initial delay. Managed via RecurringSchedule. See Quick Start.
Recurring task A task that automatically re-submits itself after each completion according to a RecurringSchedule. Recurring schedules survive restarts and support pause, resume, and cancel operations. See Quick Start.
Typed task A struct that implements the TypedTask trait, giving you compile-time type safety for task payloads and configuration. Declares type Domain: DomainKey for compile-time domain identity and fn config() -> TaskTypeConfig for static defaults (priority, IO budget, TTL, retry policy, etc.). Register with Domain::task::<T>(executor) and submit with handle.submit(task). See Quick Start.
TaskTypeConfig A struct returned by TypedTask::config() that holds static per-task-type defaults — priority, IO budget, group key, TTL, retry policy, duplicate strategy, etc. All fields are Option; None means "use the next layer's default" (domain default, then scheduler global, then built-in).
DomainSubmitBuilder The fluent builder returned by DomainHandle::submit_with(task). Implements IntoFuture so bare .await applies all defaults; chain override methods (.priority(), .run_after(), .parent(), .fail_fast(), etc.) before .await to override individual fields for that call only.
Domain-scoped state Application state registered on a Domain via .state(value), visible only to executors within that domain. DomainTaskContext::state::<T>() checks domain state first and falls back to global state registered on SchedulerBuilder. See Configuration.
TypedEventStream A per-task-type event subscription (TypedEventStream<T>) created via handle.task_events::<T>(). Filters the global scheduler event broadcast to only events matching T::TASK_TYPE within the domain. Terminal events include the TaskHistoryRecord.
Qualified task type The full database-stored task type including the domain prefix, e.g. "media::thumbnail". Required when using store-level query APIs (history_stats, task_lookup, avg_throughput). DomainHandle methods apply the prefix automatically, so you typically only need the short form when submitting tasks.
Cross-domain dependency A dependency edge where the dependent task and its prerequisite belong to different domains. Functionally identical to same-domain dependencies — the domain boundary does not affect dependency resolution or failure propagation. See Multi-Module Applications.
Domain starvation A condition where one domain's tasks are never dispatched because higher-priority tasks from other domains continuously consume available concurrency slots. Priority ordering is global across all domains. Mitigated by priority aging, group weights, assigning appropriate priorities, and using group concurrency to reserve capacity. See Multi-Module Applications.
Effective priority The dispatch-time priority of a task when priority aging is enabled. Computed as base_priority - promotions (clamped to max_effective_priority). Equals the stored (base) priority when aging is disabled or the task hasn't waited past the grace period. Visible in TaskEventHeader and snapshots.
Late-binding state Application state injected into the scheduler after build() via scheduler.register_state(). Useful for library crates that receive a pre-built Scheduler as a dependency. Must be called before scheduler.run() — calling it after tasks are dispatching has no ordering guarantees with in-flight executors.