Skip to content

Commit 9a10538

Browse files
committed
swift/t with flowcept
1 parent 046c3dd commit 9a10538

2 files changed

Lines changed: 11 additions & 10 deletions

File tree

wfcommons/wfbench/translator/swift_t.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,8 @@ def translate(self, output_folder: pathlib.Path) -> None:
103103

104104
# flowcept end
105105
if self.workflow.workflow_id:
106-
out_files = ", ".join(f'"{item}"' for item in self.out_files)
107-
self.script += f"string out_files[] = [{out_files}];\n"
108-
self.script += f"string fc = sprintf(flowcept, \"{self.workflow.workflow_id}\", \"{self.workflow.name}\", out_files);\n" \
106+
out_files = ", ".join(f"'{item}'" for item in self.out_files)
107+
self.script += f"string fc = sprintf(flowcept, \"{self.workflow.workflow_id}\", \"{self.workflow.name}\", \"{out_files}\");\n" \
109108
"python_persist(fc);\n"
110109

111110
run_workflow_code = self._merge_codelines("templates/swift_t_templates/workflow.swift", self.script)

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

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ time.sleep(30)
1414
global const string flowcept =
1515
"""
1616
import logging
17+
import pathlib
1718
import subprocess
1819
import time
1920
from flowcept.flowcept_api.flowcept_controller import Flowcept
20-
from pathlib import Path
2121
2222
logging.basicConfig(
2323
level=logging.INFO,
@@ -26,9 +26,9 @@ logging.basicConfig(
2626
handlers=[logging.StreamHandler()]
2727
)
2828
29-
workflow_id = "%s"
29+
workflow_id = "%s"
3030
workflow_name = "%s"
31-
out_files = "%A"
31+
out_files = [%s]
3232
3333
logging.info("Flowcept Starting")
3434
flowcept_agent = Flowcept(workflow_id=workflow_id, workflow_name=workflow_name, bundle_exec_id=workflow_id)
@@ -42,13 +42,15 @@ except Exception:
4242
remaining_files = set(out_files)
4343
4444
while remaining_files:
45-
found_files = {f for f in remaining_files if Path(f).exists()}
46-
if found_files:
47-
remaining_files -= found_files
45+
found_files = set()
46+
for f in remaining_files:
47+
if pathlib.Path(f).exists():
48+
found_files.add(f)
49+
remaining_files -= found_files
4850
if not remaining_files:
4951
break
5052
time.sleep(1)
51-
53+
5254
time.sleep(240)
5355
try:
5456
flowcept_agent.stop()

0 commit comments

Comments
 (0)