diff --git a/src/operation.py b/src/operation.py index 82b697b0fe28e55057630b94b3632a7bd2c15708..ea2188b2b052e64285b74798ee72a2431514c3bf 100644 --- a/src/operation.py +++ b/src/operation.py @@ -1040,7 +1040,7 @@ class Operation(Executor): # a = ... #} #b = a -> when wanting to rewrite this operation - if(set(types)=={"Channel"}): + elif(set(types)=={"Channel"}): None #operations = {} #for c in dico_origin_2_replace[origin]: diff --git a/src/workflow.py b/src/workflow.py index 9fc7469c09a8107e2d6e76a3ed254f67042166f7..9c0c7362a97598134903db8a91c8ef8e5fbf1697 100644 --- a/src/workflow.py +++ b/src/workflow.py @@ -506,7 +506,10 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen #Remove the includes for match in re.finditer(constant.FULL_INLCUDE_2, code): - code = re.sub(fr"{re.escape(match.group(0))}.*", "", code) + full_include = match.group(0) + for temp in re.finditer(fr"{re.escape(full_include)} *addParams\(", code): + raise BioFlowInsightError("There is an 'addParams' in an include. BioFlow-Insight doesn not how to rewrite this.") + code = re.sub(fr"{re.escape(full_include)}.*", "", code) processes, subworkflows, functions = [], [], [] for c in self.get_workflow_main().get_all_calls_in_workflow(): @@ -807,20 +810,21 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen ternary_operation_dico = self.ternary_operation_dico map_element_dico = self.map_element_dico - if(self.get_DSL()=="DSL1"): - code = self.convert_to_DSL2() - self.rewrite_and_initialise(code, self.processes_2_remove, render_graphs=render_graphs, def_check_the_same = False) - - if(self.get_DSL()=="DSL2"): - code = self.simplify_workflow_code() - self.rewrite_and_initialise(code, self.processes_2_remove, render_graphs=render_graphs) - if(self.duplicate): + if(self.duplicate): #First check if there are any duplicate operations #That method is in the "get_order_execution_executors" method -> so we just run that first self.get_order_execution_executors() - + + if(self.get_DSL()=="DSL1"): + code = self.convert_to_DSL2() + self.rewrite_and_initialise(code, self.processes_2_remove, render_graphs=render_graphs, def_check_the_same = False) + + if(self.get_DSL()=="DSL2"): + code = self.simplify_workflow_code() + self.rewrite_and_initialise(code, self.processes_2_remove, render_graphs=render_graphs) + #DETERMING WHICH SUBWORKFLOWS ARE BROKEN WITH THE CLUSTER def get_clusters_with_calls(clusters): @@ -969,9 +973,13 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen #Adding the anker subworkflow_section = f"//ANKER 4 SUBWORKFLOW DEF" to_replace = "" - for match in re.finditer(r"workflow\s*\w*\s*\{", code): + for match in re.finditer(r"workflow\s+\w*\s*\{", code): to_replace = match.group(0) break + if(to_replace==""): + for match in re.finditer(r"workflow\s*\{", code): + to_replace = match.group(0) + break if(to_replace==""): raise Exception("No call to a workflow") code = code.replace(to_replace, f"{subworkflow_section}\n\n{to_replace}")