Skip to content
Taskvisor 0.8source v0.8.3

Taskvisor examples

Each file is a complete runnable program. Run every command from the repository root. Start with basic, then choose the branch closest to your application.

Choose a path

Arrows show a suggested reading order, not runtime data flow.

text
basic
├── reusable task type ───► task_type
├── resident lifecycle ───► graceful_worker ──► application_shutdown
├── policies and limits ──► periodic ─────────► restart_policies ──► configuration
├── results and control ──► outcomes ─────────► dynamic_tasks
├── service patterns ─────► queue_consumer ───► cpu_job
├── observability ────────► custom_subscriber
│                              ├── readable logs ────────► logging
│                              ├── structured events ────► tracing
│                              └── Prometheus counters ──► metrics
└── keyed admission ──────► controller_slots ──► controller_admission ──► tenant_sync

Catalog

Only examples marked Ctrl+C wait for a signal. The others exit on their own. Commands use default features unless they include an explicit --features flag. The default controller feature covers the keyed-admission examples.

ExampleWhat to learnRunStop
basic.rsRun one static task once.cargo run --example basic
task_type.rsImplement Task for reusable state across fresh attempts.cargo run --example task_type
graceful_worker.rsMake a resident worker observe cooperative cancellation.cargo run --example graceful_workerCtrl+C
application_shutdown.rsStop a static batch with an application-owned future.cargo run --example application_shutdown
periodic.rsRepeat short work with fixed-delay scheduling.cargo run --example periodicCtrl+C
restart_policies.rsCombine one-shot, retrying, and periodic tasks.cargo run --example restart_policiesCtrl+C
configuration.rsSet supervisor limits, task defaults, and per-task overrides.cargo run --example configuration
outcomes.rsAwait completed, failed, fatal, timed-out, and canceled outcomes.cargo run --example outcomes
dynamic_tasks.rsAdd, inspect, cancel, and remove tasks at runtime.cargo run --example dynamic_tasks
queue_consumer.rsRetry a broker session and make receive cancellation-aware.cargo run --example queue_consumer
cpu_job.rsMove CPU work to Rayon and understand its cancellation limit.cargo run --example cpu_job
custom_subscriber.rsHandle typed events through a bounded best-effort subscriber.cargo run --example custom_subscriber
logging.rsPrint readable lifecycle events with LogWriter.cargo run --example logging --features logging
tracing.rsSend structured lifecycle events to tracing.cargo run --example tracing --features tracing
metrics.rsBuild Prometheus counters from stable event labels.cargo run --example metrics
controller_slots.rsCompare queue, replace, and reject policies by slot.cargo run --example controller_slots
controller_admission.rsObserve typed admission outcomes and a controller snapshot.cargo run --example controller_admission
tenant_sync.rsKeep only the newest waiting revision for each tenant.cargo run --example tenant_sync

Open-source task execution components.