wfcommons.common

wfcommons.common.file

class wfcommons.common.file.File(name: str, size: int, link: wfcommons.common.file.FileLink, logger: Optional[logging.Logger] = None)

Bases: object

Representation of a file.

Parameters:
  • name (str) – The name of the file.
  • size (int) – File size in KB.
  • link (FileLink) – Type of file link.
  • logger (Logger) – The logger where to log information/warning or errors.
as_dict() → Dict[KT, VT]

A JSON representation of the file.

Returns:A JSON object representation of the file.
Return type:Dict

Bases: wfcommons.utils.NoValue

Type of file link.

INPUT = 'input'
OUTPUT = 'output'

wfcommons.common.task

class wfcommons.common.task.Task(name: str, task_type: wfcommons.common.task.TaskType, runtime: float, cores: int, machine: Optional[wfcommons.common.machine.Machine] = None, args: List[str] = [], avg_cpu: Optional[float] = None, bytes_read: Optional[int] = None, bytes_written: Optional[int] = None, memory: Optional[int] = None, energy: Optional[int] = None, avg_power: Optional[float] = None, priority: Optional[int] = None, files: List[wfcommons.common.file.File] = [], logger: Optional[logging.Logger] = None)

Bases: object

Representation of a task.

Parameters:
  • name (str) – The name of the task.
  • task_type (TaskType) – The type of the task.
  • runtime (float) – Task runtime in seconds.
  • cores (int) – Number of cores required by the task.
  • machine (Machine) – Machine on which is the task has been executed.
  • args (List[str]) – List of task arguments.
  • avg_cpu (float) – Average CPU utilization in %.
  • bytes_read (int) – Total bytes read in KB.
  • bytes_written (int) – Total bytes written in KB.
  • memory (int) – Memory (resident set) size of the process in KB.
  • energy (int) – Total energy consumption in kWh.
  • avg_power (float) – Average power consumption in W.
  • priority (int) – Task priority.
  • files (List[File]) – List of input/output files used by the task.
  • logger (Logger) – The logger where to log information/warning or errors.
as_dict() → Dict[KT, VT]

A JSON representation of the task.

Returns:A JSON object representation of the task.
Return type:Dict
class wfcommons.common.task.TaskType

Bases: wfcommons.utils.NoValue

Task type.

AUXILIARY = 'auxiliary'
COMPUTE = 'compute'
TRANSFER = 'transfer'

wfcommons.common.machine

class wfcommons.common.machine.Machine(name: str, cpu: Dict[str, Union[int, str]], system: Optional[wfcommons.common.machine.MachineSystem] = None, architecture: Optional[str] = None, memory: Optional[int] = None, release: Optional[str] = None, hashcode: Optional[str] = None, logger: Optional[logging.Logger] = None)

Bases: object

Representation of one compute machine.

Parameters:
  • name (str) – Machine node name.
  • cpu (Dict[str, Union[int, str]]) –

    A dictionary containing information about the CPU specification. Must at least contains two fields: count (number of CPU cores) and speed (CPU speed of each core in MHz).

    cpu = {
        'count': 48,
        'speed': 1200
    }
    
  • system (MachineSystem) – Machine system (linux, macos, windows).
  • architecture (str) – Machine architecture (e.g., x86_64, ppc).
  • memory (int) – Total machine’s RAM memory in KB.
  • release (str) – Machine release.
  • hashcode (str) – MD5 Hashcode for the Machine.
  • logger (Logger) – The logger where to log information/warning or errors.
as_dict() → Dict[KT, VT]

A JSON representation of the machine.

Returns:A JSON object representation of the machine.
Return type:Dict
class wfcommons.common.machine.MachineSystem

Bases: wfcommons.utils.NoValue

Machine system type.

LINUX = 'linux'
MACOS = 'macos'
WINDOWS = 'windows'

wfcommons.common.workflow

class wfcommons.common.workflow.Workflow(name: str, description: Optional[str] = None, wms_name: Optional[str] = None, wms_version: Optional[str] = None, wms_url: Optional[str] = None, executed_at: Optional[str] = None, makespan: Optional[int] = 0.0)

Bases: networkx.classes.digraph.DiGraph

Representation of a workflow. The workflow representation is an extension of the NetworkX DiGraph class.

Parameters:
  • name (str) – Workflow name.
  • description (str) – Workflow trace description.
  • wms_name (str) – WMS name.
  • wms_version (str) – WMS version.
  • wms_url (str) – URL for the WMS website.
  • executed_at (str) – Workflow start timestamp in the ISO 8601 format.
  • makespan (int) – Workflow makespan in seconds.
write_dot(dot_filename: str = None) → None

Write a dot file of the workflow trace.

Parameters:dot_filename (str) – DOT output file name.
write_json(json_filename: Optional[str] = None) → None

Write a JSON file of the workflow trace.

Parameters:json_filename (str) – JSON output file name.