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

Fixed error in workflow, with the rewrite of the origins + updated the...

Fixed error in workflow, with the rewrite of the origins + updated the xtraction of the origins within an operation
parent dde31389
No related branches found
No related tags found
No related merge requests found
Pipeline #14471 failed with stage
in 2 minutes and 29 seconds
......@@ -64,7 +64,7 @@ EMIT_ALONE = r"(\w+)\s*\.\s*(output|out)[^\w]"
EMIT_ALONE_2 = r"(\w+)\s*\.\s*(output|out)[^\w]"
EMIT_EQUALS = r"\w+\s*=\s*((\w+)\s*\.\s*(output|out))[^\w]"
EMIT_NAME = r'(\w+)\s*\.\s*(output|out)\s*\.\s*(\w+)'
EMIT_OPERATION = r"(\w+)\s*\.\s*(output|out)\s*[^\w]"
EMIT_OPERATION = r"((\w+)\s*\.\s*(output|out))\s*[^\w]"
EMIT_TAB = r'(\w+)\s*\.\s*(output|out)\s*\[\s*(\d+)\s*\]'
TUPLE_EMIT = r'\( *\w+( *\, *\w+)+ *\) *= *'+EMIT_ALONE
......
......@@ -384,18 +384,15 @@ class Operation(Executor):
#TODO -> check this
#I've changed this to avoid problems like this : "ch_svdb_dbs.out_occs.toList()"
for match in re.finditer(constant.EMIT_OPERATION, operation+" "):
full_code, name_called = match.group(0), match.group(1)
#Check that it's a the begining of the operation
operation_until_out = operation[:operation.find("out")]
if(operation_until_out==full_code[:full_code.find("out")]):
self.add_origin_emits(full_code, name_called, "")
case_operation_starts_with_emit = True
full_code, name_called = match.group(1), match.group(2)
self.add_origin_emits(full_code, name_called, "")
#Remove the emit from the operation code -> so we don't extract it agian
operation = operation.replace(full_code, "")
if(not case_operation_starts_with_emit):
#================================
#Case channel1 = channel2.something
#================================
......@@ -471,22 +468,7 @@ class Operation(Executor):
self.add_origin(name)
##================================
##join/ phase/ cross/ combine
##================================
#pattern= r'\.\s*(join|phase|cross|combine)\s*\(([^\)]+)\)'
#for match in re.finditer(pattern, operation):
# name = match.group(2).strip()
# #Case channel
# if(bool(re.fullmatch(r'\w+', name))):
# self.add_origin(name)
# else:
# #check and add if it's an emitted value
# emited = self.check_is_emit(name)
# if(not emited):
# raise Exception(f"I don't know what i'm looking at {name} in {self.get_code()}")
#================================
#merge/ mix/ concat/ spread/ join/ phase/ cross/ combine
#================================
......@@ -530,33 +512,7 @@ class Operation(Executor):
self.add_origin(c.get_name())
#TODO update this -> it's an operation itselfs
warnings.warn(f"I don't know what i'm looking at '{name}' in '{self.get_code()}'\n")
##================================
##merge/ mix/ concat
##================================
#pattern= r'\.\s*(merge|mix|concat)\s*\((\s*\w+\s*\,\s*(\w+\s*\,\s*)*\w+\s*|\s*(\w+)\s*)\)'
#for match in re.finditer(pattern, operation):
# temp=match.group(2)
# temp= temp.split(',')
# for t in temp:
# t= t.strip()
# #Here we create the channel from the name -> checks if it already exists in the workflow
# name = t
# if(bool(re.fullmatch(r'\w+', name))):
# self.add_origin(name)
#
##================================
##spread
##================================
#pattern= r'\.\s*spread\s*\(([\s\w\.(),\"\'\{\}\[\]+-]+)\)'
#for match in re.finditer(pattern, operation):
# #Here we create the channel from the name -> checks if it already exists in the workflow
# name = match.group(1).strip()
# if(bool(re.fullmatch(r'\w+', name))):
# self.add_origin(name)
#self.origins = list(set(origin))
......@@ -958,11 +914,20 @@ class Operation(Executor):
#This is just one value
if(len(c.get_all_conditions())>1):
raise Exception("This shoudn't happen")
for condition in c.get_all_conditions():
new_body+=f"if({condition.get_value().strip()}) {{\n{temporary_channel} = {calls[c][0]}\n}}\n"
new_body+=temporary_channel
code = code.replace(origin, new_body)
conditions = c.get_all_conditions()
if(conditions!=[]):
for condition in conditions:
new_body+=f"if({condition.get_value().strip()}) {{\n{temporary_channel} = {calls[c][0]}\n}}\n"
else:
values = set(calls[c])
if(len(values)>1):
raise Exception("This souldn't happen")
for val in values:
new_body+=f"\n{temporary_channel} = {val}"
#new_body+=temporary_channel
code = code.replace(origin, temporary_channel)
temporary_index+=1
to_add.append(new_body)
to_add.reverse()
for c in to_add:
......
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