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

Added horizontal generation + update the rewrite of operations so that there...

Added horizontal generation + update the rewrite of operations so that there can be multiple emits be rewritten
parent 0e7fe30a
No related branches found
No related tags found
No related merge requests found
Pipeline #14519 failed with stage
in 2 minutes and 14 seconds
......@@ -141,8 +141,10 @@ def fill_dot_2(dot, dico, label_node = True, label_edge = True):
def generate_pos_graph(filename, dico, relevant_nodes = -1):
dot = graphviz.Digraph()
dot.attr(rankdir='LR')
fill_dot(dot, dico, False, False)
dot.format = 'dot'
dot.render(filename=f'{filename}_pos')
dot.render(filename=f'{filename}_pos', outfile=f'{filename}_pos.png')
......
......@@ -667,14 +667,18 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
for exe in all_executors:
#We don't need to check the case call since the workflow has already been rewriteen -> emits only appear in operations
if(exe.get_type()=="Operation"):
added = False
new = exe.get_code(get_OG = True)
for emited in exe.get_origins():
if(emited.get_type()=="Emitted"):
if(emited.get_emitted_by().get_first_element_called()==subworklfow):
if(emited.get_emits() not in emits):
raise Exception("This shoudn't happen -> since it is the actual subworkflow")
new = exe.get_code(get_OG = True).replace(emited.get_code(), emited.get_emits().get_origins()[0].get_code())
new = new.replace(emited.get_code(), emited.get_emits().get_origins()[0].get_code())
added = True
#to_replace.append((exe.get_code(get_OG = True), f"{exe.get_gives()[0].get_code()} = {emited.get_emits().get_origins()[0].get_code()}"))
to_replace.append((exe.get_code(get_OG = True), new))
if(added):
to_replace.append((exe.get_code(get_OG = True), new))
#This dictionnary is used to check if the replacement has already been done (in the case of dupliactes in new)
dico_replace = {}
for r in to_replace:
......@@ -698,6 +702,9 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
#code = code.replace(old, new)
code = replace_group1(code, fr"({re.escape(old)})[^\w]", new)
if(temp_code==code):
#print(code)
#print("old", f'"{old}"')
#print("new", f'"{new}"')
raise Exception("Something went wrong: The code hasn't changed")
return code
......
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