def __disconnect_at_exit__(): """ Insure that we properly shutdown the connection at the end of the process. This includes sending any outstanding records and printing the statistics """ if global_state.bundle_size > 1 and global_state.CurrentBundle.nItems > 0: responseString, _ = bundle.ProcessBundle(global_state.CurrentBundle) DebugPrint(0, responseString) DebugPrint( 0, '***********************************************************') connect_utils.disconnect() if config.Config: try: sandbox_mgmt.RemoveOldLogs(Config.get_LogRotate()) sandbox_mgmt.RemoveOldJobData(Config.get_DataFileExpiration()) sandbox_mgmt.RemoveOldQuarantine(Config.get_DataFileExpiration(), Config.get_QuarantineSize()) except KeyboardInterrupt: raise except SystemExit: raise except Exception, exception: DebugPrint(0, 'Exception caught at top level: ' + str(exception)) DebugPrintTraceback()
def Maintenance(): '''This perform routine maintenance that is usually done at''' send.Handshake() # Need to look for left over files sandbox_mgmt.SearchOutstandingRecord() # Attempt to reprocess any outstanding records reprocess.Reprocess() if global_state.bundle_size > 1 and global_state.CurrentBundle.nItems > 0: responseString, _ = bundle.ProcessBundle(global_state.CurrentBundle) DebugPrint(0, responseString) DebugPrint(0, '***********************************************************')
def __disconnect_at_exit__(): """ Insure that we properly shutdown the connection at the end of the process. This includes sending any outstanding records and printing the statistics """ if global_state.bundle_size > 1 and global_state.CurrentBundle.nItems > 0: responseString, _ = bundle.ProcessBundle(global_state.CurrentBundle) DebugPrint(0, responseString) DebugPrint( 0, '***********************************************************') connect_utils.disconnect() if config.Config: try: sandbox_mgmt.RemoveOldLogs(Config.get_LogRotate()) sandbox_mgmt.RemoveOldJobData(Config.get_DataFileExpiration()) sandbox_mgmt.RemoveOldQuarantine(Config.get_DataFileExpiration(), Config.get_QuarantineSize()) except KeyboardInterrupt: raise except SystemExit: raise except Exception as exception: DebugPrint(0, 'Exception caught at top level: ' + str(exception)) DebugPrintTraceback() DebugPrint( 0, 'End of execution summary: new records sent successfully: ' + str(bundle.successfulSendCount)) DebugPrint( 0, ' new records suppressed: ' + str(bundle.suppressedCount)) DebugPrint( 0, ' new records failed: ' + str(bundle.failedSendCount)) DebugPrint( 0, ' records reprocessed successfully: ' + str(bundle.successfulReprocessCount)) DebugPrint( 0, ' reprocessed records failed: ' + str(bundle.failedReprocessCount)) DebugPrint( 0, ' handshake records sent successfully: ' + str(bundle.successfulHandshakes)) DebugPrint( 0, ' handshake records failed: ' + str(bundle.failedHandshakes)) DebugPrint( 0, ' bundle of records sent successfully: ' + str(bundle.successfulBundleCount)) DebugPrint( 0, ' bundle of records failed: ' + str(bundle.failedBundleCount)) DebugPrint( 0, ' outstanding records: ' + str(sandbox_mgmt.outstandingRecordCount)) DebugPrint( 0, ' outstanding staged records: ' + str(sandbox_mgmt.outstandingStagedRecordCount)) DebugPrint( 0, ' outstanding records tar files: ' + str(sandbox_mgmt.outstandingStagedTarCount)) DebugPrint(1, 'End-of-execution disconnect ...')
def ProcessCurrentBundle(): if global_state.bundle_size > 1 and global_state.CurrentBundle.nItems > 0: responseString, _ = bundle.ProcessBundle(global_state.CurrentBundle) DebugPrint(0, responseString) DebugPrint( 0, '***********************************************************')