def run(config, logger, session, event_producer, shutdown_handler): conditions = Conditions.from_config(config) query_filter = exclude_edge_filter(stale_timestamp_filter(*conditions.culled())) query = session.query(Host).filter(query_filter) events = delete_hosts(query, event_producer, config.host_delete_chunk_size, shutdown_handler.shut_down) for host_id, deleted in events: if deleted: log_host_delete_succeeded(logger, host_id, "REAPER") else: log_host_delete_failed(logger, host_id, "REAPER")
def run(config, logger, session): conditions = Conditions.from_config(config) query_filter = stale_timestamp_filter(*conditions.culled()) query = session.query(Host).filter(query_filter) events = delete_hosts(query) for host_id, deleted in events: if deleted: logger.info("Deleted host: %s", host_id) else: logger.info("Host %s already deleted. Delete event not emitted.", host_id)
def run(config, logger, session, event_producer, shutdown_handler): conditions = Conditions.from_config(config) query_filter = stale_timestamp_filter(*conditions.culled()) query = session.query(Host).filter(query_filter) events = delete_hosts(query, event_producer, config.host_delete_chunk_size, shutdown_handler.shut_down) for host_id, deleted in events: if deleted: logger.info("Deleted host: %s", host_id) else: logger.info("Host %s already deleted. Delete event not emitted.", host_id)