Scheduler Module

The scheduler is called within the scope of the allocation function, usually via the alloc_support module function assign_resources() (either called directly or via sim_work() or gen_work()), which is a wrapper for the main scheduler function assign_resources().

The alloc_support module allows users to supply an alternative scheduler that fits this interface. This could be achieved, for example, by inheriting the built-in scheduler and making modifications.

Options can also be provided to the scheduler though the alloc_specs['user']['scheduler_opts'] dictionary.

class resources.scheduler.ResourceScheduler(user_resources=None, sched_opts={})

Calculates and returns resource set ids from a dictionary of resource sets by group. Resource sets available is read from the resources module or from a resources object passed in.

__init__(user_resources=None, sched_opts={})

Initiate a ResourceScheduler object

Parameters
  • user_resources (Resources object, optional) – A resources object. If present overrides the class variable.

  • sched_opts (dict, optional) – A dictionary of scheduler options. Normally passed via alloc_specs[‘user’]

Scheduler Options:

split2fit: boolean, optional

Split across more nodes if space not currently avail (even though can fit when free). Default: True

assign_resources(rsets_req)

Schedule resource sets to a work item if possible

If the resources required are less than one node, they will be allocated to the smallest available sufficient slot.

If the resources required are more than one node, then will attempt to find an even split. If no even split is possible, then enough full nodes will be allocated to cover the requirement.

Returns a list of resource sets ids. A return of None implies insufficient resources.