def main()

in step1/src/loadgen/loadgen.py [0:0]


def main():
    target = os.environ.get("CLIENT_ADDR", "0.0.0.0:8080")

    # connectivity check to client service
    healthz = f"http://{target}/_healthz"
    logger.info(f"check connectivity: {healthz}")
    wait_interval = 1.0
    while not check_client_connection(healthz):
        if wait_interval > 30:
            logger.error("exponential backoff exceeded the threshold")
            return
        logger.warning(f"not connected. wait for {wait_interval}sec and retry.")
        time.sleep(wait_interval)
        wait_interval *= 3

    # start request loop to client service
    logger.info("start client request loop")
    addr = f"http://{target}"
    while True:
        logger.info("start request to client")
        call_client(addr)
        logger.info("end request to client")
        time.sleep(2.0)