parallel¶
Classes¶
- class behave_priority.parallel.ParallelCoordinator(coord_dir, worker_id=None)[source]¶
Bases:
objectFile-based coordination for parallel workers.
Each worker creates and maintains its own JSON file in a shared coordination directory. The file contains the worker’s failure count and critical-failure flag. Global state is computed by reading all worker files in the directory.
- Variables:
coord_dir – Directory where worker files are stored.
worker_id – Unique identifier for this worker (defaults to PID).
- report_failure(*, is_critical=False)[source]¶
Record a failure for this worker.
Atomically updates the worker’s file with the new failure count.
- should_stop(stop_after_failures, stop_on_critical)[source]¶
Check if global fail-fast conditions have been met.
Reads all worker files in the coordination directory and aggregates failure counts and critical-failure flags. Files that fail to parse, or that were created before this run (stale files left by a crashed previous run), are ignored.
Functions¶
- behave_priority.parallel.get_coord_dir()[source]¶
Get the coordination directory from the environment variable.
- behave_priority.parallel.create_coordinator(worker_id=None)[source]¶
Create a ParallelCoordinator from the env var, if set.