Skip to content

Commit f320305

Browse files
authored
Merge pull request #77 from wfcommons/flowcept_improvements
Swift/T with Flowcept
2 parents f7873af + 706f60a commit f320305

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

wfcommons/wfbench/translator/swift_t.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ def _add_tasks(self, category: str) -> None:
217217
if num_tasks > 1:
218218
self.script += f"foreach i in [0:{num_tasks - 1}] {{\n" \
219219
f" string of = sprintf(\"{self.output_folder.absolute()}/data/{category}_%i_output.txt\", i);\n" \
220-
f" string cmd_{self.cmd_counter} = sprintf(command, \"{self.cpu_benchmark}\", \"{category}\", {args});\n" \
220+
f" string task_id = \"{category}_\" + i;\n" \
221+
f" string cmd_{self.cmd_counter} = sprintf(command, \"{self.cpu_benchmark}\", task_id, {args});\n" \
221222
f" string co_{self.cmd_counter} = python_persist(cmd_{self.cmd_counter});\n" \
222223
f" string of_{self.cmd_counter} = sprintf(\"0%s\", co_{self.cmd_counter});\n" \
223224
f" {category}__out[i] = string2int(of_{self.cmd_counter});\n" \
@@ -231,7 +232,7 @@ def _add_tasks(self, category: str) -> None:
231232
self.out_files.add(out_file)
232233
args = args.replace(
233234
", of", f", \"{out_file}\"").replace("[i]", "[0]")
234-
self.script += f"string cmd_{self.cmd_counter} = sprintf(command, \"{self.cpu_benchmark}\", \"{category}\", {args});\n" \
235+
self.script += f"string cmd_{self.cmd_counter} = sprintf(command, \"{self.cpu_benchmark}\", \"{category}_{self.cmd_counter}\", {args});\n" \
235236
f"string co_{self.cmd_counter} = python_persist(cmd_{self.cmd_counter});\n" \
236237
f"string of_{self.cmd_counter} = sprintf(\"0%s\", co_{self.cmd_counter});\n" \
237238
f"{category}__out[0] = string2int(of_{self.cmd_counter});\n\n"

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ workflow_name = "%s"
3131
out_files = [%s]
3232
3333
logging.info("Flowcept Starting")
34-
flowcept_agent = Flowcept(workflow_id=workflow_id, workflow_name=workflow_name, bundle_exec_id=workflow_id)
34+
flowcept_agent = Flowcept(workflow_id=workflow_id, workflow_name=workflow_name, bundle_exec_id=workflow_id, start_persistence=False, save_workflow=True)
3535
3636
try:
3737
flowcept_agent.start()
@@ -51,10 +51,8 @@ while remaining_files:
5151
break
5252
time.sleep(1)
5353
54-
time.sleep(180)
5554
try:
5655
flowcept_agent.stop()
57-
time.sleep(120)
5856
except Exception:
5957
import traceback
6058
traceback.print_exc()
@@ -90,6 +88,7 @@ cpu_threads = int(10 * percent_cpu)
9088
output_data = {"%s": int(%i)}
9189
dep = %i
9290
workflow_id = "%s"
91+
task_id = f"{workflow_id}_{task_name}"
9392
9493
if 'workflow_id':
9594
logging.info("Running with Flowcept.")
@@ -98,7 +97,7 @@ if 'workflow_id':
9897
bundle_exec_id=workflow_id,
9998
start_persistence=False, save_workflow=False)
10099
fc.start()
101-
fc_task = FlowceptTask(workflow_id=workflow_id, used={
100+
fc_task = FlowceptTask(workflow_id=workflow_id, task_id=task_id, used={
102101
'workflow_id': workflow_id,
103102
'name': task_name,
104103
'percent-cpu': percent_cpu,

0 commit comments

Comments
 (0)