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 records up to now
    logging.info("Get records for job " + job_id)

    skip = 0
    take = 200
    (http_status_code, response) = engine_client.getRecords(
        job_id,
        skip,
        take,
        normalized_probability_filter_value=args.normalizedProbability,
        anomaly_score_filter_value=args.anomalyScore)
    if http_status_code != 200:
        print(http_status_code, json.dumps(response))
        return

    hit_count = int(response['hitCount'])

    printHeader()
    printRecords(response['documents'])

    while (skip + take) < hit_count:
        skip += take

        (http_status_code, response) = engine_client.getRecords(
            job_id,
            skip,
            take,
            normalized_probability_filter_value=args.normalizedProbability,
            anomaly_score_filter_value=args.anomalyScore)

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

        printRecords(response['documents'])
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 records up to now
    logging.info("Get records for job " + job_id)

    skip = 0
    take = 200
    (http_status_code, response) = engine_client.getRecords(job_id, skip, take,
                            normalized_probability_filter_value=args.normalizedProbability, 
                            anomaly_score_filter_value=args.anomalyScore)        
    if http_status_code != 200:
        print (http_status_code, json.dumps(response))
        return

    hit_count = int(response['hitCount'])

    printHeader()
    printRecords(response['documents'])

    while (skip + take) < hit_count:
        skip += take

        (http_status_code, response) = engine_client.getRecords(job_id, skip, take,
                            normalized_probability_filter_value=args.normalizedProbability, 
                            anomaly_score_filter_value=args.anomalyScore)        

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

        printRecords(response['documents'])