Skip to content

Commit b70ba08

Browse files
authored
Merge branch 'main' into main
2 parents 793c4dd + a2c62bd commit b70ba08

14 files changed

Lines changed: 522 additions & 59 deletions

.readthedocs.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Read the Docs configuration file for Sphinx projects
2+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3+
4+
# Required
5+
version: 2
6+
7+
# Set the OS, Python version and other tools you might need
8+
build:
9+
os: ubuntu-22.04
10+
tools:
11+
python: "3.11"
12+
13+
# Build documentation in the "docs/" directory with Sphinx
14+
sphinx:
15+
configuration: docs/source/conf.py
16+
17+
python:
18+
install:
19+
- requirements: docs/requirements.txt

docs/requirements.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
11
sphinx>=5.3.0
22
sphinx_rtd_theme>=1.2.0
33
recommonmark>=0.7.1
4+
jsonschema~=3.2.0
5+
matplotlib>=3.3.0
6+
networkx>=2.4
7+
numpy>=1.19.1
8+
python-dateutil>=2.8.1
9+
requests>=2.24.0
10+
scipy>=1.5.2
11+
setuptools>=49.3.1
12+
pyyaml>=5.3.1
13+
pandas>=1.2.4
14+
stringcase>=1.2.0
15+
filelock>=3.6.0

docs/source/dev_api_wfbench.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,16 @@ wfcommons.wfbench.bench
1313
:show-inheritance:
1414
:private-members:
1515
:noindex:
16+
17+
wfcommons.wfbench.translator.nextflow
18+
------------------------------------
19+
20+
.. automodule:: wfcommons.wfbench.translator.nextflow
21+
:members:
22+
:undoc-members:
23+
:show-inheritance:
24+
:private-members:
25+
:noindex:
1626

1727
wfcommons.wfbench.translator.pegasus
1828
------------------------------------

docs/source/dev_api_wfcommons.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
wfcommons.utils
2-
-----------------
2+
---------------
33

44
.. automodule:: wfcommons.utils
55
:members:

docs/source/generating_workflow_benchmarks.rst

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,35 @@ description in :ref:`json-format-label`.
6767
to execute memory-intensive threads. Therefore, it is crucial to ensure that
6868
:code:`stress-ng` is installed on all worker nodes.
6969

70+
Nextflow
71+
++++++++
72+
`Nextflow <https://www.nextflow.io/>`_ is a workflow management system that enables
73+
the development of portable and reproducible workflows. It supports deploying workflows
74+
on a variety of execution platforms including local, HPC schedulers, and cloud-based
75+
and container-based environments. Below, we provide an example on how to generate
76+
workflow benchmark for running with Nextflow:
77+
78+
import pathlib
79+
80+
from wfcommons import BlastRecipe
81+
from wfcommons.wfbench import WorkflowBenchmark, NextflowTranslator
82+
83+
# create a workflow benchmark object to generate specifications based on a recipe
84+
benchmark = WorkflowBenchmark(recipe=BlastRecipe, num_tasks=500)
85+
86+
# generate a specification based on performance characteristics
87+
benchmark.create_benchmark(pathlib.Path("/tmp/"), cpu_work=100, data=10, percent_cpu=0.6)
88+
89+
# generate a Nextflow workflow
90+
translator = NextflowTranslator(benchmark.workflow)
91+
translator.translate(output_file_name=pathlib.Path("/tmp/benchmark-workflow.nf"))
92+
93+
.. warning::
94+
95+
Nextflow's way of defining workflows does not support tasks with iterations i.e. tasks
96+
that depend on another instance of the same abstract task. Thus, the translator
97+
fails when you try to translate a workflow with iterations.
98+
7099
Pegasus
71100
+++++++
72101

docs/source/user_api_common.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
wfcommons.common
2-
==================
2+
================
33

44
wfcommons.common.file
5-
-----------------------
5+
---------------------
66

77
.. automodule:: wfcommons.common.file
88
:members:
@@ -11,7 +11,7 @@ wfcommons.common.file
1111
:private-members:
1212

1313
wfcommons.common.task
14-
-----------------------
14+
---------------------
1515

1616
.. automodule:: wfcommons.common.task
1717
:members:
@@ -20,7 +20,7 @@ wfcommons.common.task
2020
:private-members:
2121

2222
wfcommons.common.machine
23-
--------------------------
23+
------------------------
2424

2525
.. automodule:: wfcommons.common.machine
2626
:members:
@@ -29,7 +29,7 @@ wfcommons.common.machine
2929
:private-members:
3030

3131
wfcommons.common.workflow
32-
---------------------------
32+
-------------------------
3333

3434
.. automodule:: wfcommons.common.workflow
3535
:members:

docs/source/user_api_wfbench.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. _wfcommons-wfbench-label:
22

33
wfcommons.wfbench
4-
================
4+
=================
55

66
.. toctree::
77
:maxdepth: 4
@@ -14,6 +14,13 @@ wfcommons.wfbench.bench
1414
:undoc-members:
1515
:show-inheritance:
1616

17+
wfcommons.wfbench.translator.nextflow
18+
-------------------------------------
19+
20+
.. automodule:: wfcommons.wfbench.translator.nextflow
21+
:members:
22+
:undoc-members:
23+
:show-inheritance:
1724

1825
wfcommons.wfbench.translator.pegasus
1926
------------------------------------

wfcommons/common/task.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -132,33 +132,33 @@ def as_dict(self) -> Dict:
132132
'children': [],
133133
'files': task_files,
134134
}
135-
if self.runtime:
135+
if self.runtime is not None:
136136
task_obj['runtimeInSeconds'] = self.runtime
137-
if self.cores:
137+
if self.cores is not None:
138138
task_obj['cores'] = self.cores
139-
if self.task_id:
139+
if self.task_id is not None:
140140
task_obj['id'] = self.task_id
141-
if self.category:
141+
if self.category is not None:
142142
task_obj['category'] = self.category
143-
if self.avg_cpu:
143+
if self.avg_cpu is not None:
144144
task_obj['avgCPU'] = self.avg_cpu
145-
if self.bytes_read:
145+
if self.bytes_read is not None:
146146
task_obj['readBytes'] = self.bytes_read
147-
if self.bytes_written:
147+
if self.bytes_written is not None:
148148
task_obj['writtenBytes'] = self.bytes_written
149-
if self.memory:
149+
if self.memory is not None:
150150
task_obj['memoryInBytes'] = self.memory
151-
if self.energy:
151+
if self.energy is not None:
152152
task_obj['energy'] = self.energy
153-
if self.avg_power:
153+
if self.avg_power is not None:
154154
task_obj['avgPower'] = self.avg_power
155-
if self.priority:
155+
if self.priority is not None:
156156
task_obj['priority'] = self.priority
157-
if self.program:
157+
if self.program is not None:
158158
task_obj['command']['program'] = self.program
159-
if self.args:
159+
if self.args is not None:
160160
task_obj['command']['arguments'] = self.args
161-
if self.machine:
161+
if self.machine is not None:
162162
task_obj['machine'] = self.machine.name
163163
if self.launch_dir:
164164
task_obj['launchDir'] = self.launch_dir

wfcommons/wfbench/bench.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
22
# -*- coding: utf-8 -*-
33
#
4-
# Copyright (c) 2021-2022 The WfCommons Team.
4+
# Copyright (c) 2021-2023 The WfCommons Team.
55
#
66
# This program is free software: you can redistribute it and/or modify
77
# it under the terms of the GNU General Public License as published by
@@ -79,7 +79,9 @@ def create_benchmark(self,
7979
percent_cpu: Union[float, Dict[str, float]] = 0.6,
8080
cpu_work: Union[int, Dict[str, int]] = None,
8181
gpu_work: Union[int, Dict[str, int]] = None,
82+
time: Optional[int] = None,
8283
data: Optional[Union[int, Dict[str, str]]] = None,
84+
mem: Optional[float] = None,
8385
lock_files_folder: Optional[pathlib.Path] = None,
8486
regenerate: Optional[bool] = True) -> pathlib.Path:
8587
"""Create a workflow benchmark.
@@ -90,8 +92,12 @@ def create_benchmark(self,
9092
:type percent_cpu: Union[float, Dict[str, float]]
9193
:param cpu_work: CPU work per workflow task.
9294
:type cpu_work: Union[int, Dict[str, int]]
95+
:param time: Time limit for running each task (in seconds).
96+
:type time: Optional[int]
9397
:param data: Dictionary of input size files per workflow task type or total workflow data footprint (in MB).
9498
:type data: Optional[Union[int, Dict[str, str]]]
99+
:param mem: Maximum amount of memory consumption per task (in MB).
100+
:type mem: Optional[float]
95101
:param lock_files_folder:
96102
:type lock_files_folder: Optional[pathlib.Path]
97103
:param regenerate: Whether to regenerate the workflow tasks
@@ -150,9 +156,15 @@ def create_benchmark(self,
150156

151157
params.extend([f"--gpu-work {_gpu_work}"])
152158

159+
if mem:
160+
params.extend([f"--mem {mem}"])
161+
162+
if time:
163+
params.extend([f"--time {time}"])
164+
153165
task.runtime = 0
154166
task.files = []
155-
task.program = f"{this_dir.joinpath('wfbench.py')}"
167+
task.program = "wfbench.py"
156168
task.args = [task.name]
157169
task.args.extend(params)
158170

wfcommons/wfbench/translator/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@
1111
from .dask import DaskTranslator
1212
from .pegasus import PegasusTranslator
1313
from .swift_t import SwiftTTranslator
14+
from .nextflow import NextflowTranslator

0 commit comments

Comments
 (0)