def send_metrics(ctx): logger.debug("metrics") try: containers = dl_lib.get_containers(ctx) metrics = get_metrics(ctx, containers) publish_metrics(ctx, metrics) except Exception as ex: logger.error("metrics failed: %s" % ex, exc_info=True)
def ping(ctx): logger.debug("pinging") try: containers = dl_lib.get_containers(ctx) container_paths = dl_lib.get_container_paths(containers) ping_containers(ctx, container_paths) except Exception as ex: logger.error("ping failed: %s" % ex, exc_info=True)
def tag(ctx): logger.info("tagging") try: containers = dl_lib.get_containers() tag_containers(ctx, containers) except Exception as ex: logger.error("tagging failed: %s" % ex, exc_info=True)
def register_sync(ctx): logger.info("register sync") agents = dl_lib.get_agents(ctx) agent_ids = dl_lib.get_agents_ids(agents) containers = dl_lib.get_containers(ctx) container_hashes = get_container_hashes(containers) logger.debug("containers: %s", container_hashes) dead_containers = agent_ids - container_hashes destroy_agents(ctx, dead_containers)
def tag(ctx): logger.debug("tagging") try: containers = dl_lib.get_containers(ctx) container_paths = dl_lib.get_container_paths(containers) tag_containers(ctx, container_paths) except Exception as ex: logger.error("tagging failed: %s" % ex, exc_info=True) finally: time.sleep(ctx['tag_interval'])
def register_sync(ctx): agents = dl_lib.get_agents(ctx) agent_ids = dl_lib.get_agents_ids(agents) containers = dl_lib.get_containers() container_hashes = dl_lib.get_container_hashes(containers) logger.debug("agent_ids=%s container_hashes=%s", agent_ids, container_hashes) dead_containers = agent_ids - container_hashes dl_lib.deregister_agents(ctx, dead_containers)
def tag(ctx): while True: logger.debug("tagging") try: containers = dl_lib.get_containers(ctx) container_paths = dl_lib.get_container_paths(containers) tag_containers(ctx, container_paths) except Exception as ex: logger.error("tagging failed: %s" % ex, exc_info=True) finally: time.sleep(ctx["tag_interval"])
def send_metrics(ctx): logger.info("metrics") try: containers = dl_lib.get_containers() for c in containers: c.finger = dl_lib.get_container_hash(c) metrics = dl_stats.get_metrics(containers) publish_metrics(ctx, metrics) except Exception as ex: logger.error("metrics failed: %s" % ex, exc_info=True)
def ping(ctx): logger.info("pinging") try: containers = dl_lib.get_containers() for container in containers: logger.debug("found container: id=%s name=%s" % (container.id, container.name)) ping_containers(ctx, containers) except Exception as ex: logger.error("ping failed: %s" % ex, exc_info=True)
def deregister_containers(ctx): containers = dl_lib.get_containers() container_hashes = dl_lib.get_container_hashes(containers) dl_lib.deregister_agents(ctx, container_hashes)