<s> '''<STR_LIT>''' <EOL> import argparse <EOL> import sys <EOL> import json <EOL> import logging <EOL> from prelert . engineApiClient import EngineApiClient <EOL> HOST = '<STR_LIT:localhost>' <EOL> PORT = <NUM_LIT> <EOL> BASE_URL = '<STR_LIT>' <EOL> def setupLogging ( ) : <EOL> '''<STR_LIT>''' <EOL> logging . basicConfig ( level = logging . INFO , format = '<STR_LIT>' ) <EOL> def parseArguments ( ) : <EOL> parser = argparse . ArgumentParser ( ) <EOL> parser . add_argument ( "<STR_LIT>" , help = "<STR_LIT>" <EOL> + HOST , default = HOST ) <EOL> parser . add_argument ( "<STR_LIT>" , help = "<STR_LIT>" <EOL> + str ( PORT ) , default = PORT ) <EOL> parser . add_argument ( "<STR_LIT:file>" , help = "<STR_LIT>" ) <EOL> return parser . parse_args ( ) <EOL> def main ( ) : <EOL> setupLogging ( ) <EOL> args = parseArguments ( ) <EOL> engine_client = EngineApiClient ( args . host , BASE_URL , args . port ) <EOL> job_config = '<STR_LIT>' <EOL> logging . info ( "<STR_LIT>" ) <EOL> ( http_status_code , response ) = engine_client . createJob ( job_config ) <EOL> if http_status_code != <NUM_LIT> : <EOL> print ( http_status_code , json . dumps ( response ) ) <EOL> return <EOL> job_id = response [ '<STR_LIT:id>' ] <EOL> logging . info ( "<STR_LIT>" + job_id ) <EOL> file = open ( args . file , '<STR_LIT:rb>' ) <EOL> ( http_status_code , response ) = engine_client . upload ( job_id , file ) <EOL> if http_status_code != <NUM_LIT> : <EOL> print ( http_status_code , json . dumps ( response ) ) <EOL> return <EOL> logging . info ( "<STR_LIT>" + job_id ) <EOL> ( http_status_code , response ) = engine_client . close ( job_id ) <EOL> if http_status_code != <NUM_LIT> : <EOL> print ( http_status_code , json . dumps ( response ) ) <EOL> return <EOL> logging . info ( "<STR_LIT>" + job_id ) <EOL> ( http_status_code , response ) = engine_client . getAllBuckets ( job_id ) <EOL> if http_status_code != <NUM_LIT:200> : <EOL> print ( http_status_code , json . dumps ( response ) ) <EOL> else : <EOL> print "<STR_LIT>" <EOL> for bucket in response : <EOL> print "<STR_LIT>" . format ( bucket [ '<STR_LIT>' ] , bucket [ '<STR_LIT>' ] , <EOL> bucket [ '<STR_LIT>' ] ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> main ( ) </s>
