Module Expr Str Import alias Import alias Import alias Import alias ImportFrom alias Assign NameStore Str Assign NameStore Num Assign NameStore Str FunctionDef arguments args defaults body Expr Str Expr Call AttributeLoad NameLoad attr keyword AttributeLoad NameLoad attr keyword Str decorator_list FunctionDef arguments args defaults body Assign NameStore Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Str keyword BinOpAdd Str NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr Str keyword BinOpAdd Str Call NameLoad NameLoad keyword NameLoad Expr Call AttributeLoad NameLoad attr Str keyword Str Return Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args defaults body Expr Call NameLoad Assign NameStore Call NameLoad Assign NameStore Call NameLoad AttributeLoad NameLoad attr NameLoad AttributeLoad NameLoad attr Assign NameStore Str Expr Call AttributeLoad NameLoad attr Str Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad If CompareNotEq NameLoad Num body Print TupleLoad NameLoad Call AttributeLoad NameLoad attr NameLoad Return Assign NameStore SubscriptLoad NameLoad Index Str Expr Call AttributeLoad NameLoad attr BinOpAdd Str NameLoad Assign NameStore Call NameLoad AttributeLoad NameLoad attr Str Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad If CompareNotEq NameLoad Num body Print TupleLoad NameLoad Call AttributeLoad NameLoad attr NameLoad Return Expr Call AttributeLoad NameLoad attr BinOpAdd Str NameLoad Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad If CompareNotEq NameLoad Num body Print TupleLoad NameLoad Call AttributeLoad NameLoad attr NameLoad Return Expr Call AttributeLoad NameLoad attr BinOpAdd Str NameLoad Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad If CompareNotEq NameLoad Num body Print TupleLoad NameLoad Call AttributeLoad NameLoad attr NameLoad orelse Print Str For NameStore NameLoad body Print Call AttributeLoad Str attr SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str SubscriptLoad NameLoad Index Str decorator_list If CompareEq NameLoad Str body Expr Call NameLoad
N/A N/A 
Creates a new job and uploads farequote.csv to it. The job is
then closed and the result buckets queried,

The example file used can be downloaded from 
http://s3.amazonaws.com/prelert_demo/farequote.csv and looks like this:

    time,airline,responsetime,sourcetype
    2014-06-23 00:00:00Z,AAL,132.2046,farequote
    2014-06-23 00:00:00Z,JZA,990.4628,farequote
    2014-06-23 00:00:00Z,JBU,877.5927,farequote

The script is invoked with 1 positional argument the farequote.csv 
file and has optional arguments to specify the location of the 
Engine API. Run the script with '--help' to see the options.

The output is CSV print out of date, bucket id and anomaly score.
If a bucket id is specified only the anomaly records for that bucket
are returned.
 N/A argparse N/A sys N/A json N/A logging prelert.engineApiClient EngineApiClient N/A HOST localhost N/A PORT 8080 N/A BASE_URL engine/v1 setupLogging N/A N/A N/A N/A N/A 
        Log to console
     N/A N/A N/A logging basicConfig level N/A logging INFO format %(asctime)s %(levelname)s %(message)s N/A parseArguments N/A N/A N/A N/A N/A parser N/A N/A argparse ArgumentParser N/A N/A N/A parser add_argument --host help N/A The Prelert Engine API host, defaults to  HOST default HOST N/A N/A N/A parser add_argument --port help N/A The Prelert Engine API port, defaults to  N/A str PORT default PORT N/A N/A N/A parser add_argument file help Path to farequote.csv N/A N/A N/A parser parse_args N/A main N/A N/A N/A N/A N/A N/A setupLogging N/A args N/A parseArguments N/A engine_client N/A EngineApiClient N/A args host BASE_URL N/A args port N/A job_config {"analysisConfig" : {                        "bucketSpan":3600,                        "detectors" :[{"function":"metric","fieldName":"responsetime","byFieldName":"airline"}] },                        "dataDescription" : {"fieldDelimiter":",", "timeField":"time", "timeFormat":"yyyy-MM-dd HH:mm:ssX"} } N/A N/A N/A logging info Creating job N/A N/A http_status_code response N/A N/A engine_client createJob job_config N/A N/A http_status_code 201 N/A N/A N/A http_status_code N/A N/A json dumps response N/A N/A job_id N/A response N/A id N/A N/A N/A logging info N/A Uploading data to  job_id N/A file N/A open N/A args file rb N/A N/A http_status_code response N/A N/A engine_client upload job_id file N/A N/A http_status_code 202 N/A N/A N/A http_status_code N/A N/A json dumps response N/A N/A N/A N/A logging info N/A Closing job  job_id N/A N/A http_status_code response N/A N/A engine_client close job_id N/A N/A http_status_code 202 N/A N/A N/A http_status_code N/A N/A json dumps response N/A N/A N/A N/A logging info N/A Get result buckets for job  job_id N/A N/A http_status_code response N/A N/A engine_client getAllBuckets job_id N/A N/A http_status_code 200 N/A N/A N/A http_status_code N/A N/A json dumps response N/A N/A Date,Anomaly Score,Max Normalized Probablility N/A bucket response N/A N/A N/A N/A {0},{1},{2} format N/A bucket N/A timestamp N/A bucket N/A anomalyScore N/A bucket N/A maxNormalizedProbability N/A N/A N/A __name__ __main__ N/A N/A N/A main