Skip to content

Commit 37fa3f1

Browse files
committed
add flowcept
1 parent 8b8c087 commit 37fa3f1

File tree

2 files changed

+14
-22
lines changed

2 files changed

+14
-22
lines changed

wfcommons/wfbench/translator/pycompss.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,13 @@ def translate(self, output_folder: pathlib.Path) -> None:
4646
:type output_folder: pathlib.Path
4747
"""
4848
self.output_folder = output_folder
49-
self.script = "\n# workflow tasks\n"
49+
self.script = ""
50+
# IMPORT Flowcept
51+
if self.workflow.workflow_id is not None:
52+
self.script += "from flowcept.flowcept_api.flowcept_controller import Flowcept\n\n"
53+
5054
# PyCOMPSs translator
55+
self.script += "\n# workflow tasks\n"
5156
self._pycompss_code()
5257

5358
# Generates pycompss workflow file: template + script
@@ -199,4 +204,12 @@ def _pycompss_code(self) -> None:
199204

200205
# CALL TO MAIN METHOD
201206
self.script += f"\n\nif __name__ == \"__main__\":\n"
207+
# START Flowcept
208+
if self.workflow.workflow_id is not None:
209+
self.script += f"\tf = Flowcept(workflow_id='{self.workflow.workflow_id}', workflow_name='{self.workflow.name}', bundle_exec_id='{self.workflow.workflow_id}')\n"
210+
self.script += "\tf.start()\n"
211+
# main
202212
self.script += f"\tmain_program()\n"
213+
# STOP Flowcept
214+
if self.workflow.workflow_id is not None:
215+
self.script += "\tf.stop()\n"
Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,11 @@
1-
# IMPORTS
2-
import sys
31
import os
4-
# PyCOMPSs imports
5-
# All task arguments: https://compss-doc.readthedocs.io/en/stable/Sections/02_App_Development/02_Python/01_1_Task_definition/Sections/04_Task_parameters_summary.html
62
from pycompss.api.task import task
73
from pycompss.api.constraint import constraint
84
from pycompss.api.binary import binary
95
from pycompss.api.mpi import mpi
106
from pycompss.api.parameter import *
11-
# All API functions: https://compss-doc.readthedocs.io/en/stable/Sections/02_App_Development/02_Python/01_2_Synchronization/01_API.html?highlight=compss_open#api-summary
127
from pycompss.api.api import compss_open
138
from pycompss.api.api import compss_wait_on
149
from pycompss.api.api import compss_barrier
1510

16-
# @binary
17-
# @constraint(computing_units=24)
18-
# @mpi(runner="mpirun", binary="gmx_mpi", computing_nodes=1)
19-
# @task
20-
# def task_id():
21-
# pass
22-
#
23-
# def main_program(arg1, arg2):
24-
# # Execute task
25-
# task_id()
26-
#
27-
# if __name__ == "__main__":
28-
# arg1 = sys.argv[1]
29-
# arg2 = sys.argv[2]
30-
# main_program(arg1, arg2)
31-
3211
# Generated code goes here

0 commit comments

Comments
 (0)