// * hostname_to_ip
// * ip_to_hostname
logger.info("Purge data.")
valid_keys = DataSource.ip_to_hostname.keys()
for key in DataSource.node_stats.keys() - valid_keys:
DataSource.node_stats.pop(key)
for key in DataSource.node_physical_stats.keys() - valid_keys:
After Change
logger.info("Purge data.")
alive_nodes = {
node_id
for node_id, node_info in DataSource.nodes.items()
if node_info["state"] == "ALIVE"
}
for key in DataSource.node_stats.keys() - alive_nodes:
DataSource.node_stats.pop(key)