Skip to content

Commit 9d172ae

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

2 files changed

Lines changed: 16 additions & 25 deletions

File tree

wfcommons/wfbench/translator/swift_t.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ 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 = f"string fs = sprintf(flowcept_start, \"{self.workflow.workflow_id}\");\npython_persist(fs);\n\n" if self.workflow.workflow_id else ""
80-
self.script += "string root_in_files[];\n"
79+
self.script = "string root_in_files[];\n"
8180

8281
for task_name in self.root_task_names:
8382
task = self.tasks[task_name]
@@ -100,10 +99,6 @@ def translate(self, output_folder: pathlib.Path) -> None:
10099
for category in self.categories_list:
101100
self._add_tasks(category)
102101

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

109104
# write benchmark files

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

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,6 @@ import python;
44
import string;
55
import unix;
66

7-
string flowcept_start =
8-
"""
9-
workflow_id = "%s"
10-
from flowcept import Flowcept, FlowceptTask
11-
flowcept_agent = Flowcept(workflow_id=workflow_id,
12-
bundle_exec_id=workflow_id,
13-
start_persistence=False, save_workflow=False)
14-
flowcept_agent.start()
15-
flowcept_task = FlowceptTask(workflow_id=workflow_id, used={
16-
"workflow_id": workflow_id
17-
})
18-
""";
19-
20-
string flowcept_stop =
21-
"""
22-
flowcept_task.end()
23-
flowcept_agent.stop()
24-
""";
25-
267
string command =
278
"""
289
import logging
@@ -51,6 +32,17 @@ output_data = {"%s": int(%i)}
5132
dep = %i
5233
workflow_id = "%s"
5334
35+
if 'workflow_id':
36+
loggin.info("Running with Flowcept.")
37+
from flowcept import Flowcept, FlowceptTask
38+
fc = Flowcept(workflow_id=args.workflow_id,
39+
bundle_exec_id=args.workflow_id,
40+
start_persistence=False, save_workflow=False)
41+
fc.start()
42+
fc_task = FlowceptTask(workflow_id=args.workflow_id, used={
43+
'workflow_id': workflow_id
44+
})
45+
5446
logging.info(f"Starting {task_name} Benchmark on {socket.gethostname()}")
5547
5648
procs = []
@@ -179,6 +171,10 @@ if cpu_work > 0:
179171
logging.debug("Completed CPU and Memory Benchmarks!")
180172
181173
logging.info(f"Benchmark {task_name} completed!")
174+
175+
if 'workflow_id':
176+
fc_task.end()
177+
fc.stop()
182178
""";
183179

184180
# Generated code goes here

0 commit comments

Comments
 (0)