@@ -74,14 +74,18 @@ def translate(self, output_folder: pathlib.Path) -> None:
7474 # defining input files
7575 self .logger .debug ("Defining input files" )
7676 in_count = 0
77- self .script = f"string root_in_files[];\n "
77+ self .output_folder = output_folder
78+ self .cpu_benchmark = output_folder .joinpath ("./bin/cpu-benchmark" ).absolute ()
79+ self .script = f"string fs = sprintf(flowcept_start, \" { self .workflow .workflow_id } \" , \" { self .workflow .name } \" );\n string fss = python_persist(fs);\n \n " if self .workflow .workflow_id else ""
80+ self .script += "string root_in_files[];\n "
7881
7982 for task_name in self .root_task_names :
8083 task = self .tasks [task_name ]
8184 for file in task .input_files :
8285 if task .name not in self .categories_input .keys ():
8386 self .categories_input [task .name ] = in_count
84- self .script += f"root_in_files[{ in_count } ] = \" { file .file_id } \" ;\n "
87+ in_file = output_folder .joinpath (f"./data/{ file .file_id } " ).absolute ()
88+ self .script += f"root_in_files[{ in_count } ] = \" { in_file } \" ;\n "
8589 in_count += 1
8690 self .files_map [file .file_id ] = f"ins[{ in_count } ]"
8791
@@ -96,6 +100,10 @@ def translate(self, output_folder: pathlib.Path) -> None:
96100 for category in self .categories_list :
97101 self ._add_tasks (category )
98102
103+ # flowcept stop
104+ # if self.workflow.workflow_id:
105+ # self.script += "string fss = sprintf(flowcept_stop);\npython_persist(fss);"
106+
99107 run_workflow_code = self ._merge_codelines ("templates/swift_t_templates/workflow.swift" , self .script )
100108
101109 # write benchmark files
@@ -197,27 +205,28 @@ def _add_tasks(self, category: str) -> None:
197205 num_tasks += 1
198206
199207 cats = " + " .join (f"{ k } __out[{ v - 1 } ]" for k , v in input_files_cat .items ())
200- in_str = ", " .join (f"{ k } __ { v } " for k , v in input_files_cat .items ())
208+ in_str = ", " .join (f"{ k } _ { v - 1 } _output.txt " for k , v in input_files_cat .items ())
201209 if "ins[" in cats :
202210 cats = "0"
203211 in_str = ""
204212 self .script += f"int dep_{ self .cmd_counter } = { cats } ;\n "
205213 args += f", dep_{ self .cmd_counter } "
206- self .script += f"string { category } _in = \" { in_str } \" ;\n "
214+ args += f", \" { self .workflow .workflow_id } \" , fss" if self .workflow .workflow_id else ", \" \" "
215+ self .script += f"string { category } _in = \" { self .output_folder .absolute ()} /data/{ in_str } \" ;\n "
207216
208217 if num_tasks > 1 :
209218 self .script += f"foreach i in [0:{ num_tasks - 1 } ] {{\n " \
210- f" string of = sprintf(\" { category } _%i_output.txt\" , i);\n " \
211- f" string cmd_{ self .cmd_counter } = sprintf(command, \" { category } \" , { args } );\n " \
219+ 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 " \
212221 f" string co_{ self .cmd_counter } = python_persist(cmd_{ self .cmd_counter } );\n " \
213222 f" string of_{ self .cmd_counter } = sprintf(\" 0%s\" , co_{ self .cmd_counter } );\n " \
214223 f" { category } __out[i] = string2int(of_{ self .cmd_counter } );\n " \
215224 "}\n \n "
216225
217226 else :
218227 args = args .replace (
219- ", of" , f", \" { category } _0_output.txt\" " ).replace ("[i]" , "[0]" )
220- self .script += f"string cmd_{ self .cmd_counter } = sprintf(command, \" { category } \" , { args } );\n " \
228+ ", of" , f", \" { self . output_folder . absolute () } /data/ { category } _0_output.txt\" " ).replace ("[i]" , "[0]" )
229+ self .script += f"string cmd_{ self .cmd_counter } = sprintf(command, \" { self . cpu_benchmark } \" , \" { category } \" , { args } );\n " \
221230 f"string co_{ self .cmd_counter } = python_persist(cmd_{ self .cmd_counter } );\n " \
222231 f"string of_{ self .cmd_counter } = sprintf(\" 0%s\" , co_{ self .cmd_counter } );\n " \
223232 f"{ category } __out[0] = string2int(of_{ self .cmd_counter } );\n \n "
0 commit comments