diff --git a/supervisor/supervisord.py b/supervisor/supervisord.py index b04e889c4..333382a5f 100755 --- a/supervisor/supervisord.py +++ b/supervisor/supervisord.py @@ -89,20 +89,22 @@ def run(self): g = Graph(len(self.options.process_group_configs)) # replace depends_on string with actual process object for config in (self.options.process_group_configs): - if config.process_configs[0].depends_on is not None: - processes=[] - # split to get all processes in case there are multiple dependencies - dependent_processes = (config.process_configs[0].depends_on).split() - for process in dependent_processes: - # this can be of form group:process or simply process - try: - dependent_group, dependent_process=process.split(":") - except: - dependent_group=dependent_process=process - g.addEdge(config.process_configs[0].name, dependent_process) - print(f'adding edge {config.process_configs[0].name, dependent_process}') - processes.append(self.process_groups[dependent_group].processes[dependent_process]) - config.process_configs[0].depends_on = processes + # check dependencies for all programs in group: + for conf in enumerate(config.process_configs): + if config.process_configs[conf[0]].depends_on is not None: + processes=[] + # split to get all processes in case there are multiple dependencies + dependent_processes = (config.process_configs[conf[0]].depends_on).split() + for process in dependent_processes: + # this can be of form group:process or simply process + try: + dependent_group, dependent_process=process.split(":") + except: + dependent_group=dependent_process=process + g.addEdge(config.process_configs[conf[0]].name, dependent_process) + print(f'adding edge {config.process_configs[conf[0]].name, dependent_process}') + processes.append(self.process_groups[dependent_group].processes[dependent_process]) + config.process_configs[conf[0]].depends_on = processes # check for cyclical process dependencies if g.cyclic() == 1: raise AttributeError('Process config contains dependeny cycle(s)! Check config files again!')