Scheduler Module

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.

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.

find_candidate(rsets_by_group, group_list, rsets_req_per_group, max_upper_bound)

Find a candidate slot in a group

get_avail_rsets_by_group()

Return a dictionary of resource set IDs for each group (e.g. node)

If groups are not set they will all be in one group (group 0)

E.g: Say 8 resource sets / 2 nodes GROUP 1: [1,2,3,4] GROUP 2: [5,6,7,8]

calc_rsets_even_grps(rsets_req, max_grpsize, max_groups, extend)

Calculate an even breakdown to best fit rsets_req input

calc_even_split_uneven_groups(rsets_per_grp, ngroups, rsets_req, sorted_lens, max_grps, extend)

Calculate an even breakdown to best fit rsets_req with uneven groups

static get_sorted_lens(avail_rsets)

Get max length of a list value in a dictionary