Exemplo n.º 1
0
    try:

        start = time.time()
        LOGGER.info('********************************')
        LOGGER.info('**      Touchstone v.3.0      **')
        LOGGER.info('********************************')

        LOGGER.info('\n********** Log header **********\n')
        LOGGER.info('Description:   Disaggregation Validation')
        LOGGER.info('Time Submitted: ' + str(datetime.datetime.now()))
        LOGGER.info('Status:                Completed')

        LOGGER.info('\n********** Log Import Options **********\n')
        # Initialize the connection with the server
        try:
            db = Database(server)
            disaggregation = Disaggregation(server)
            LOGGER.info('Server: ' + str(server))
        except:
            LOGGER.error('Error: Check connection to database server')
            file_skeleton(OUTFILE)
            sys.exit()

        try:
            loc_info = db.location_info_disagg(exposure_db, exposure_name)
            loc_info['ExchangeRate_Original'] = copy.deepcopy(loc_info['ExchangeRate'])
            loc_info.loc[loc_info['CurrencyCode'] == 'USD', 'ExchangeRate'] = 1.0
            LOGGER.info('Exposure DB: ' + str(exposure_db))
            LOGGER.info('Exposure Name: ' + str(exposure_name))
        except:
            LOGGER.error('Error: Check the exposure db or exposure name')
Exemplo n.º 2
0
    try:

        start = time.time()
        LOGGER.info('********************************')
        LOGGER.info('**      Touchstone v.3.0      **')
        LOGGER.info('********************************')

        LOGGER.info('\n********** Log header **********\n')
        LOGGER.info('Description:   Disaggregation Validation')
        LOGGER.info('Time Submitted: ' + str(datetime.datetime.now()))
        LOGGER.info('Status:                Completed')

        LOGGER.info('\n********** Log Import Options **********\n')
        # Initialize the connection with the server
        try:
            db = Database(server)
            disaggregation = Disaggregation(server)
            LOGGER.info('Server: ' + str(server))
        except:
            LOGGER.error('Error: Check connection to database server')
            file_skeleton(OUTFILE)
            sys.exit()

        try:
            loc_info = db.location_info_disagg(exposure_db, exposure_name)
            loc_info['ExchangeRate_Original'] = copy.deepcopy(
                loc_info['ExchangeRate'])
            loc_info.loc[loc_info['CurrencyCode'] == 'USD',
                         'ExchangeRate'] = 1.0
            LOGGER.info('Exposure DB: ' + str(exposure_db))
            LOGGER.info('Exposure Name: ' + str(exposure_name))
        LOGGER.info('********************************')
        LOGGER.info('**      Touchstone v.3.0      **')
        LOGGER.info('********************************')

        LOGGER.info('\n********** Log header **********\n')
        LOGGER.info('Description:   Disaggregation Validation')
        LOGGER.info('Time Submitted: ' + str(datetime.datetime.now()))
        LOGGER.info('Status:                Completed')

        LOGGER.info('\n********** Log Import Options **********\n')

        ft = FinancialTerms()

        # Initialize the connection with the server
        try:
            db = Database(server)
            LOGGER.info('Server: ' + str(server))
        except:
            LOGGER.error('Error: Check connection to database server')
            file_skeleton(OUTFILE)
            sys.exit()

        try:
            analysis_sid = db.analysis_sid(analysis_name)
            LOGGER.info('Analysis SID: ' + str(analysis_sid))
        except:
            LOGGER.error('Error: Failed to extract the analysis SID from analysis name')
            file_skeleton(OUTFILE)
            sys.exit()

        try:
Exemplo n.º 4
0
if __name__ == "__main__":

    try:
        start = time.time()

        LOGGER.info('********************************')
        LOGGER.info('**      Touchstone v.3.0      **')
        LOGGER.info('********************************')

        LOGGER.info('\n********** Log header **********\n')
        LOGGER.info('Description:   Import Log Validation')
        LOGGER.info('Time Submitted: ' + str(datetime.datetime.now()))
        LOGGER.info('Status:                Completed')

        db = Database(server)
        files = [str(backup_location + '\\' + filename) for filename in os.listdir(backup_location) if
                 filename.endswith('.BAK')]

        thread_list = []
        for dbase in (files):
            t = threading.Thread(target=db.restore_db, args=(dbase, server,))
            thread_list.append(t)

        for thread in thread_list:
            thread.start()

        for thread in thread_list:
            thread.join()

        output = pd.DataFrame()
Exemplo n.º 5
0
        LOGGER.info('********************************')
        LOGGER.info('**      Touchstone v.3.0      **')
        LOGGER.info('********************************')

        LOGGER.info('\n********** Log header **********\n')
        LOGGER.info('Description:   Import Log Validation')
        LOGGER.info('Time Submitted: ' + str(datetime.datetime.now()))
        LOGGER.info('Status:                Completed')
        LOGGER.info(OUTFILE)
        LOGGER.info(import_log)

        LOGGER.info('\n********** Log Import Options **********\n')
        parse_log_files(import_log, (OUTFILE[:-4] + '-Errors.txt'))
        data = pd.read_csv(OUTFILE[:-4] + '-Errors.txt', header=None, error_bad_lines=False, sep='|')
        data.columns = ['ContractID', 'LocationID', 'ErrorType', 'ErrorCode', 'Error']
        db = Database('QA-TS-CI3-DB\SQL2012')
        for i in range(len(data)):
            try:
                script = 'SELECT ValidationErrorCode as ErrorCode, ValidationErrorMessage ' \
                         'FROM [AIRReference].[dbo].[tValidationError] WHERE ValidationErrorCode = ' + str(
                        data.ErrorCode[i])
                db_data = copy.deepcopy(pd.read_sql(script, db.connection))
                data.loc[i, 'ValidationErrorMessage'] = db_data.ValidationErrorMessage[0]
            except:
                pass
        data.to_csv(OUTFILE, index=False)

        LOGGER.info('----------------------------------------------------------------------------------')
        LOGGER.info('              Import Log Completed Successfully                            ')
        LOGGER.info('----------------------------------------------------------------------------------')
    try:

        start = time.time()
        LOGGER.info('********************************')
        LOGGER.info('**      Touchstone v.3.0      **')
        LOGGER.info('********************************')

        LOGGER.info('\n********** Log header **********\n')
        LOGGER.info('Description:   Analysis Option Validation')
        LOGGER.info('Time Submitted: ' + str(datetime.datetime.now()))
        LOGGER.info('Status:                Completed')

        LOGGER.info('\n********** Log Import Options **********\n')
        # Initialize the connection with the server
        try:
            db = Database(server)
        except:
            LOGGER.error('Error: Check connection to database server')
            file_skeleton(OUTFILE)
            sys.exit()

        try:
            analysis_sid = db.analysis_sid(analysis_name)
            LOGGER.info('Analysis SID: ' + str(analysis_sid))
        except:
            LOGGER.error('Error: Failed to extract the analysis SID from analysis name')
            file_skeleton(OUTFILE)
            sys.exit()

        try:
            analysis_information = db.analysis_option(analysis_sid)
        LOGGER.info('********************************')
        LOGGER.info('**      Touchstone v.3.0      **')
        LOGGER.info('********************************')

        LOGGER.info('\n********** Log header **********\n')
        LOGGER.info('Description:   Disaggregation Validation')
        LOGGER.info('Time Submitted: ' + str(datetime.datetime.now()))
        LOGGER.info('Status:                Completed')

        LOGGER.info('\n********** Log Import Options **********\n')

        ft = FinancialTerms()

        # Initialize the connection with the server
        try:
            db = Database(server)
            LOGGER.info('Server: ' + str(server))
        except:
            LOGGER.error('Error: Check connection to database server')
            file_skeleton(OUTFILE)
            sys.exit()

        try:
            analysis_sid = db.analysis_sid(analysis_name)
            LOGGER.info('Analysis SID: ' + str(analysis_sid))
        except:
            LOGGER.error(
                'Error: Failed to extract the analysis SID from analysis name')
            file_skeleton(OUTFILE)
            sys.exit()
Exemplo n.º 8
0
    try:

        start = time.time()
        LOGGER.info('********************************')
        LOGGER.info('**      Touchstone v.3.0      **')
        LOGGER.info('********************************')

        LOGGER.info('\n********** Log header **********\n')
        LOGGER.info('Description:   Analysis Option Validation')
        LOGGER.info('Time Submitted: ' + str(datetime.datetime.now()))
        LOGGER.info('Status:                Completed')

        LOGGER.info('\n********** Log Import Options **********\n')
        # Initialize the connection with the server
        try:
            db = Database(server)
        except:
            LOGGER.error('Error: Check connection to database server')
            file_skeleton(OUTFILE)
            sys.exit()

        try:
            analysis_sid = db.analysis_sid(analysis_name)
            LOGGER.info('Analysis SID: ' + str(analysis_sid))
        except:
            LOGGER.error(
                'Error: Failed to extract the analysis SID from analysis name')
            file_skeleton(OUTFILE)
            sys.exit()

        try:
if __name__ == "__main__":

    try:
        start = time.time()

        LOGGER.info('********************************')
        LOGGER.info('**      Touchstone v.3.0      **')
        LOGGER.info('********************************')

        LOGGER.info('\n********** Log header **********\n')
        LOGGER.info('Description:   Import Log Validation')
        LOGGER.info('Time Submitted: ' + str(datetime.datetime.now()))
        LOGGER.info('Status:                Completed')

        db = Database(server)
        if database is not 'All':
            database_list = [database]
        else:
            database_list = db.get_database_list()
        backup_database = []

        excluded_database = ['master', 'model', 'msdb', 'tempdb', 'ReportServer', 'ReportServerTempDB', 'AIRPSOLD',
                             'AIRGeography', 'AIRSpatial', 'AIRReference', 'AIRIndustry', 'AIRDQIndustry', 'AIRMap',
                             'AIRMapBoundary', 'AIRDBAdmin', 'AIRAddressServer', 'ReportServer$SQL2012',
                             'ReportServer$SQL2012TempDB', 'HPCDiagnostics', 'HPCManagement', 'HPCMonitoring',
                             'HPCReporting', 'HPCScheduler', 'ReportServer', 'ReportServerTempDB',
                             'AIRPropertyExposure', 'AIRLossCost']
        for i in range(len(database_list)):
            if database_list[i] not in excluded_database:
                backup_database.append(str(database_list[i]))