def backup_kusto_test(client, benchmark_run): CLperfDB.benchmark_start_time(benchmark_run) CLperfDB.benchmark_end_time(benchmark_run) print(benchmark_run.start_time) print(benchmark_run.end_time) if benchmark_run.start_time is None or benchmark_run.end_time is None: return -1 query_ = re.sub("start_time_variable", benchmark_run.start_time, backup_query) query_ = re.sub("end_time_variable", benchmark_run.end_time, query_) query_ = re.sub("server_name_variable", benchmark_run.get_logical_server_name(), query_) print("Querying kusto (backup info)") print("Query text \n " + query_) try: backup_response = client.execute("sqlazure1", query_) backup_df = dataframe_from_result_table( backup_response.primary_results[0]) return backup_df['backup_duration_min'].max() except: return -2
def read_result(benchmark_run, kusto_client): run_id = benchmark_run.run_id start_time = CLperfDB.benchmark_start_time(benchmark_run) end_time = CLperfDB.benchmark_end_time(benchmark_run) max_outstanding_io = benchmark_run.config_overrides.config_dict[ 'SQL.Config_RgSettings_LocalVolumeMaxOutstandingIo'] volume_io_request_size_bytes = benchmark_run.config_overrides.config_dict[ 'SQL.Config_RgSettings_LocalVolumeIORequestSizeBytes'] max_log_rate = benchmark_run.property_overrides.instance_settings_dict[ 'MaxLogRate'] results = CLperfDB.read_results_benchmark(benchmark_run) try: transactions_per_minute = results['Transactions per minute'] except: transactions_per_minute = None try: response_time_90th_percentile = results['90th percentile'] except: response_time_90th_percentile = None failover_kusto_test = KustoFailover.failover_kusto_test( kusto_client, benchmark_run) backup_kusto_test = KustoBackup.backup_kusto_test( kusto_client, benchmark_run) return Result(run_id, max_outstanding_io, volume_io_request_size_bytes, max_log_rate, start_time, end_time, transactions_per_minute, response_time_90th_percentile, failover_kusto_test, backup_kusto_test)
def failover_kusto_test(client, benchmark_run): start_time_variable = CLperfDB.benchmark_start_time(benchmark_run) end_time_variable = CLperfDB.benchmark_end_time(benchmark_run) if start_time_variable is None or end_time_variable is None: return (-1, -1) query_ = re.sub("start_time_variable", start_time_variable, hadr_replica_states_query) query_ = re.sub("end_time_variable", end_time_variable, query_) query_ = re.sub("server_name_variable", benchmark_run.get_logical_server_name(), query_) print("Querying kusto (failover info)") print("Query text \n " + query_) try: failover_response = client.execute("sqlazure1", query_) failover_df = dataframe_from_result_table( failover_response.primary_results[0]) redo_stats_avg = failover_df['redo_stats_avg'].max() failover_time_stats_max = failover_df['failover_time_stats_max'].max() a = (redo_stats_avg, failover_time_stats_max) return a except: return (-2, -2)
benchmark_configs_object = Benchmark_Configs( action_name="TPCC", processor_count=8, is_bc=1, hardware_generation="SVMLoose", environment="SVMStage", should_restore=0, priority=100, worker_number=100, benchmark_scaling_argument=10500, scaled_down=1, server_name= "clperftesting-gen5-bc8-loose24-neu-00.neu187d1a144a72d.sqltest-eg1.mscds.com", database_name="tpcc10500", warmup_timespan_minutes=1, run_timespan_minutes=5, custom_master_tsql_query="", required_processor_count=15, scheduled_by="v-dukut", comment="Scheduled from python") run = Benchmark_run.make_random_run(connection, benchmark_configs_object) run.scheduled_benchmark_id = 4257 run.run_id = 6 CLperfDB.benchmark_start_time(run) CLperfDB.benchmark_end_time(run) result = KustoBackup.backup_kusto_test(client, run) print(result)