qcg.pilotjob.scheduler module

class qcg.pilotjob.scheduler.Scheduler(resources)

Bases: object

Resource orchestration.

_resources

available resources

Type:Resources
_scheduler_alg

scheduler algorithm

Type:SchedulerAlgorithm
_active_allocations

currently active allocations

Type:set(Allocation)

Initialize scheduler.

Parameters:resources (Resources) – available resources
allocate_cores(min_cores, max_cores=None)

Create allocation with given number of cores.

Parameters:
  • min_cores (int) – minimum requested number of cores
  • max_cores (int) – maximum requested number of cores, if None ‘min_cores’ will mean also ‘max_cores’
Returns:

created allocation or None if not enough free resources

Return type:

Allocation

Raises:

NotSufficientResources – when there are not enough resources avaiable

allocate_job(resources)

Create allocation for job with given resources.

Parameters:

resources (JobResources) – job’s resource requirements

Returns:

created allocation or None if not enough free resources

Return type:

Allocation

Raises:
  • NotSufficientResources – when there are not enough resources avaiable
  • InvalidResourceSpec – when resource requirements are not valid
release_allocation(alloc)

Release resources assigned for the specificated allocation.

Parameters:alloc (Allocation) – allocation to release
Raises:InvalidAllocation – when the allocation is not registered in the scheduler (it might be released earlier)