def METHOD_NAME(dagit_port):
    start_time = time.time()
    while True:
        try:
            dagit_json = requests.get(f"http://localhost:{dagit_port}/server_info").json()
            if dagit_json:
                return
        except:
            print("Waiting for Dagit to be ready..")  # noqa: T201
        if time.time() - start_time > 30:
            raise Exception("Timed out waiting for Dagit to serve requests")
        time.sleep(1)