- def register(self, name, command, callback=None, persist=False,
- *args, **kw):
- log.debug(u'ProcessManager.register(%s, %s, %s, %s, %s, %s)',
- name, command, callback, persist, args, kw)
- self.services[name] = ProcessInfo(name, command, callback, persist,
- args, kw)
+ def register(self, name, command=None, callback=None, persist=False,
+ max_errors=3, *args, **kwargs):
+ log.debug(u'ProcessManager.register(%s, %s, %s, %s, %s, %s, %s)',
+ name, command, callback, persist, max_errors, args, kwargs)
+ if not isinstance(name, ProcessInfo):
+ pi = ProcessInfo(name, command, callback, persist, max_errors,
+ args, kwargs)
+ else:
+ pi = name
+ name = pi.name
+ assert not self.has(name)
+ self.services[name] = pi
+ return pi