hdeeprm.manager module

Defines HDeepRM managers, which are in charge of mapping Jobs to resources.

class hdeeprm.manager.JobScheduler[source]

Bases: object

Selects Jobs from the Job Queue to be processed in the Platform.

The Job selection policy is defined by the sorting key. Only one job is peeked in order to check for sufficient resources available for it.

pending_jobs

Job Queue. All incoming jobs arrive in this data structure.

Type:list
nb_active_jobs

Number of Jobs being served by the Platform.

Type:int
nb_completed_jobs

Number of Jobs already served by the Platform.

Type:int
peeked_job

Cached next Job to be processed. This saves sorting the Job Queue a second time.

Type:batsim.batsim.Job
sorting_key

Key defining the Job selection policy.

Type:function
nb_pending_jobs

Number of pending jobs, equal to the current length of the queue.

Type:int
new_job(job: batsim.batsim.Job) → None[source]

Inserts a new job in the queue.

By default, it is appended to the right end of the queue.

Parameters:job (batsim.batsim.Job) – Incoming Job to be inserted into the Job Queue.
peek_job() → batsim.batsim.Job[source]

Returns a reference to the first selected job.

This is the first Job to be processed given the selected policy. This method does not remove the Job from the Job Queue.

Returns:The reference to the first selected Job.
remove_job() → None[source]

Removes the first selected job from the queue.

It uses the cached peeked Job for removal.

class hdeeprm.manager.ResourceManager[source]

Bases: object

Selects Cores and maintains Core states for serving incoming Jobs.

The Core selection policy is defined by the sorting key. The Core Pool is filtered by this key to obtain the required resources by the Job. Cores have a state, which describes their availability as well as computational capability and power consumption. Core selection might fail if there are not enough available resources for the selected Job.

state_changes

Maps Cores to P-state changes for sending to Batsim

Type:dict
platform

Resource Hierarchy for relations. See Core for fields.

Type:dict
core_pool

Contains all Cores in the Platform for filtering.

Type:list
over_utilization

Tracks over-utilizations of cores, memory capacity and memory bandwidth.

Type:dict
sorting_key

Key defining the Core selection policy.

Type:function
get_resources(job: batsim.batsim.Job, now: float) → procset.ProcSet[source]

Gets a set of resources for the selected job.

State of resources change as they are being selected.

Parameters:
  • job (batsim.batsim.Job) – Job to be served by the selected Cores. Used for checking requirements.
  • now (float) – Current simulation time in seconds.
Returns:

Set of Cores as a ProcSet. None if not enough resources available.

update_state(job: batsim.batsim.Job, id_list: list, new_state: str, now: float) → tuple[source]

Modifies the state of the computing resources.

This affects speed, power and availability for selection. Modifications are local to the Decision System until communicated to the Simulator. Modifying the state of a Core might trigger alterations on Cores in the same Processor or Node scope due to shared resources.

Parameters:
  • job (batsim.batsim.Job) – Job served by the selected Cores. Used for updating resource contention.
  • id_list (list) – IDs of the Cores to be updated directly.
  • new_state (str) – Either “LOCKED” (makes Cores unavailable) or “FREE” (makes Cores available).
  • now (float) – Current simulation time in seconds.
Returns:

A dictionary with all directly and indirectly modified Cores. Keys are the Cores IDs, values are the new P-states.