def stop(self): self._stop_rpc_server() ctxt = context.get_admin_context() service_objects.Service.delete(ctxt, self.service_id) LOG.info(_LI('Service %s is deleted'), self.service_id) # Terminate the engine process LOG.info(_LI("All threads were gone, terminating engine")) super(EngineService, self).stop()
def service_manage_cleanup(self): cnxt = context.get_admin_context() last_updated_window = (3 * cfg.CONF.periodic_interval) time_line = datetime.datetime.utcnow() - datetime.timedelta( seconds=last_updated_window) service_refs = service_objects.Service.get_all_by_args( cnxt, self.host, self.binary, self.hostname) for service_ref in service_refs: if (service_ref['id'] == self.service_id or service_ref['deleted_at'] is not None or service_ref['updated_at'] is None): continue if service_ref['updated_at'] < time_line: # hasn't been updated, assuming it's died. LOG.info(_LI('Service %s was aborted'), service_ref['id']) service_objects.Service.delete(cnxt, service_ref['id'])