def __init__(self, provisioner_client, engineclass, controller_name, conf=None, state=None, store=None): if state: self.state = state else: self.state = ControllerCoreState(store or ControllerStore()) prov_vars = None health_kwargs = None if conf: if conf.has_key(PROVISIONER_VARS_KEY): prov_vars = conf[PROVISIONER_VARS_KEY] if conf.get(MONITOR_HEALTH_KEY): health_kwargs = {} if HEALTH_BOOT_KEY in conf: health_kwargs['boot_seconds'] = conf[HEALTH_BOOT_KEY] if HEALTH_MISSING_KEY in conf: health_kwargs['missing_seconds'] = conf[HEALTH_MISSING_KEY] if HEALTH_ZOMBIE_KEY in conf: health_kwargs['zombie_seconds'] = conf[HEALTH_ZOMBIE_KEY] self.conf = conf if health_kwargs is not None: self.health_monitor = HealthMonitor(self.state, **health_kwargs) else: self.health_monitor = None # There can only ever be one 'reconfigure' or 'decide' engine call run # at ANY time. The 'decide' call is triggered via timed looping call # and 'reconfigure' is triggered asynchronously at any moment. self.busy = defer.DeferredSemaphore(1) self.provisioner_client = provisioner_client health_not_checked = self.health_monitor is None self.control = ControllerCoreControl( provisioner_client, self.state, prov_vars, controller_name, health_not_checked=health_not_checked) self.engine = EngineLoader().load(engineclass) self.control_loop = None
def setUp(self): log.debug("set up") self.engine = EngineLoader().load(ENGINE) self.state = DeeState() self.state.new_qlen(0) self.control = DeeControl(self.state)
def __init__(self, engineclass): self.continue_running = True self.engine = EngineLoader().load(engineclass) self.state = DeeState() self.control = DeeControl(self.state)