Jobs

class batsim_py.jobs.ComposedJobProfile(name, profiles, repeat=1)[source]

Bases: batsim_py.jobs.JobProfile

Batsim Composed Job Profile class.

This class describes a job that executes a sequence of profiles.

Parameters
  • name (str) – The profile name. Must be unique within a workload.

  • profiles (Sequence[str]) – The profile names to execute sequentially.

  • repeat (int) – The number of times to repeat the sequence. Defaults to 1.

Raises

ValueError – In case of repeat argument is less than 1 or profiles list is empty.

Examples

>>> composed = ComposedJobProfile("composed", profiles=["p1", "p2"], repeat=2)
property profiles

The sequence of profiles to execute.

Return type

Sequence[str]

property repeat

The number of times to repeat the profile sequence.

Return type

int

class batsim_py.jobs.DataStagingJobProfile(name, nb_bytes, src, dest)[source]

Bases: batsim_py.jobs.JobProfile

Batsim Data Staging Job Profile class.

This class describes a job that represents an IO transfer between two storage resources.

Parameters
  • name (str) – The profile name. Must be unique within a workload.

  • nb_bytes (float) – The amount of bytes to be transferred.

  • src (str) – The sending storage label (source).

  • dest (str) – The receiving storage label (destination).

Raises

ValueError – In case of nb_bytes argument is not greater than or equal to zero and src or dest arguments are not valid strings.

Examples

>>> data = DataStagingJobProfile("data", nb_bytes=10e6, src="pfs", dest="nfs")
property dest

The receiving storage label.

Return type

str

property nb_bytes

The amount of bytes to be transferred.

Return type

float

property src

The sending storage label.

Return type

str

class batsim_py.jobs.DelayJobProfile(name, delay)[source]

Bases: batsim_py.jobs.JobProfile

Batsim Delay Job Profile class.

This class describes a job that will sleep during the defined time.

Parameters
  • name (str) – The profile name. Must be unique within a workload.

  • delay (float) – The sleep time.

Raises

ValueError – In case of delay is not greater than zero.

Examples

A job that will sleep for 100 seconds.

>>> profile = DelayJobProfile(name="delay", delay=100)
property delay

The sleep time.

Return type

float

class batsim_py.jobs.Job(name, workload, res, profile, subtime, walltime=None, user_id=None)[source]

Bases: object

This class describes a rigid job.

Parameters
  • name (str) – The job name. Must be unique within a workload.

  • workload (str) – The job workload name.

  • res (int) – The number of resources requested.

  • profile (JobProfile) – The job profile to be executed.

  • subtime (float) – The submission time.

  • walltime (Optional[float]) – The execution time limit (maximum execution time). Defaults to None.

  • user_id (Optional[int]) – The user id. Defaults to None.

Raises

ValueError – In case of invalid arguments value.

property allocation

The allocated resource ids.

Return type

Optional[Sequence[int]]

property id

The job ID.

Return type

str

property is_finished

Whether this job has finished or not.

Return type

bool

property is_rejected

Whether this job was rejected or not.

Return type

bool

property is_runnable

Whether this job is able to start or not.

Return type

bool

property is_running

Whether this job is running or not.

Return type

bool

property is_submitted

Whether this job was submitted or not.

Return type

bool

property name

The job name.

Return type

str

property per_processor_slowdown

The job per-processor slowdown.

Return type

Optional[float]

property profile

The job profile.

Return type

JobProfile

property res

The number of resources requested.

Return type

int

property runtime

The job runtime.

The minimum value is 1 second.

Return type

Optional[float]

property slowdown

The job slowdown.

Return type

Optional[float]

property start_time

The job start time.

Return type

Optional[float]

property state

The current job state.

Return type

JobState

property stop_time

The job stop time.

Return type

Optional[float]

property storage_mapping

The job storage mapping.

Return type

Optional[Dict[str, int]]

property stretch

The job stretch.

Return type

Optional[float]

property subtime

The job submission time.

Return type

float

property turnaround_time

The job turnaround time.

Return type

Optional[float]

property user_id

The user id.

Return type

Optional[int]

property waiting_time

The job waiting time.

Return type

Optional[float]

property walltime

The job maximum execution time.

Return type

Optional[float]

property workload

The job workload name.

Return type

str

class batsim_py.jobs.JobProfile(name)[source]

Bases: abc.ABC

Batsim Job Profile base class.

Parameters

name (str) – The profile name. Must be unique within a workload.

property name

The profile’s name.

Return type

str

class batsim_py.jobs.JobState(value)[source]

Bases: enum.Enum

Batsim Job State Types

class batsim_py.jobs.ParallelHomogeneousJobProfile(name, cpu, com)[source]

Bases: batsim_py.jobs.JobProfile

Batsim Parallel Homogeneous Job Profile class.

This class describes a job that performs the same computation and communication on all allocated hosts.

Parameters
  • name (str) – The profile name. Must be unique within a workload.

  • cpu (float) – The amount of flops to be computed on each allocated host.

  • com (float) – The amount of bytes to be sent and received between each pair of hosts. The loopback communication of each machine defaults to 0.

Raises

ValueError – In case of com or cpu are not greater than zero.

Examples

>>> profile = ParallelHomogeneousJobProfile("name", cpu=10e6, com=5e6)
property com

The amount of bytes to be transferred between hosts.

Return type

float

property cpu

The amount of flops to be computed on each host.

Return type

float

class batsim_py.jobs.ParallelHomogeneousPFSJobProfile(name, bytes_to_read, bytes_to_write, storage)[source]

Bases: batsim_py.jobs.JobProfile

Batsim Homogeneous Job with IO to/from PFS Profile class.

This class describes a job that represents an IO transfer between the allocated hosts and a storage resource.

Parameters
  • name (str) – The profile name. Must be unique within a workload.

  • bytes_to_read (float) – The amount of bytes to read.

  • bytes_to_write (float) – The amount of bytes to write.

  • storage (str) – The storage resource label.

Raises

ValueError – In case of bytes_to_read or bytes_to_write are not greater than zero or storage is not a valid string.

Examples

>>> pfs = ParallelHomogeneousPFSJobProfile("pfs", bytes_to_read=10e6, bytes_to_write=1e6, storage="pfs")
property bytes_to_read

The amount of bytes to read.

Return type

float

property bytes_to_write

The amount of bytes to write.

Return type

float

property storage

The storage label.

Return type

str

class batsim_py.jobs.ParallelHomogeneousTotalJobProfile(name, cpu, com)[source]

Bases: batsim_py.jobs.JobProfile

Batsim Parallel Homogeneous Total Job Profile class.

This class describes a job that equally distributes the total amount of computation and communication between the allocated hosts.

Parameters
  • name (str) – The profile name. Must be unique within a workload.

  • cpu (float) – The total amount of flops to be computed on all hosts.

  • com (float) – The total amount of bytes to be sent and received on each pair of hosts.

Raises

ValueError – In case of com or cpu are not greater than zero.

Examples

>>> profile = ParallelHomogeneousTotalJobProfile("name", cpu=10e6, com=5e6)
property com

The total amount of bytes to be sent and received.

Return type

float

property cpu

The total amount of flops to be computed.

Return type

float

class batsim_py.jobs.ParallelJobProfile(name, cpu, com)[source]

Bases: batsim_py.jobs.JobProfile

Batsim Parallel Job Profile class.

This class describes a job that performs a set of computations and communications on the allocated hosts.

Parameters
  • name (str) – The profile name. Must be unique within a workload.

  • cpu (Sequence[float]) – A list that defines the amount of flops to be computed on each allocated host.

  • com (Sequence[float]) – A list [host x host] that defines the amount of bytes to be transferred between the allocated hosts.

Raises

ValueError – In case of cpu is not provided or com has an invalid size or their values are less than zero.

Examples

Two hosts computing 10E6 flops each with local communication only.

>>> profile = ParallelJobProfile(name="parallel", cpu=[10e6, 10e6], com=[5e6, 0, 0, 5e6])

Two hosts computing 2E6 flops each with host 1 sending 5E6 bytes to host 2.

>>> profile = ParallelJobProfile(name="parallel", cpu=[2e6, 2e6], com=[0, 5e6, 0, 0])

One host computing 2E6 flops with host 1 sending 5E6 bytes to host 2 and host 2 sending 10E6 bytes to host 1.

>>> profile = ParallelJobProfile(name="parallel", cpu=[2e6, 0], com=[0, 5e6, 10e6, 0])
property com

The amount of bytes to be transferred between hosts.

Return type

Sequence[float]

property cpu

The amount of flops to be computed on each host.

Return type

Sequence[float]