feat: worker discovery, lifecycle events, and coordination#34
Merged
pratyush618 merged 4 commits intomasterfrom Mar 22, 2026
Merged
feat: worker discovery, lifecycle events, and coordination#34pratyush618 merged 4 commits intomasterfrom
pratyush618 merged 4 commits intomasterfrom
Conversation
Storage layer changes: - Add started_at, hostname, pid, pool_type columns to workers table - register_worker accepts hostname, pid, pool_type params - reap_dead_workers returns Vec<String> (reaped worker IDs) - New update_worker_status method for lifecycle transitions - New list_claims_by_worker for orphan rescue - All 3 backends (SQLite, Postgres, Redis) + delegate macro updated - gethostname crate for hostname detection in PyO3 bindings
- Add WORKER_ONLINE, WORKER_OFFLINE, WORKER_UNHEALTHY event types - Emit WORKER_ONLINE after registration in run_worker() - Emit WORKER_OFFLINE for each reaped dead worker during heartbeat - Track resource health transitions, emit WORKER_UNHEALTHY on degradation - Set worker status to "draining" on shutdown signal - Update event type test for new events
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
started_at,hostname,pid,pool_typecolumns on workers table. Operators can now see which machine/process each worker runs on.WORKER_ONLINE(after registration),WORKER_OFFLINE(dead worker reaped),WORKER_UNHEALTHY(resource health degraded). Subscribe viaqueue.on_event().active → draining → stoppedstatus. Shutdown signal sets status to"draining"before drain timeout.reap_dead_workersnow returns reaped worker IDs (was silent count). WORKER_OFFLINE events fired for each.list_claims_by_workermethod added to all backends for future orphaned job rescue.Test plan
cargo checkall feature comboscargo test --workspace— 43+ Rust tests passuv run python -m pytest tests/python/ -v— 352 pass, 9 skippeduv run ruff check py_src/ tests/— cleanuv run mypy py_src/taskito/ tests/python/ --no-incremental— 0 errors