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

Runs on all test workflows + small bug on hackathon

parent 29a8d2b9
No related branches found
No related tags found
No related merge requests found
Pipeline #14345 failed with stage
in 2 minutes and 31 seconds
...@@ -61,6 +61,16 @@ class Block(Root): ...@@ -61,6 +61,16 @@ class Block(Root):
if(o.get_type()=="Call"): if(o.get_type()=="Call"):
tab.append(o) tab.append(o)
return tab return tab
#These are the calls from different blocks on the same level
def get_calls_from_other_blocks_on_same_level(self):
tab = []
for block in self.origin.get_blocks():
#TODO perhaps add a verification for blocks with totally different codnitions eg A and !A
if(block!=self):
tab+=block.get_calls_same_level()
tab+=block.get_calls_inside_level()
return tab
############# #############
# CHANNELS # CHANNELS
...@@ -68,12 +78,22 @@ class Block(Root): ...@@ -68,12 +78,22 @@ class Block(Root):
def get_channels_above_level_rec(self, dico = {}): def get_channels_above_level_rec(self, dico = {}):
for c in self.channels: for c in self.channels:
dico[c] = '' dico[c] = ''
self.origin.get_channel_from_name_above_level_rec(dico) self.origin.get_channels_above_level_rec(dico)
def get_channels_above_level(self, dico = {}): def get_channels_above_level(self, dico = {}):
dico = {} dico = {}
self.origin.get_channels_above_level_rec(dico) self.origin.get_channels_above_level_rec(dico)
return list(dico.keys()) return list(dico.keys())
#These are the channels from different blocks on the same level
def get_channels_from_other_blocks_on_same_level(self):
tab = []
for block in self.origin.get_blocks():
#TODO perhaps add a verification for blocks with totally different codnitions eg A and !A
if(block!=self):
tab+=block.get_channels_same_level()
tab+=block.get_channels_inside_level()
return tab
#def check_in_channels(self, channel): #def check_in_channels(self, channel):
# for c in self.get_channels(): # for c in self.get_channels():
......
...@@ -155,6 +155,8 @@ class Call(Executor): ...@@ -155,6 +155,8 @@ class Call(Executor):
channels = self.origin.get_channels_from_name_inside_level(param) channels = self.origin.get_channels_from_name_inside_level(param)
if(channels==[]): if(channels==[]):
channels = self.origin.get_channels_from_name_above_level(param) channels = self.origin.get_channels_from_name_above_level(param)
if(channels==[]):
channels = self.origin.get_channels_from_name_other_blocks_on_same_level(param)
if(channels==[]): if(channels==[]):
from .channel import Channel from .channel import Channel
channel = Channel(name=param, origin=self.origin) channel = Channel(name=param, origin=self.origin)
......
...@@ -49,8 +49,35 @@ class Executor(Nextflow_Building_Blocks): ...@@ -49,8 +49,35 @@ class Executor(Nextflow_Building_Blocks):
self.origin.add_channel(channel) self.origin.add_channel(channel)
def get_channels(self): def get_channels_same_level(self):
return self.origin.get_channels() return self.origin.get_channels_same_level()
def get_channels_above_level(self):
return self.origin.get_channels_above_level()
def get_channels_inside_level(self):
return self.origin.get_channels_inside_level()
def get_channels_from_other_blocks_on_same_level(self):
return self.origin.get_channels_from_other_blocks_on_same_level()
def get_channels_from_name_same_level(self, name):
return self.origin.get_channels_from_name_same_level(name)
def get_channels_from_name_inside_level(self, name):
return self.origin.get_channels_from_name_inside_level(name)
def get_channels_from_name_above_level(self, name):
return self.origin.get_channels_from_name_above_level(name)
def get_channels_from_name_other_blocks_on_same_level(self, name):
return self.origin.get_channels_from_name_other_blocks_on_same_level(name)
#def get_channels(self):
# return self.origin.get_channels()
def check_in_channels(self, channel): def check_in_channels(self, channel):
return self.origin.check_in_channels(channel) return self.origin.check_in_channels(channel)
...@@ -229,6 +256,13 @@ class Executor(Nextflow_Building_Blocks): ...@@ -229,6 +256,13 @@ class Executor(Nextflow_Building_Blocks):
for c in call.get_all_calls(): for c in call.get_all_calls():
if(c.first_element_called.get_alias()==name): if(c.first_element_called.get_alias()==name):
tab.append(c) tab.append(c)
#Looking inside the other blocks
if(len(tab)==0):
for call in self.origin.get_calls_from_other_blocks_on_same_level():
#call.initialise()
for c in call.get_all_calls():
if(c.first_element_called.get_alias()==name):
tab.append(c)
return tab return tab
else: else:
......
...@@ -95,6 +95,8 @@ class Operation(Executor): ...@@ -95,6 +95,8 @@ class Operation(Executor):
#Finally check if the channels is defined above #Finally check if the channels is defined above
if(channels==[]): if(channels==[]):
channels = self.origin.get_channels_from_name_above_level(name) channels = self.origin.get_channels_from_name_above_level(name)
if(channels==[]):
channels = self.origin.get_channels_from_name_other_blocks_on_same_level(name)
#If it still doesn't exist -> we create it #If it still doesn't exist -> we create it
if(channels==[]): if(channels==[]):
channel = Channel(name=name, origin=self.origin) channel = Channel(name=name, origin=self.origin)
...@@ -206,6 +208,8 @@ class Operation(Executor): ...@@ -206,6 +208,8 @@ class Operation(Executor):
channels = origin.get_channels_from_name_inside_level(name) channels = origin.get_channels_from_name_inside_level(name)
if(channels==[]): if(channels==[]):
channels = origin.get_channels_from_name_above_level(name) channels = origin.get_channels_from_name_above_level(name)
if(channels==[]):
channels = origin.get_channels_from_name_other_blocks_on_same_level(name)
if(channels==[]): if(channels==[]):
channel = Channel(name=name, origin=self.origin) channel = Channel(name=name, origin=self.origin)
origin.add_channel(channel) origin.add_channel(channel)
...@@ -496,7 +500,7 @@ class Operation(Executor): ...@@ -496,7 +500,7 @@ class Operation(Executor):
emited = self.check_is_emit(name) emited = self.check_is_emit(name)
if(not emited): if(not emited):
#TODO -> check at what extend this is used #TODO -> check at what extend this is used
channels = self.get_channels() channels = self.get_channels_same_level()+self.get_channels_above_level()+self.get_channels_inside_level()+self.get_channels_from_other_blocks_on_same_level()
for c in channels: for c in channels:
if(c.get_name() in name): if(c.get_name() in name):
pos = [m.start() for m in re.finditer(c.get_name(), operation)] pos = [m.start() for m in re.finditer(c.get_name(), operation)]
......
...@@ -45,6 +45,9 @@ class Root(Nextflow_Building_Blocks): ...@@ -45,6 +45,9 @@ class Root(Nextflow_Building_Blocks):
# CHANNELS # CHANNELS
############# #############
def get_channels_same_level(self):
return self.channels
def get_channels_from_name_same_level(self, name): def get_channels_from_name_same_level(self, name):
tab = [] tab = []
for c in self.channels: for c in self.channels:
...@@ -85,6 +88,15 @@ class Root(Nextflow_Building_Blocks): ...@@ -85,6 +88,15 @@ class Root(Nextflow_Building_Blocks):
tab.append(c) tab.append(c)
return tab return tab
def get_channels_from_other_blocks_on_same_level(self):
return []
def get_channels_from_name_other_blocks_on_same_level(self, name):
tab = []
for c in self.get_channels_from_other_blocks_on_same_level():
if(c.get_name()==name):
tab.append(c)
return tab
...@@ -141,6 +153,7 @@ class Root(Nextflow_Building_Blocks): ...@@ -141,6 +153,7 @@ class Root(Nextflow_Building_Blocks):
for b in self.blocks: for b in self.blocks:
b.get_inside_executors_rec(dico) b.get_inside_executors_rec(dico)
return list(dico.keys()) return list(dico.keys())
#def get_calls(self): #def get_calls(self):
# tab = [] # tab = []
...@@ -185,7 +198,8 @@ class Root(Nextflow_Building_Blocks): ...@@ -185,7 +198,8 @@ class Root(Nextflow_Building_Blocks):
return tab return tab
def get_calls_from_other_blocks_on_same_level(self):
return []
......
...@@ -209,6 +209,8 @@ class Subworkflow(Main): ...@@ -209,6 +209,8 @@ class Subworkflow(Main):
channels = self.root.get_channels_from_name_same_level(code[i]) channels = self.root.get_channels_from_name_same_level(code[i])
if(channels==[]): if(channels==[]):
channels = self.root.get_channels_from_name_inside_level(code[i]) channels = self.root.get_channels_from_name_inside_level(code[i])
if(channels==[]):
channels = self.root.get_channels_from_name_other_blocks_on_same_level(code[i])
if(channels!=[]): if(channels!=[]):
ope = Operation(code=f"emit: {code[i]}", origin=self) ope = Operation(code=f"emit: {code[i]}", origin=self)
ope.set_as_artificial() ope.set_as_artificial()
......
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