diff --git a/src/operation.py b/src/operation.py index 7d2b11c0d947c0388829c4d96c640752c81258a9..fbcb5a96bf2dd498d1b34823c145de44bb0b53cf 100644 --- a/src/operation.py +++ b/src/operation.py @@ -88,25 +88,30 @@ class Operation(Executor): if(name not in constant.ERROR_WORDS_ORIGINS):# and name.lower()!=f"workflow{self.get_name_file().lower()}"): #channel = Channel(name=name, origin=self.origin) if(self.origin.get_type()!="Subworkflow"): - #First check that the channel is not defined at the same level - channels = self.origin.get_channels_from_name_same_level(name) - #Then check that the channel is defined in the below level - if(channels==[]): - channels = self.origin.get_channels_from_name_inside_level(name) - #Finally check if the channels is defined above - if(channels==[]): - 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(channels==[]): - channel = Channel(name=name, origin=self.origin) - self.origin.add_channel(channel) - channels = [channel] + origin = self.origin else: - channel = Channel(name=name, origin=self.origin) - self.origin.takes_channels.append(channel) + origin = self.origin.root + + #First check that the channel is not defined at the same level + channels = origin.get_channels_from_name_same_level(name) + #Then check that the channel is defined in the below level + if(channels==[]): + channels = origin.get_channels_from_name_inside_level(name) + #Finally check if the channels is defined above + if(channels==[]): + channels = origin.get_channels_from_name_above_level(name) + if(channels==[]): + channels = origin.get_channels_from_name_other_blocks_on_same_level(name) + #If it still doesn't exist -> we create it + if(channels==[]): + channel = Channel(name=name, origin=origin) + origin.add_channel(channel) channels = [channel] + #else: + # print(name) + # channel = Channel(name=name, origin=self.origin) + # self.origin.takes_channels.append(channel) + # channels = [channel] for channel in channels: self.origins.append(channel) diff --git a/src/subworkflow.py b/src/subworkflow.py index 0e0d1adb8ea9fc1b9c062b692138e59401785d80..1f8bb5ec9d45b43880339108e9da91c34bc2f17a 100644 --- a/src/subworkflow.py +++ b/src/subworkflow.py @@ -307,6 +307,13 @@ class Subworkflow(Main): self.initialise_emit() + def get_all_executors_in_subworkflow(self): + dico = {} + self.root.get_all_executors_in_subworkflow(calls = dico) + for operation in self.emit: + dico[operation] = "" + return list(dico.keys()) + def get_structure(self, dico): super().get_structure(dico)