Skip to content

Commit 4ce89e2

Browse files
committed
adding flowcept and IO for swift/t
1 parent 9d172ae commit 4ce89e2

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

wfcommons/wfbench/translator/swift_t.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ def translate(self, output_folder: pathlib.Path) -> None:
7676
in_count = 0
7777
self.output_folder = output_folder
7878
self.cpu_benchmark = output_folder.joinpath("./bin/cpu-benchmark").absolute()
79-
self.script = "string root_in_files[];\n"
79+
self.script = f"string fs = sprintf(flowcept_start, \"{self.workflow.workflow_id}\");\nstring fss = python_persist(fs);\n\n" if self.workflow.workflow_id else ""
80+
self.script += "string root_in_files[];\n"
8081

8182
for task_name in self.root_task_names:
8283
task = self.tasks[task_name]
@@ -99,6 +100,10 @@ def translate(self, output_folder: pathlib.Path) -> None:
99100
for category in self.categories_list:
100101
self._add_tasks(category)
101102

103+
# flowcept stop
104+
# if self.workflow.workflow_id:
105+
# self.script += "string fss = sprintf(flowcept_stop);\npython_persist(fss);"
106+
102107
run_workflow_code = self._merge_codelines("templates/swift_t_templates/workflow.swift", self.script)
103108

104109
# write benchmark files
@@ -206,7 +211,7 @@ def _add_tasks(self, category: str) -> None:
206211
in_str = ""
207212
self.script += f"int dep_{self.cmd_counter} = {cats};\n"
208213
args += f", dep_{self.cmd_counter}"
209-
args += f", \"{self.workflow.workflow_id}\"" if self.workflow.workflow_id else ", \"\""
214+
args += f", \"{self.workflow.workflow_id}\", fss" if self.workflow.workflow_id else ", \"\""
210215
self.script += f"string {category}_in = \"{self.output_folder.absolute()}/data/{in_str}\";\n"
211216

212217
if num_tasks > 1:

wfcommons/wfbench/translator/templates/swift_t_templates/workflow.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@ import python;
44
import string;
55
import unix;
66

7+
global const string flowcept_start =
8+
"""
9+
workflow_id = "%s"
10+
from flowcept.flowcept_api.flowcept_controller import Flowcept
11+
flowcept_agent = Flowcept(workflow_id=workflow_id, workflow_name="Blast-Benchmark", bundle_exec_id=workflow_id)
12+
flowcept_agent.start()
13+
"""
14+
715
string command =
816
"""
917
import logging
@@ -33,7 +41,7 @@ dep = %i
3341
workflow_id = "%s"
3442
3543
if 'workflow_id':
36-
loggin.info("Running with Flowcept.")
44+
logging.info("Running with Flowcept.")
3745
from flowcept import Flowcept, FlowceptTask
3846
fc = Flowcept(workflow_id=args.workflow_id,
3947
bundle_exec_id=args.workflow_id,

0 commit comments

Comments
 (0)