"""Simulation-only workflow applications generated with `WfCommons <https://wfcommons.org/>`_.
The builder generates a task-dependency DAG and converts it into an ECLYPSE
application graph for simulation. It does not expose MPI/REST service logic or
emulation support. Workflow task metadata is instead mapped directly onto the
default ECLYPSE node and edge assets, which are always included.
WfCommons file-size metadata is normalised from bytes to MiB when it is mapped
onto ECLYPSE ``storage`` and ``bandwidth`` assets.
"""
from __future__ import annotations
from typing import TYPE_CHECKING
from ._helpers import build_workflow_application
from .base_method import WorkflowBaseMethod
if TYPE_CHECKING:
from eclypse.graph import Application
from eclypse.graph.assets import Asset
from eclypse.utils.types import (
InitPolicy,
UpdatePolicies,
)
from .workflow_family import WorkflowFamily
[docs]
def get_workflow(
workflow: WorkflowFamily | str,
num_tasks: int | None = None,
data_footprint: int | None = 0,
exclude_graphs: set[str] | None = None,
runtime_factor: float | None = 1.0,
input_file_size_factor: float | None = 1.0,
output_file_size_factor: float | None = 1.0,
base_method: WorkflowBaseMethod | str = WorkflowBaseMethod.ERROR_TABLE,
workflow_name: str | None = None,
application_id: str | None = None,
update_policies: UpdatePolicies = None,
node_assets: dict[str, Asset] | None = None,
edge_assets: dict[str, Asset] | None = None,
requirement_init: InitPolicy = "min",
flows: list[list[str]] | str = "default",
seed: int | None = None,
) -> Application:
"""Create a simulation-only workflow application generated by `WfCommons <https://wfcommons.org/>`_.
The returned application is graph-only: it contains task nodes, dependency
edges, and root-to-leaf flows for simulation, but it does not instantiate
executable services or communication interfaces for emulation.
WfCommons file-size metadata is mapped onto ECLYPSE ``storage`` and
``bandwidth`` assets in MiB.
Args:
workflow (WorkflowFamily | str):
Workflow family to generate. Supported values are the members of
:class:`~eclypse.builders.workflow.workflow_family.WorkflowFamily`,
such as ``WorkflowFamily.MONTAGE`` or ``"montage"``.
num_tasks (int | None):
Target number of tasks for the generated workflow. When omitted,
the minimum valid size supported by the selected WfCommons
workflow family is used.
data_footprint (int | None):
Total workflow data footprint requested from WfCommons.
exclude_graphs (set[str] | None):
Optional set of WfCommons graph identifiers to exclude during
generation.
runtime_factor (float | None):
Scaling factor applied to generated task runtimes.
input_file_size_factor (float | None):
Scaling factor applied to generated task input file sizes.
output_file_size_factor (float | None):
Scaling factor applied to generated task output file sizes.
base_method (WorkflowBaseMethod | str):
Base graph selection strategy used by WfCommons. Supported values
are the members of
:class:`~eclypse.builders.workflow.base_method.WorkflowBaseMethod`,
such as ``WorkflowBaseMethod.ERROR_TABLE`` or ``"error_table"``.
workflow_name (str | None):
Optional workflow instance name forwarded to WfCommons.
application_id (str | None):
Optional ECLYPSE application identifier. If omitted, the generated
workflow name is reused.
update_policies (UpdatePolicies):
Graph update policies executed during ``evolve()``.
node_assets (dict[str, Asset] | None):
Additional node asset definitions merged with the default ECLYPSE
node assets. Default assets are always included, and workflow
``storage`` is normalised to MiB from WfCommons byte counts.
edge_assets (dict[str, Asset] | None):
Additional edge asset definitions merged with the default ECLYPSE
edge assets. Default assets are always included, and workflow
dependency ``bandwidth`` is normalised to MiB from WfCommons byte
counts.
requirement_init (InitPolicy):
Initialisation strategy applied to workflow node and edge assets.
flows (list[list[str]] | str):
Workflow flows to install on the application. Use ``"default"`` to
derive root-to-leaf flows from the generated DAG.
seed (int | None):
Seed used both for ECLYPSE graph initialisation and to stabilise
WfCommons workflow generation through Python's random module.
Returns:
Application: The generated workflow application.
"""
return build_workflow_application(
workflow=workflow,
num_tasks=num_tasks,
data_footprint=data_footprint,
exclude_graphs=exclude_graphs,
runtime_factor=runtime_factor,
input_file_size_factor=input_file_size_factor,
output_file_size_factor=output_file_size_factor,
base_method=base_method,
workflow_name=workflow_name,
application_id=application_id,
update_policies=update_policies,
node_assets=node_assets,
edge_assets=edge_assets,
requirement_init=requirement_init,
flows=flows,
seed=seed,
)
__all__ = ["get_workflow"]