def wait_delete_anomaly_detector()

in getting_started/utility.py [0:0]


def wait_delete_anomaly_detector( lookoutmetrics_client, arn ):
    
    prev_status = None
    while True:
    
        try:
            response = lookoutmetrics_client.describe_anomaly_detector( AnomalyDetectorArn = arn )
            status = response["Status"]
        except lookoutmetrics_client.exceptions.ResourceNotFoundException:
            break

        if status != prev_status:
            if prev_status:
                sys.stdout.write("\n")
            sys.stdout.write( status + " " )
            sys.stdout.flush()
            prev_status = status

        if status in ( "DELETING" ):
            sys.stdout.write(".")
            sys.stdout.flush()
            time.sleep(5)
            continue

        break