Skip to content
Snippets Groups Projects
Commit 4976c876 authored by George Marchment's avatar George Marchment
Browse files

Added filter to flag when there are duplicate subworkflows -> in that case i cannot rewritte it

parent 55ae000f
No related branches found
No related tags found
No related merge requests found
Pipeline #14528 failed with stage
in 2 minutes and 46 seconds
......@@ -419,10 +419,22 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
nb_2_select = int(alpha*len(processes_called))
sampled = random.sample(set(processes_called), nb_2_select)
def get_object(address):
address = int(re.findall(r"\dx\w+", address)[0], base=16)
return ctypes.cast(address, ctypes.py_object).value
edges_create_cycles_names = []
for e in edges_create_cycles:
n1, n2 = e
obj1, obj2 = get_object(n1), get_object(n2)
edges_create_cycles_names.append((obj1.get_alias(), obj2.get_alias()))
sampled_str = []
for s in sampled:
sampled_str.append(str(s))
for e in edges_create_cycles:
sampled_str.append(s.get_alias())
for e in edges_create_cycles_names:
if(e[0] in sampled_str and e[1] in sampled_str):
#So that means there are the 2 nodes which form the cycle edge in the relevant processes
#-> it means we need to regenerated relevant processes
......@@ -788,6 +800,15 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
return match.group(1)
return re.sub(f"(\w+)_GG_\d+", replacer, code)
def check_multiple_subworkflow(self):
seen= []
for sub in self.get_subworkflows_called():
if(sub.get_code() in seen):
raise BioFlowInsightError(f"The subworkflow '{sub.get_name()}' is called multiple times in the workflow, I cannot rewritte it. Try defining the workflow in a different way.", type="Rewrite Error")
else:
seen.append(sub.get_code())
#Method which rewrites the workflow follwong the user view
#Conert workflow to user_view only makes sense when the option duplicate is activated -> otherwise is doesn't make sense + it makes the analysis way more complicated
def convert_workflow_2_user_view(self, relevant_processes = [], render_graphs = True):
......@@ -814,6 +835,7 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
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.check_multiple_subworkflow()
self.get_order_execution_executors()
if(self.get_DSL()=="DSL1"):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment