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 (Optional[Logger]) – The logger where to log information/warning or errors.

as_dict() Dict[str, Union[str, int, wfcommons.common.file.FileLink]]

A JSON representation of the file.

Returns

A JSON object representation of the file.

Return type

Dict[str, Union[str, int, FileLink]]

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: float = 1.0, task_id: Optional[str] = None, category: Optional[str] = None, machine: Optional[wfcommons.common.machine.Machine] = None, program: Optional[str] = None, args: Optional[List[str]] = None, 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: Optional[List[wfcommons.common.file.File]] = None, 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 (float) – Number of cores required by the task.

  • task_id (Optional[str]) – Task unique ID (e.g., ID0000001).

  • category (Optional[str]) – Task category (can be used, for example, to define tasks that use the same program).

  • machine (Optional[Machine]) – Machine on which is the task has been executed.

  • program (Optional[str]) – Program name.

  • args (Optional[List[str]]) – List of task arguments.

  • avg_cpu (Optional[float]) – Average CPU utilization in %.

  • bytes_read (Optional[int]) – Total bytes read in KB.

  • bytes_written (Optional[int]) – Total bytes written in KB.

  • memory (Optional[int]) – Memory (resident set) size of the process in KB.

  • energy (Optional[int]) – Total energy consumption in kWh.

  • avg_power (Optional[float]) – Average power consumption in W.

  • priority (Optional[int]) – Task priority.

  • files (Optional[List[File]]) – List of input/output files used by the task.

  • logger (Optional[Logger]) – The logger where to log information/warning or errors.

as_dict() Dict

A JSON representation of the task.

Returns

A JSON object representation of the task.

Return type

Dict

class wfcommons.common.task.TaskType(value)

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[str, Union[int, str]]

A JSON representation of the machine.

Returns

A JSON object representation of the machine.

Return type

Dict[str, Union[int, str]]

class wfcommons.common.machine.MachineSystem(value)

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 (Optional[str]) – Workflow instance description.

  • wms_name (Optional[str]) – WMS name.

  • wms_version (Optional[str]) – WMS version.

  • wms_url (Optional[str]) – URL for the WMS website.

  • executed_at (Optional[str]) – Workflow start timestamp in the ISO 8601 format.

  • makespan (Optional[int]) – Workflow makespan in seconds.

to_nx_digraph() networkx.classes.digraph.DiGraph
write_dot(dot_file_path: Optional[pathlib.Path] = None) None

Write a dot file of the workflow instance.

Parameters

dot_file_path (Optional[pathlib.Path]) – DOT output file name.

write_json(json_file_path: Optional[pathlib.Path] = None) None

Write a JSON file of the workflow instance.

Parameters

json_file_path (Optional[pathlib.Path]) – JSON output file name.