diff --git a/supervisor/events.py b/supervisor/events.py index a9b0f181f..07d006ac6 100644 --- a/supervisor/events.py +++ b/supervisor/events.py @@ -174,6 +174,15 @@ def payload(self): class ProcessGroupAddedEvent(ProcessGroupEvent): pass +class AddProcessGroupFailedEvent(ProcessGroupEvent): + def __init__(self, group, err = None): + super().__init__(group) + self.err = err + + def payload(self): + payload = super().payload() + return payload+'error:%s\n' % self.err + class ProcessGroupRemovedEvent(ProcessGroupEvent): pass diff --git a/supervisor/supervisord.py b/supervisor/supervisord.py index 0a4f3e697..d0db700c3 100755 --- a/supervisor/supervisord.py +++ b/supervisor/supervisord.py @@ -114,7 +114,12 @@ def add_process_group(self, config): name = config.name if name not in self.process_groups: config.after_setuid() - self.process_groups[name] = config.make_group() + try: + self.process_groups[name] = config.make_group() + except BaseException as why: + self.options.logger.warn('Unable to add group %s: %s' % (name, why)) + events.notify(events.AddProcessGroupFailedEvent(name, why)) + return False events.notify(events.ProcessGroupAddedEvent(name)) return True return False