Workload

Workload Definition Module.

class lorien.workload.Workload

The workload base class that can be used to create a tuning task.

classmethod from_task(task: Any) lorien.workload.Workload

Create a workload from a tuning task.

Parameters

task (Any) -- The tuning task for the workload.

Returns

workload -- The initialized workload.

Return type

Workload

get_log_file_name() str

Log file name is encoded as <workload SHA2 code>-<random code>.json

Parameters

workload (Workload) -- The target workload.

Returns

log_file_name -- The generated log file name.

Return type

str

get_workload_key() str

Get the primary key of this workload in DB.

Returns

key -- The primary key of this workload to index the records in DB.

Return type

str

hash_sha2() str

Hash this workload with SHA256 algorithm to be a unique 64-byte string.

Returns

code -- A 64-byte string.

Return type

str

mutate(rules: Any) Sequence[lorien.workload.Workload]

Mutate workload arguments with the given rules.

Parameters
  • workload (Workload) -- The workload to be mutated.

  • rules (Any) -- The mutation rules that can be customized.

Returns

workloads -- The mutated workloads.

Return type

Sequence[Workload]

to_job()

Create a job to tune this workload.

Returns

job -- The created job.

Return type

Job

to_task() Any

Create a tuning task from this workload.

Returns

task -- Return the created task, or raise RuntimeError if failed.

Return type

Any