Skip to content

Commit

Permalink
fix: depends_on was only working for first program within a group- no…
Browse files Browse the repository at this point in the history
…w it can be used with all
  • Loading branch information
Michael Hammann committed Aug 23, 2021
1 parent 487897d commit 34138fc
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions supervisor/supervisord.py
Original file line number Diff line number Diff line change
Expand Up @@ -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!')
Expand Down

0 comments on commit 34138fc

Please sign in to comment.