def main():

    setupLogging()

    args = parseArguments()
    job_id = args.jobid

    # Create the REST API client
    engine_client = EngineApiClient(args.host, BASE_URL, args.port)

    # Get all the buckets up to now
    logging.info("Get result buckets for job " + job_id)
    (http_status_code, response) = engine_client.getAllBuckets(job_id, 
        include_records=False, 
        anomaly_score_filter_value=args.anomalyScore,
        normalized_probability_filter_value=args.normalizedProbability)

    
    if http_status_code != 200:
        print (http_status_code, json.dumps(response))
        return
    
    
    printHeader()
    printBuckets(response)

    if args.continue_poll:

        if len(response) > 0:
            next_bucket_id = int(response[-1]['id']) + 1
        else:
            next_bucket_id = None
        
        while True:
            # Wait POLL_INTERVAL_SECS then query for any new buckets
            time.sleep(POLL_INTERVAL_SECS)

            (http_status_code, response) = engine_client.getBucketsByDate(job_id=job_id, 
                start_date=str(next_bucket_id), end_date=None, 
                include_records=False,         
                anomaly_score_filter_value=args.anomalyScore,
                normalized_probability_filter_value=args.normalizedProbability)

            if http_status_code != 200:
                print (http_status_code, json.dumps(response))
                break

            printBuckets(response)
            
            if 0 > len(response):
                next_bucket_id = int(response[-1]['id']) + 1
dataset/ETHPy150Open prelert/engine-python/printJobBuckets.py/main/swapped operands of `>`