JobPoolManager#
- class pyedb.workflows.job_manager.backend.service.JobPoolManager(resource_limits: ResourceLimits)#
Priority-aware FIFO queues plus running-set tracker.
The implementation is lock-free (uses
dequeanddict) and async-safe (no awaits, therefore can be invoked from any thread).- Parameters:
- resource_limits
ResourceLimits Constraints used by
can_start_job().
- resource_limits
- Attributes:
Overview#
Insert job into the appropriate queue (priority or FIFO). |
|
Return the next job to be started (highest priority first). |
|
Idempotently remove a job from all queues. |
|
Boolean predicate that decides whether a new job may be started. |
|
Real-time snapshot for REST |
Import detail#
from pyedb.workflows.job_manager.backend.service import JobPoolManager
Attribute detail#
- JobPoolManager.resource_limits#
Method detail#
- JobPoolManager.add_job(job_id: str, priority: int = 0)#
Insert job into the appropriate queue (priority or FIFO).
- JobPoolManager.get_next_job() str | None#
Return the next job to be started (highest priority first).
Notes
Priority queues are checked first (highest to lowest), then the normal FIFO queue.
- JobPoolManager.remove_job(job_id: str)#
Idempotently remove a job from all queues.
- Parameters:
- job_id
str Identifier to purge.
- job_id
- JobPoolManager.can_start_job(resource_monitor: ResourceMonitor) bool#
Boolean predicate that decides whether a new job may be started.
Checks resource limits without violating constraints.
- Parameters:
- resource_monitor
ResourceMonitor Source of current host telemetry.
- resource_monitor
- Returns:
- bool
True→ job may be started,False→ remain queued.
- JobPoolManager.get_queue_stats() Dict[str, Any]#
Real-time snapshot for REST
/queueendpoint.- Returns:
dictQueue statistics with keys: - total_queued: Total jobs in all queues - regular_queue_size: Jobs in normal FIFO queue - priority_queues: Dict of priority -> count - running_jobs: Number of currently running jobs - max_concurrent: Maximum concurrent jobs allowed