#NEWLINE# def main( ) : #NEWLINE# #INDENT# _register_cli_opts ( ) #NEWLINE# common_setup ( config = config , setup_db = True , register_mq_exchanges = False ) #NEWLINE# timestamp = cfg . CONF . timestamp #NEWLINE# action_ref = cfg . CONF . action_ref #NEWLINE# purge_incomplete = cfg . CONF . purge_incomplete #NEWLINE# if ( not timestamp ) : #NEWLINE# #INDENT# LOG . error ( 'Please supply a timestamp for purging models. Aborting.' ) #NEWLINE# return 1 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# timestamp = datetime . strptime ( timestamp , '%Y-%m-%dT%H:%M:%S.%fZ' ) #NEWLINE# timestamp = timestamp . replace ( tzinfo = pytz . UTC ) #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# purge_executions ( logger = LOG , timestamp = timestamp , action_ref = action_ref , purge_incomplete = purge_incomplete ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# LOG . exception ( str ( e ) ) #NEWLINE# return FAILURE_EXIT_CODE #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# common_teardown ( ) #NEWLINE# #UNINDENT# return SUCCESS_EXIT_CODE