-
Notifications
You must be signed in to change notification settings - Fork 3
Add worker ID #748
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add worker ID #748
Conversation
## Walkthrough
The changes introduce a `worker_id` parameter throughout the executor library's interactive and scheduling components. Argument parsing, initialization, and task execution logic are updated to set and propagate `worker_id` to worker processes and threads. Tests are added to verify that the correct worker ID is assigned and returned during execution.
## Changes
| File(s) | Change Summary |
|-----------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------|
| **Interactive backend memory management**<br>`executorlib/backend/interactive_parallel.py`, `executorlib/backend/interactive_serial.py` | Initialize `memory` with `worker_id` from arguments; update `memory` dict instead of replacing it. |
| **Argument parsing update**<br>`executorlib/standalone/interactive/backend.py` | Add `"worker_id"` parsing and default value to argument parsing logic. |
| **Interface bootup enhancement**<br>`executorlib/standalone/interactive/communication.py`| Extend `interface_bootup` to accept and pass optional `worker_id` as a command-line argument. |
| **Worker thread initialization**<br>`executorlib/task_scheduler/interactive/blockallocation.py` | Pass unique `worker_id` to each worker thread in `BlockAllocationTaskScheduler`. |
| **Task execution update**<br>`executorlib/task_scheduler/interactive/shared.py` | Add optional `worker_id` parameter to `execute_tasks` and propagate to interface initialization. |
| **Worker ID tests**<br>`tests/test_singlenodeexecutor_noblock.py` | Add helpers and a test class to verify correct worker ID assignment and propagation in executors. |
| **Test updates for argument parsing**<br>`tests/test_standalone_interactive_backend.py` | Update expected parsed arguments to include `"worker_id": 0` in existing tests. |
## Sequence Diagram(s)
```mermaid
sequenceDiagram
participant Scheduler
participant WorkerThread
participant Interface
participant WorkerProcess
Scheduler->>WorkerThread: Start with worker_id=N
WorkerThread->>Interface: interface_bootup(..., worker_id=N)
Interface->>WorkerProcess: Launch with --worker-id N
WorkerProcess->>WorkerThread: Ready (memory contains worker_id)
WorkerThread->>Scheduler: Task results (may include worker_id) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~15 minutes Poem
|
# Conflicts: # executorlib/task_scheduler/interactive/shared.py
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #748 +/- ##
=======================================
Coverage ? 97.66%
=======================================
Files ? 32
Lines ? 1453
Branches ? 0
=======================================
Hits ? 1419
Misses ? 34
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary by CodeRabbit