def __init__(self, conf, name=None, child_type="worker", age=0, ppid=0, timeout=30): if name is None: name = self.__class__.__name__ self.name = name self.child_type = child_type self.age = age self.ppid = ppid self.timeout = timeout self.conf = conf # initialize self.booted = False self.alive = True self.debug = self.conf.get("debug", False) self.tmp = WorkerTmp(self.conf) self.on_init(self.conf)
def __init__(self, args, spec=(), name=None, child_type="supervisor", age=0, ppid=0, timeout=30): if not isinstance(spec, tuple): raise TypeError("spec should be a tuple") # set conf conf = DEFAULT_CONF.copy() conf.update(args) self.conf = conf # set number of workers self.num_workers = conf.get('num_workers', 1) ret = self.on_init(conf) if not ret: self._SPEC = Child(*spec) else: self._SPEC = Child(*ret) if name is None: name = self.__class__.__name__ self.name = name self.child_type = child_type self.age = age self.ppid = ppid self.timeout = timeout self.pid = None self.child_age = 0 self.booted = False self.stopping = False self.debug = self.conf.get("debug", False) self.tmp = WorkerTmp(self.conf)
def __init__(self, args, specs=[], name=None, child_type="supervisor", age=0, ppid=0, timeout=30): # set conf conf = DEFAULT_CONF.copy() conf.update(args) self.conf = conf specs.extend(self.on_init(conf)) for spec in specs: c = Child(*spec) self._CHILDREN_SPECS.append(c) self._SPECS_BYNAME[c.name] = c if name is None: name = self.__class__.__name__ self.name = name self.child_type = child_type self.age = age self.ppid = ppid self.timeout = timeout self.pid = None self.num_children = len(self._CHILDREN_SPECS) self.child_age = 0 self.booted = False self.stopping = False self.debug = self.conf.get("debug", False) self.tmp = WorkerTmp(self.conf)