mirror of
https://github.com/logos-blockchain/logos-blockchain-testing.git
synced 2026-04-11 21:53:45 +00:00
Scheduler Example
This example runs a small replicated job scheduler with worker leases.
The scenario enqueues jobs, lets one worker claim them, stops making progress, and then checks that another worker can reclaim and complete them after the lease expires.
How TF runs this
Each example follows the same pattern:
- TF starts a small deployment of scheduler nodes
- the workload drives the worker flow through the HTTP API
- the expectation checks that jobs are eventually reclaimed and completed
Scenario
basic_failoverruns the failover flow locallycompose_failoverruns the same flow in Docker Compose
API
Each node exposes:
POST /jobs/enqueueto add jobsPOST /jobs/claimto claim pending jobs with a leasePOST /jobs/heartbeatto extend a leasePOST /jobs/ackto mark a job completeGET /jobs/stateto inspect scheduler stateGET /internal/snapshotto read the local replicated state
Run locally
cargo run -p scheduler-examples --bin basic_failover
Run with Docker Compose
cargo run -p scheduler-examples --bin compose_failover
Set SCHEDULER_IMAGE to override the default compose image tag.