From 96347e217cfdd88fef048e57b8b63e60a2457a84 Mon Sep 17 00:00:00 2001 From: yangdsh Date: Mon, 25 May 2020 04:58:34 +0000 Subject: [PATCH] Upgrade integration tests for testing algorithm performance --- client/driver/fabfile.py | 92 ++- .../integrationTests/data/x__knobs.json | 1 + .../data/x__metrics_after.json | 1 + .../data/x__metrics_before.json | 581 ++++++++++++++++++ .../integrationTests/data/x__summary.json | 1 + server/website/website/views.py | 8 +- 6 files changed, 680 insertions(+), 4 deletions(-) create mode 100644 client/driver/integrationTests/data/x__knobs.json create mode 100644 client/driver/integrationTests/data/x__metrics_after.json create mode 100644 client/driver/integrationTests/data/x__metrics_before.json create mode 100644 client/driver/integrationTests/data/x__summary.json diff --git a/client/driver/fabfile.py b/client/driver/fabfile.py index 20c6a2e..1db0eaa 100644 --- a/client/driver/fabfile.py +++ b/client/driver/fabfile.py @@ -943,7 +943,7 @@ def wait_pipeline_data_ready(max_time_sec=800, interval_sec=10): @task -def integration_tests(): +def integration_tests_simple(): # Create test website response = requests.get(dconf.WEBSITE_URL + '/test/create/') @@ -1029,3 +1029,93 @@ def task_status_ui_test(): assert 'Success:' in get_content(response) LOG.info("\n\nTask Status UI Tests: PASSED!!\n") + + +def simulate_db_run(i, next_conf): + # Using 1 knob to decide performance; simple but effective + gain = int(next_conf['effective_cache_size'].replace('kB', '')) + + with open('./integrationTests/data/x__metrics_after.json', 'r') as fin: + metrics_after = json.load(fin) + metrics_after['local']['database']['pg_stat_database']['tpcc']['xact_commit'] = gain + with open('./integrationTests/data/x__metrics_after.json', 'w') as fout: + json.dump(metrics_after, fout) + with open('./integrationTests/data/x__knobs.json', 'r') as fin: + knobs = json.load(fin) + for knob in next_conf: + knobs['global']['global'][knob] = next_conf[knob] + with open('./integrationTests/data/x__knobs.json', 'w') as fout: + json.dump(knobs, fout) + with open('./integrationTests/data/x__summary.json', 'r') as fin: + summary = json.load(fin) + summary['start_time'] = i * 20000000 + summary['observation_time'] = 100 + summary['end_time'] = (i + 1) * 20000000 + with open('./integrationTests/data/x__summary.json', 'w') as fout: + json.dump(summary, fout) + return gain + + +@task +def integration_tests(): + # Create test website + response = requests.get(dconf.WEBSITE_URL + '/test/create/') + LOG.info(get_content(response)) + + # Upload training data + LOG.info('Upload training data to no tuning session') + upload_batch(result_dir='./integrationTests/data/', upload_code='ottertuneTestNoTuning') + + # periodic tasks haven't ran, lhs result returns. + LOG.info('Test no pipeline data, LHS returned') + upload_result(result_dir='./integrationTests/data/', prefix='0__', + upload_code='ottertuneTestTuningGPR') + response = get_result(upload_code='ottertuneTestTuningGPR') + assert response['status'] == 'lhs' + + # wait celery periodic task finishes + assert wait_pipeline_data_ready(), "Pipeline data failed" + + total_n = 30 + first_n = 5 + last_n = 5 + average = 0 + simulate_db_run(1, {'effective_cache_size': '0kB'}) + for i in range(2, total_n + 2): + LOG.info('Test GPR (gaussian process regression)') + upload_result(result_dir='./integrationTests/data/', prefix='x__', + upload_code='ottertuneTestTuningGPR') + response = get_result(upload_code='ottertuneTestTuningGPR') + assert response['status'] == 'good' + gain = simulate_db_run(i, response['recommendation']) + if i < first_n + 2: + average += gain / first_n + elif i > total_n - last_n + 2: + assert gain > average + + average = 0 + simulate_db_run(1, {'effective_cache_size': '0kB'}) + for i in range(2, total_n + 2): + LOG.info('Test DNN (deep neural network)') + upload_result(result_dir='./integrationTests/data/', prefix='x__', + upload_code='ottertuneTestTuningDNN') + response = get_result(upload_code='ottertuneTestTuningDNN') + assert response['status'] == 'good' + gain = simulate_db_run(i, response['recommendation']) + if i < first_n + 2: + average += gain / first_n + elif i > total_n - last_n + 2: + assert gain > average + + average = 0 + simulate_db_run(1, {'effective_cache_size': '0kB'}) + for i in range(2, total_n + 2): + upload_result(result_dir='./integrationTests/data/', prefix='x__', + upload_code='ottertuneTestTuningDDPG') + response = get_result(upload_code='ottertuneTestTuningDDPG') + assert response['status'] == 'good' + gain = simulate_db_run(i, response['recommendation']) + if i < first_n + 2: + average += gain / first_n + elif i > total_n - last_n + 2: + assert gain > average diff --git a/client/driver/integrationTests/data/x__knobs.json b/client/driver/integrationTests/data/x__knobs.json new file mode 100644 index 0000000..1c00ae3 --- /dev/null +++ b/client/driver/integrationTests/data/x__knobs.json @@ -0,0 +1 @@ +{"global": {"global": {"DateStyle": "ISO, MDY", "IntervalStyle": "postgres", "TimeZone": "America/New_York", "allow_system_table_mods": "off", "application_name": "", "archive_command": "(disabled)", "archive_mode": "off", "archive_timeout": "0", "array_nulls": "on", "authentication_timeout": "1min", "autovacuum": "off", "autovacuum_analyze_scale_factor": "0.1", "autovacuum_analyze_threshold": "50", "autovacuum_freeze_max_age": "200000000", "autovacuum_max_workers": "3", "autovacuum_multixact_freeze_max_age": "400000000", "autovacuum_naptime": "1min", "autovacuum_vacuum_cost_delay": "20ms", "autovacuum_vacuum_cost_limit": "-1", "autovacuum_vacuum_scale_factor": "0.2", "autovacuum_vacuum_threshold": "50", "autovacuum_work_mem": "-1", "backend_flush_after": "0", "backslash_quote": "safe_encoding", "bgwriter_delay": "200ms", "bgwriter_flush_after": "512kB", "bgwriter_lru_maxpages": "1000", "bgwriter_lru_multiplier": "2", "block_size": "8192", "bonjour": "off", "bonjour_name": "", "bytea_output": "hex", "check_function_bodies": "on", "checkpoint_completion_target": "0.572503", "checkpoint_flush_after": "256kB", "checkpoint_timeout": "1min", "checkpoint_warning": "30s", "client_encoding": "UTF8", "client_min_messages": "notice", "cluster_name": "", "commit_delay": "0", "commit_siblings": "5", "config_file": "/etc/postgresql/9.6/main/postgresql.conf", "constraint_exclusion": "partition", "cpu_index_tuple_cost": "0.005", "cpu_operator_cost": "0.0025", "cpu_tuple_cost": "0.01", "cursor_tuple_fraction": "0.1", "data_checksums": "off", "data_directory": "/ssd1/postgres/main", "data_sync_retry": "off", "db_user_namespace": "off", "deadlock_timeout": "1s", "debug_assertions": "off", "debug_pretty_print": "on", "debug_print_parse": "off", "debug_print_plan": "off", "debug_print_rewritten": "off", "default_statistics_target": "265", "default_tablespace": "", "default_text_search_config": "pg_catalog.english", "default_transaction_deferrable": "off", "default_transaction_isolation": "read committed", "default_transaction_read_only": "off", "default_with_oids": "off", "dynamic_library_path": "$libdir", "dynamic_shared_memory_type": "posix", "effective_cache_size": "13421773kB", "effective_io_concurrency": "1", "enable_bitmapscan": "on", "enable_hashagg": "on", "enable_hashjoin": "on", "enable_indexonlyscan": "on", "enable_indexscan": "on", "enable_material": "on", "enable_mergejoin": "on", "enable_nestloop": "on", "enable_seqscan": "on", "enable_sort": "on", "enable_tidscan": "on", "escape_string_warning": "on", "event_source": "PostgreSQL", "exit_on_error": "off", "external_pid_file": "/var/run/postgresql/9.6-main.pid", "extra_float_digits": "3", "force_parallel_mode": "off", "from_collapse_limit": "8", "fsync": "on", "full_page_writes": "on", "geqo": "on", "geqo_effort": "5", "geqo_generations": "0", "geqo_pool_size": "0", "geqo_seed": "0", "geqo_selection_bias": "2", "geqo_threshold": "12", "gin_fuzzy_search_limit": "0", "gin_pending_list_limit": "4MB", "hba_file": "/etc/postgresql/9.6/main/pg_hba.conf", "hot_standby": "off", "hot_standby_feedback": "off", "huge_pages": "try", "ident_file": "/etc/postgresql/9.6/main/pg_ident.conf", "idle_in_transaction_session_timeout": "0", "ignore_checksum_failure": "off", "ignore_system_indexes": "off", "integer_datetimes": "on", "join_collapse_limit": "8", "krb_caseins_users": "off", "krb_server_keyfile": "FILE:/etc/postgresql-common/krb5.keytab", "lc_collate": "en_US.UTF-8", "lc_ctype": "en_US.UTF-8", "lc_messages": "en_US.UTF-8", "lc_monetary": "en_US.UTF-8", "lc_numeric": "en_US.UTF-8", "lc_time": "en_US.UTF-8", "listen_addresses": "localhost", "lo_compat_privileges": "off", "local_preload_libraries": "", "lock_timeout": "0", "log_autovacuum_min_duration": "-1", "log_checkpoints": "off", "log_connections": "off", "log_destination": "stderr", "log_directory": "pg_log", "log_disconnections": "off", "log_duration": "off", "log_error_verbosity": "default", "log_executor_stats": "off", "log_file_mode": "0600", "log_filename": "postgresql-%Y-%m-%d_%H%M%S.log", "log_hostname": "off", "log_line_prefix": "%t [%p-%l] %q%u@%d ", "log_lock_waits": "off", "log_min_duration_statement": "-1", "log_min_error_statement": "error", "log_min_messages": "warning", "log_parser_stats": "off", "log_planner_stats": "off", "log_replication_commands": "off", "log_rotation_age": "1d", "log_rotation_size": "10MB", "log_statement": "none", "log_statement_stats": "off", "log_temp_files": "-1", "log_timezone": "America/New_York", "log_truncate_on_rotation": "off", "logging_collector": "off", "maintenance_work_mem": "16MB", "max_connections": "300", "max_files_per_process": "1000", "max_function_args": "100", "max_identifier_length": "63", "max_index_keys": "32", "max_locks_per_transaction": "64", "max_parallel_workers_per_gather": "3", "max_pred_locks_per_transaction": "64", "max_prepared_transactions": "0", "max_replication_slots": "0", "max_stack_depth": "2MB", "max_standby_archive_delay": "30s", "max_standby_streaming_delay": "30s", "max_wal_senders": "0", "max_wal_size": "25798986kB", "max_worker_processes": 8, "min_parallel_relation_size": "8MB", "min_wal_size": "80MB", "old_snapshot_threshold": "-1", "operator_precedence_warning": "off", "parallel_setup_cost": "1000", "parallel_tuple_cost": "0.1", "password_encryption": "on", "port": "5432", "post_auth_delay": "0", "pre_auth_delay": "0", "quote_all_identifiers": "off", "random_page_cost": "4.29795", "replacement_sort_tuples": "150000", "restart_after_crash": "on", "row_security": "on", "search_path": "\"$user\", public", "segment_size": "1GB", "seq_page_cost": "1", "server_encoding": "UTF8", "server_version": "9.6.15", "server_version_num": "90615", "session_preload_libraries": "", "session_replication_role": "origin", "shared_buffers": "13421772kB", "shared_preload_libraries": "", "sql_inheritance": "on", "ssl": "on", "ssl_ca_file": "", "ssl_cert_file": "/etc/ssl/certs/ssl-cert-snakeoil.pem", "ssl_ciphers": "HIGH:MEDIUM:+3DES:!aNULL", "ssl_crl_file": "", "ssl_ecdh_curve": "prime256v1", "ssl_key_file": "/etc/ssl/private/ssl-cert-snakeoil.key", "ssl_prefer_server_ciphers": "on", "standard_conforming_strings": "on", "statement_timeout": "0", "stats_temp_directory": "/var/run/postgresql/9.6-main.pg_stat_tmp", "superuser_reserved_connections": "3", "synchronize_seqscans": "on", "synchronous_commit": "on", "synchronous_standby_names": "", "syslog_facility": "local0", "syslog_ident": "postgres", "syslog_sequence_numbers": "on", "syslog_split_messages": "on", "tcp_keepalives_count": "9", "tcp_keepalives_idle": "7200", "tcp_keepalives_interval": "75", "temp_buffers": "242906kB", "temp_file_limit": "-1", "temp_tablespaces": "", "timezone_abbreviations": "Default", "trace_notify": "off", "trace_recovery_messages": "log", "trace_sort": "off", "track_activities": "on", "track_activity_query_size": "1024", "track_commit_timestamp": "off", "track_counts": "on", "track_functions": "none", "track_io_timing": "off", "transaction_deferrable": "off", "transaction_isolation": "read committed", "transaction_read_only": "off", "transform_null_equals": "off", "unix_socket_directories": "/var/run/postgresql", "unix_socket_group": "", "unix_socket_permissions": "0777", "update_process_title": "on", "vacuum_cost_delay": "0", "vacuum_cost_limit": "200", "vacuum_cost_page_dirty": "20", "vacuum_cost_page_hit": "1", "vacuum_cost_page_miss": "10", "vacuum_defer_cleanup_age": "0", "vacuum_freeze_min_age": "50000000", "vacuum_freeze_table_age": "150000000", "vacuum_multixact_freeze_min_age": "5000000", "vacuum_multixact_freeze_table_age": "150000000", "wal_block_size": "8192", "wal_buffers": "109800kB", "wal_compression": "off", "wal_keep_segments": "0", "wal_level": "minimal", "wal_log_hints": "off", "wal_receiver_status_interval": "10s", "wal_receiver_timeout": "1min", "wal_retrieve_retry_interval": "5s", "wal_segment_size": "16MB", "wal_sender_timeout": "1min", "wal_sync_method": "fdatasync", "wal_writer_delay": "200ms", "wal_writer_flush_after": "1MB", "work_mem": "17213kB", "xmlbinary": "base64", "xmloption": "content", "zero_damaged_pages": "off"}}, "local": null} \ No newline at end of file diff --git a/client/driver/integrationTests/data/x__metrics_after.json b/client/driver/integrationTests/data/x__metrics_after.json new file mode 100644 index 0000000..d1ac834 --- /dev/null +++ b/client/driver/integrationTests/data/x__metrics_after.json @@ -0,0 +1 @@ +{"global": {"pg_stat_archiver": {"archived_count": "0", "failed_count": "0", "stats_reset": "2019-09-11 21:28:47.239843-04"}, "pg_stat_bgwriter": {"buffers_alloc": "3708990663", "buffers_backend": "1747699460", "buffers_backend_fsync": "0", "buffers_checkpoint": "1838883093", "buffers_clean": "90785506", "checkpoint_sync_time": "13818100", "checkpoint_write_time": "214789605", "checkpoints_req": "9958", "checkpoints_timed": "2925", "maxwritten_clean": "291284", "stats_reset": "2019-09-11 21:28:47.239843-04"}}, "local": {"table": {"pg_stat_user_tables": {"customer": {"analyze_count": "0", "autoanalyze_count": "1", "autovacuum_count": "0", "idx_scan": "1529548", "idx_tup_fetch": "7914511", "last_autoanalyze": "2019-10-01 01:58:54.728893-04", "n_dead_tup": "470507", "n_live_tup": "5999969", "n_mod_since_analyze": "473247", "n_tup_del": "0", "n_tup_hot_upd": "25593", "n_tup_ins": "6000000", "n_tup_upd": "473247", "relid": "48704", "relname": "customer", "schemaname": "public", "seq_scan": "4", "seq_tup_read": "24000000", "vacuum_count": "0"}, "warehouse": {"analyze_count": "0", "autoanalyze_count": "4", "autovacuum_count": "3", "idx_scan": "752519", "idx_tup_fetch": "752519", "last_autoanalyze": "2019-10-01 02:06:15.381455-04", "last_autovacuum": "2019-10-01 02:06:14.304752-04", "n_dead_tup": "231124", "n_live_tup": "200", "n_mod_since_analyze": "0", "n_tup_del": "0", "n_tup_hot_upd": "237149", "n_tup_ins": "200", "n_tup_upd": "246017", "relid": "48734", "relname": "warehouse", "schemaname": "public", "seq_scan": "77", "seq_tup_read": "15400", "vacuum_count": "0"}, "new_order": {"analyze_count": "0", "autoanalyze_count": "2", "autovacuum_count": "0", "idx_scan": "454461", "idx_tup_fetch": "2146543", "last_autoanalyze": "2019-10-01 02:04:03.755589-04", "n_dead_tup": "214108", "n_live_tup": "1710880", "n_mod_since_analyze": "187083", "n_tup_del": "227230", "n_tup_hot_upd": "0", "n_tup_ins": "1950470", "n_tup_upd": "0", "relid": "48721", "relname": "new_order", "schemaname": "public", "seq_scan": "1", "seq_tup_read": "1692083", "vacuum_count": "0"}, "order_line": {"analyze_count": "0", "autoanalyze_count": "0", "autovacuum_count": "0", "idx_scan": "500404", "idx_tup_fetch": "69361608", "n_dead_tup": "2213123", "n_live_tup": "62548466", "n_mod_since_analyze": "64818561", "n_tup_del": "0", "n_tup_hot_upd": "78766", "n_tup_ins": "62548466", "n_tup_upd": "2270095", "relid": "48728", "relname": "order_line", "schemaname": "public", "seq_scan": "2", "seq_tup_read": "119990886", "vacuum_count": "0"}, "history": {"analyze_count": "0", "autoanalyze_count": "1", "autovacuum_count": "0", "last_autoanalyze": "2019-10-01 01:53:35.074571-04", "n_dead_tup": "0", "n_live_tup": "6246017", "n_mod_since_analyze": "246017", "n_tup_del": "0", "n_tup_hot_upd": "0", "n_tup_ins": "6246017", "n_tup_upd": "0", "relid": "48714", "relname": "history", "schemaname": "public", "seq_scan": "2", "seq_tup_read": "12000000", "vacuum_count": "0"}, "item": {"analyze_count": "0", "autoanalyze_count": "1", "autovacuum_count": "0", "idx_scan": "2581423", "idx_tup_fetch": "2578787", "last_autoanalyze": "2019-10-01 02:04:54.904867-04", "n_dead_tup": "0", "n_live_tup": "100000", "n_mod_since_analyze": "0", "n_tup_del": "0", "n_tup_hot_upd": "0", "n_tup_ins": "100000", "n_tup_upd": "0", "relid": "48718", "relname": "item", "schemaname": "public", "seq_scan": "2", "seq_tup_read": "200000", "vacuum_count": "0"}, "stock": {"analyze_count": "0", "autoanalyze_count": "0", "autovacuum_count": "0", "idx_scan": "72275089", "idx_tup_fetch": "72275089", "n_dead_tup": "2486403", "n_live_tup": "20000000", "n_mod_since_analyze": "22553023", "n_tup_del": "0", "n_tup_hot_upd": "152030", "n_tup_ins": "20000000", "n_tup_upd": "2553023", "relid": "48731", "relname": "stock", "schemaname": "public", "seq_scan": "3", "seq_tup_read": "60000000", "vacuum_count": "0"}, "oorder": {"analyze_count": "0", "autoanalyze_count": "1", "autovacuum_count": "0", "idx_scan": "3288789", "idx_tup_fetch": "21288786", "last_autoanalyze": "2019-10-01 01:53:45.816842-04", "n_dead_tup": "218977", "n_live_tup": "6255751", "n_mod_since_analyze": "482981", "n_tup_del": "0", "n_tup_hot_upd": "11847", "n_tup_ins": "6258387", "n_tup_upd": "227230", "relid": "48724", "relname": "oorder", "schemaname": "public", "seq_scan": "3", "seq_tup_read": "18000000", "vacuum_count": "0"}, "district": {"analyze_count": "0", "autoanalyze_count": "4", "autovacuum_count": "3", "idx_scan": "1277852", "idx_tup_fetch": "1277852", "last_autoanalyze": "2019-10-01 02:06:10.033539-04", "last_autovacuum": "2019-10-01 02:06:07.202845-04", "n_dead_tup": "470373", "n_live_tup": "1517", "n_mod_since_analyze": "5586", "n_tup_del": "0", "n_tup_hot_upd": "387047", "n_tup_ins": "2000", "n_tup_upd": "504404", "relid": "48711", "relname": "district", "schemaname": "public", "seq_scan": "4", "seq_tup_read": "8000", "vacuum_count": "0"}}, "pg_statio_user_tables": {"order_line": {"heap_blks_hit": "22592502", "heap_blks_read": "3340995", "idx_blks_hit": "20979694", "idx_blks_read": "412817", "relid": "48728", "relname": "order_line", "schemaname": "public"}, "oorder": {"heap_blks_hit": "13915738", "heap_blks_read": "176154", "idx_blks_hit": "13284067", "idx_blks_read": "970835", "relid": "48724", "relname": "oorder", "schemaname": "public"}, "item": {"heap_blks_hit": "2477512", "heap_blks_read": "108531", "idx_blks_hit": "5169990", "idx_blks_read": "5154", "relid": "48718", "relname": "item", "schemaname": "public"}, "history": {"heap_blks_hit": "884677", "heap_blks_read": "127882", "relid": "48714", "relname": "history", "schemaname": "public"}, "warehouse": {"heap_blks_hit": "62234799", "heap_blks_read": "4485", "idx_blks_hit": "1665171", "idx_blks_read": "41", "relid": "48734", "relname": "warehouse", "schemaname": "public"}, "stock": {"heap_blks_hit": "138721657", "heap_blks_read": "14304994", "idx_blks_hit": "222732057", "idx_blks_read": "1690343", "relid": "48731", "relname": "stock", "schemaname": "public"}, "new_order": {"heap_blks_hit": "1458870", "heap_blks_read": "305739", "idx_blks_hit": "2237121", "idx_blks_read": "169766", "relid": "48721", "relname": "new_order", "schemaname": "public"}, "customer": {"heap_blks_hit": "3915470", "heap_blks_read": "4256131", "idx_blks_hit": "7012916", "idx_blks_read": "979029", "relid": "48704", "relname": "customer", "schemaname": "public", "tidx_blks_hit": "0", "tidx_blks_read": "0", "toast_blks_hit": "0", "toast_blks_read": "0"}, "district": {"heap_blks_hit": "142213701", "heap_blks_read": "10828", "idx_blks_hit": "3262630", "idx_blks_read": "968", "relid": "48711", "relname": "district", "schemaname": "public"}}}, "database": {"pg_stat_database": {"postgres": {"blk_read_time": "0", "blk_write_time": "0", "blks_hit": "4038068", "blks_read": "254970", "conflicts": "0", "datid": "12439", "datname": "postgres", "deadlocks": "0", "numbackends": "0", "stats_reset": "2019-09-11 21:28:47.953315-04", "temp_bytes": "0", "temp_files": "0", "tup_deleted": "0", "tup_fetched": "1796514", "tup_inserted": "0", "tup_returned": "25038018", "tup_updated": "14", "xact_commit": "66618", "xact_rollback": "11"}, "tpcc": {"blk_read_time": "0", "blk_write_time": "0", "blks_hit": "664877271", "blks_read": "26866169", "conflicts": "0", "datid": "48703", "datname": "tpcc", "deadlocks": "0", "numbackends": "3", "stats_reset": "2019-10-01 01:52:19.906323-04", "temp_bytes": "2081841152", "temp_files": "3", "tup_deleted": "227322", "tup_fetched": "177684291", "tup_inserted": "103106512", "tup_returned": "699470745", "tup_updated": "6274134", "xact_commit": 13421773, "xact_rollback": "2637"}, "template1": {"blk_read_time": "0", "blk_write_time": "0", "blks_hit": "2794174", "blks_read": "109860", "conflicts": "0", "datid": "1", "datname": "template1", "deadlocks": "0", "numbackends": "0", "stats_reset": "2019-09-11 22:05:20.533143-04", "temp_bytes": "0", "temp_files": "0", "tup_deleted": "0", "tup_fetched": "953250", "tup_inserted": "0", "tup_returned": "21940167", "tup_updated": "0", "xact_commit": "52258", "xact_rollback": "0"}, "template0": {"blk_read_time": "0", "blk_write_time": "0", "blks_hit": "1775116", "blks_read": "67108", "conflicts": "0", "datid": "12438", "datname": "template0", "deadlocks": "0", "numbackends": "0", "stats_reset": "2019-09-17 02:25:02.20631-04", "temp_bytes": "0", "temp_files": "0", "tup_deleted": "0", "tup_fetched": "570378", "tup_inserted": "0", "tup_returned": "15671359", "tup_updated": "13", "xact_commit": "31735", "xact_rollback": "0"}}, "pg_stat_database_conflicts": {"postgres": {"confl_bufferpin": "0", "confl_deadlock": "0", "confl_lock": "0", "confl_snapshot": "0", "confl_tablespace": "0", "datid": "12439", "datname": "postgres"}, "tpcc": {"confl_bufferpin": "0", "confl_deadlock": "0", "confl_lock": "0", "confl_snapshot": "0", "confl_tablespace": "0", "datid": "48703", "datname": "tpcc"}, "template1": {"confl_bufferpin": "0", "confl_deadlock": "0", "confl_lock": "0", "confl_snapshot": "0", "confl_tablespace": "0", "datid": "1", "datname": "template1"}, "template0": {"confl_bufferpin": "0", "confl_deadlock": "0", "confl_lock": "0", "confl_snapshot": "0", "confl_tablespace": "0", "datid": "12438", "datname": "template0"}}}, "indexes": {"pg_stat_user_indexes": {"district": {"idx_scan": "1277852", "idx_tup_fetch": "1131350", "idx_tup_read": "126828104", "indexrelid": "48748", "indexrelname": "district_pkey", "relid": "48711", "relname": "district", "schemaname": "public"}, "warehouse": {"idx_scan": "752519", "idx_tup_fetch": "562721", "idx_tup_read": "60913162", "indexrelid": "48750", "indexrelname": "warehouse_pkey", "relid": "48734", "relname": "warehouse", "schemaname": "public"}, "item": {"idx_scan": "2581423", "idx_tup_fetch": "2578787", "idx_tup_read": "2578787", "indexrelid": "48757", "indexrelname": "item_pkey", "relid": "48718", "relname": "item", "schemaname": "public"}, "new_order": {"idx_scan": "454461", "idx_tup_fetch": "2146543", "idx_tup_read": "47882665", "indexrelid": "48759", "indexrelname": "new_order_pkey", "relid": "48721", "relname": "new_order", "schemaname": "public"}, "oorder": {"idx_scan": "22917", "idx_tup_fetch": "6022916", "idx_tup_read": "6024235", "indexrelid": "48781", "indexrelname": "idx_order", "relid": "48724", "relname": "oorder", "schemaname": "public"}, "customer": {"idx_scan": "161174", "idx_tup_fetch": "546138", "idx_tup_read": "684041", "indexrelid": "48797", "indexrelname": "idx_customer_name", "relid": "48704", "relname": "customer", "schemaname": "public"}, "order_line": {"idx_scan": "500404", "idx_tup_fetch": "69361608", "idx_tup_read": "71566067", "indexrelid": "48813", "indexrelname": "order_line_pkey", "relid": "48728", "relname": "order_line", "schemaname": "public"}, "stock": {"idx_scan": "72275089", "idx_tup_fetch": "59995443", "idx_tup_read": "124088647", "indexrelid": "48815", "indexrelname": "stock_pkey", "relid": "48731", "relname": "stock", "schemaname": "public"}}, "pg_statio_user_indexes": {"district": {"idx_blks_hit": "3262630", "idx_blks_read": "968", "indexrelid": "48748", "indexrelname": "district_pkey", "relid": "48711", "relname": "district", "schemaname": "public"}, "warehouse": {"idx_blks_hit": "1665171", "idx_blks_read": "41", "indexrelid": "48750", "indexrelname": "warehouse_pkey", "relid": "48734", "relname": "warehouse", "schemaname": "public"}, "item": {"idx_blks_hit": "5169990", "idx_blks_read": "5154", "indexrelid": "48757", "indexrelname": "item_pkey", "relid": "48718", "relname": "item", "schemaname": "public"}, "new_order": {"idx_blks_hit": "2237121", "idx_blks_read": "169766", "indexrelid": "48759", "indexrelname": "new_order_pkey", "relid": "48721", "relname": "new_order", "schemaname": "public"}, "oorder": {"idx_blks_hit": "1081419", "idx_blks_read": "449137", "indexrelid": "48781", "indexrelname": "idx_order", "relid": "48724", "relname": "oorder", "schemaname": "public"}, "customer": {"idx_blks_hit": "2012281", "idx_blks_read": "467521", "indexrelid": "48797", "indexrelname": "idx_customer_name", "relid": "48704", "relname": "customer", "schemaname": "public"}, "order_line": {"idx_blks_hit": "20979694", "idx_blks_read": "412817", "indexrelid": "48813", "indexrelname": "order_line_pkey", "relid": "48728", "relname": "order_line", "schemaname": "public"}, "stock": {"idx_blks_hit": "222732057", "idx_blks_read": "1690343", "indexrelid": "48815", "indexrelname": "stock_pkey", "relid": "48731", "relname": "stock", "schemaname": "public"}}}}} \ No newline at end of file diff --git a/client/driver/integrationTests/data/x__metrics_before.json b/client/driver/integrationTests/data/x__metrics_before.json new file mode 100644 index 0000000..8a19f41 --- /dev/null +++ b/client/driver/integrationTests/data/x__metrics_before.json @@ -0,0 +1,581 @@ +{ + "global": { + "pg_stat_archiver": { + "archived_count": "0", + "failed_count": "0", + "stats_reset": "2019-09-11 21:28:47.239843-04" + }, + "pg_stat_bgwriter": { + "buffers_alloc": "3692959832", + "buffers_backend": "1741292048", + "buffers_backend_fsync": "0", + "buffers_checkpoint": "1838672434", + "buffers_clean": "90148655", + "checkpoint_sync_time": "13751757", + "checkpoint_write_time": "214665311", + "checkpoints_req": "9948", + "checkpoints_timed": "2925", + "maxwritten_clean": "290648", + "stats_reset": "2019-09-11 21:28:47.239843-04" + } + }, + "local": { + "table": { + "pg_stat_user_tables": { + "customer": { + "analyze_count": "0", + "autoanalyze_count": "1", + "autovacuum_count": "0", + "idx_scan": "1", + "idx_tup_fetch": "6000000", + "last_autoanalyze": "2019-10-01 01:58:54.728893-04", + "n_dead_tup": "0", + "n_live_tup": "5999969", + "n_mod_since_analyze": "0", + "n_tup_del": "0", + "n_tup_hot_upd": "0", + "n_tup_ins": "6000000", + "n_tup_upd": "0", + "relid": "48704", + "relname": "customer", + "schemaname": "public", + "seq_scan": "4", + "seq_tup_read": "24000000", + "vacuum_count": "0" + }, + "warehouse": { + "analyze_count": "0", + "autoanalyze_count": "1", + "autovacuum_count": "0", + "idx_scan": "0", + "idx_tup_fetch": "0", + "last_autoanalyze": "2019-10-01 01:52:28.446885-04", + "n_dead_tup": "0", + "n_live_tup": "200", + "n_mod_since_analyze": "0", + "n_tup_del": "0", + "n_tup_hot_upd": "0", + "n_tup_ins": "200", + "n_tup_upd": "0", + "relid": "48734", + "relname": "warehouse", + "schemaname": "public", + "seq_scan": "3", + "seq_tup_read": "600", + "vacuum_count": "0" + }, + "new_order": { + "analyze_count": "0", + "autoanalyze_count": "1", + "autovacuum_count": "0", + "idx_scan": "1", + "idx_tup_fetch": "1692083", + "last_autoanalyze": "2019-10-01 01:52:27.655021-04", + "n_dead_tup": "0", + "n_live_tup": "1692083", + "n_mod_since_analyze": "0", + "n_tup_del": "0", + "n_tup_hot_upd": "0", + "n_tup_ins": "1692083", + "n_tup_upd": "0", + "relid": "48721", + "relname": "new_order", + "schemaname": "public", + "seq_scan": "1", + "seq_tup_read": "1692083", + "vacuum_count": "0" + }, + "order_line": { + "analyze_count": "0", + "autoanalyze_count": "0", + "autovacuum_count": "0", + "idx_scan": "1", + "idx_tup_fetch": "59995443", + "n_dead_tup": "0", + "n_live_tup": "59995443", + "n_mod_since_analyze": "59995443", + "n_tup_del": "0", + "n_tup_hot_upd": "0", + "n_tup_ins": "59995443", + "n_tup_upd": "0", + "relid": "48728", + "relname": "order_line", + "schemaname": "public", + "seq_scan": "2", + "seq_tup_read": "119990886", + "vacuum_count": "0" + }, + "history": { + "analyze_count": "0", + "autoanalyze_count": "1", + "autovacuum_count": "0", + "last_autoanalyze": "2019-10-01 01:53:35.074571-04", + "n_dead_tup": "0", + "n_live_tup": "6000000", + "n_mod_since_analyze": "0", + "n_tup_del": "0", + "n_tup_hot_upd": "0", + "n_tup_ins": "6000000", + "n_tup_upd": "0", + "relid": "48714", + "relname": "history", + "schemaname": "public", + "seq_scan": "2", + "seq_tup_read": "12000000", + "vacuum_count": "0" + }, + "item": { + "analyze_count": "0", + "autoanalyze_count": "0", + "autovacuum_count": "0", + "idx_scan": "0", + "idx_tup_fetch": "0", + "n_dead_tup": "0", + "n_live_tup": "100000", + "n_mod_since_analyze": "100000", + "n_tup_del": "0", + "n_tup_hot_upd": "0", + "n_tup_ins": "100000", + "n_tup_upd": "0", + "relid": "48718", + "relname": "item", + "schemaname": "public", + "seq_scan": "2", + "seq_tup_read": "200000", + "vacuum_count": "0" + }, + "stock": { + "analyze_count": "0", + "autoanalyze_count": "0", + "autovacuum_count": "0", + "idx_scan": "59995443", + "idx_tup_fetch": "59995443", + "n_dead_tup": "0", + "n_live_tup": "20000000", + "n_mod_since_analyze": "20000000", + "n_tup_del": "0", + "n_tup_hot_upd": "0", + "n_tup_ins": "20000000", + "n_tup_upd": "0", + "relid": "48731", + "relname": "stock", + "schemaname": "public", + "seq_scan": "3", + "seq_tup_read": "60000000", + "vacuum_count": "0" + }, + "oorder": { + "analyze_count": "0", + "autoanalyze_count": "1", + "autovacuum_count": "0", + "idx_scan": "3", + "idx_tup_fetch": "18000000", + "last_autoanalyze": "2019-10-01 01:53:45.816842-04", + "n_dead_tup": "0", + "n_live_tup": "6000000", + "n_mod_since_analyze": "0", + "n_tup_del": "0", + "n_tup_hot_upd": "0", + "n_tup_ins": "6000000", + "n_tup_upd": "0", + "relid": "48724", + "relname": "oorder", + "schemaname": "public", + "seq_scan": "3", + "seq_tup_read": "18000000", + "vacuum_count": "0" + }, + "district": { + "analyze_count": "0", + "autoanalyze_count": "1", + "autovacuum_count": "0", + "idx_scan": "0", + "idx_tup_fetch": "0", + "last_autoanalyze": "2019-10-01 01:52:29.056627-04", + "n_dead_tup": "0", + "n_live_tup": "2000", + "n_mod_since_analyze": "0", + "n_tup_del": "0", + "n_tup_hot_upd": "0", + "n_tup_ins": "2000", + "n_tup_upd": "0", + "relid": "48711", + "relname": "district", + "schemaname": "public", + "seq_scan": "4", + "seq_tup_read": "8000", + "vacuum_count": "0" + } + }, + "pg_statio_user_tables": { + "order_line": { + "heap_blks_hit": "842040", + "heap_blks_read": "2957855", + "idx_blks_hit": "0", + "idx_blks_read": "229872", + "relid": "48728", + "relname": "order_line", + "schemaname": "public" + }, + "oorder": { + "heap_blks_hit": "6241021", + "heap_blks_read": "97952", + "idx_blks_hit": "2051", + "idx_blks_read": "66928", + "relid": "48724", + "relname": "oorder", + "schemaname": "public" + }, + "item": { + "heap_blks_hit": "2542", + "heap_blks_read": "1271", + "idx_blks_hit": "0", + "idx_blks_read": "1", + "relid": "48718", + "relname": "item", + "schemaname": "public" + }, + "history": { + "heap_blks_hit": "128440", + "heap_blks_read": "124344", + "relid": "48714", + "relname": "history", + "schemaname": "public" + }, + "warehouse": { + "heap_blks_hit": "12", + "heap_blks_read": "3", + "idx_blks_hit": "0", + "idx_blks_read": "1", + "relid": "48734", + "relname": "warehouse", + "schemaname": "public" + }, + "stock": { + "heap_blks_hit": "59117416", + "heap_blks_read": "4360259", + "idx_blks_hit": "180095972", + "idx_blks_read": "54841", + "relid": "48731", + "relname": "stock", + "schemaname": "public" + }, + "new_order": { + "heap_blks_hit": "29895", + "heap_blks_read": "16246", + "idx_blks_hit": "0", + "idx_blks_read": "6487", + "relid": "48721", + "relname": "new_order", + "schemaname": "public" + }, + "customer": { + "heap_blks_hit": "248380", + "heap_blks_read": "2891409", + "idx_blks_hit": "0", + "idx_blks_read": "22993", + "relid": "48704", + "relname": "customer", + "schemaname": "public", + "tidx_blks_hit": "0", + "tidx_blks_read": "0", + "toast_blks_hit": "0", + "toast_blks_read": "0" + }, + "district": { + "heap_blks_hit": "150", + "heap_blks_read": "30", + "idx_blks_hit": "1", + "idx_blks_read": "1", + "relid": "48711", + "relname": "district", + "schemaname": "public" + } + } + }, + "database": { + "pg_stat_database": { + "postgres": { + "blk_read_time": "0", + "blk_write_time": "0", + "blks_hit": "4037127", + "blks_read": "254822", + "conflicts": "0", + "datid": "12439", + "datname": "postgres", + "deadlocks": "0", + "numbackends": "0", + "stats_reset": "2019-09-11 21:28:47.953315-04", + "temp_bytes": "0", + "temp_files": "0", + "tup_deleted": "0", + "tup_fetched": "1796046", + "tup_inserted": "0", + "tup_returned": "25033610", + "tup_updated": "14", + "xact_commit": "66610", + "xact_rollback": "11" + }, + "tpcc": { + "blk_read_time": "0", + "blk_write_time": "0", + "blks_hit": "246720695", + "blks_read": "10830975", + "conflicts": "0", + "datid": "48703", + "datname": "tpcc", + "deadlocks": "0", + "numbackends": "1", + "stats_reset": "2019-10-01 01:52:19.906323-04", + "temp_bytes": "2081841152", + "temp_files": "3", + "tup_deleted": "0", + "tup_fetched": "145689968", + "tup_inserted": "99790620", + "tup_returned": "381590889", + "tup_updated": "55", + "xact_commit": "256", + "xact_rollback": "1" + }, + "template1": { + "blk_read_time": "0", + "blk_write_time": "0", + "blks_hit": "2793953", + "blks_read": "109736", + "conflicts": "0", + "datid": "1", + "datname": "template1", + "deadlocks": "0", + "numbackends": "0", + "stats_reset": "2019-09-11 22:05:20.533143-04", + "temp_bytes": "0", + "temp_files": "0", + "tup_deleted": "0", + "tup_fetched": "953195", + "tup_inserted": "0", + "tup_returned": "21935277", + "tup_updated": "0", + "xact_commit": "52248", + "xact_rollback": "0" + }, + "template0": { + "blk_read_time": "0", + "blk_write_time": "0", + "blks_hit": "1774960", + "blks_read": "66988", + "conflicts": "0", + "datid": "12438", + "datname": "template0", + "deadlocks": "0", + "numbackends": "0", + "stats_reset": "2019-09-17 02:25:02.20631-04", + "temp_bytes": "0", + "temp_files": "0", + "tup_deleted": "0", + "tup_fetched": "570334", + "tup_inserted": "0", + "tup_returned": "15667447", + "tup_updated": "13", + "xact_commit": "31727", + "xact_rollback": "0" + } + }, + "pg_stat_database_conflicts": { + "postgres": { + "confl_bufferpin": "0", + "confl_deadlock": "0", + "confl_lock": "0", + "confl_snapshot": "0", + "confl_tablespace": "0", + "datid": "12439", + "datname": "postgres" + }, + "tpcc": { + "confl_bufferpin": "0", + "confl_deadlock": "0", + "confl_lock": "0", + "confl_snapshot": "0", + "confl_tablespace": "0", + "datid": "48703", + "datname": "tpcc" + }, + "template1": { + "confl_bufferpin": "0", + "confl_deadlock": "0", + "confl_lock": "0", + "confl_snapshot": "0", + "confl_tablespace": "0", + "datid": "1", + "datname": "template1" + }, + "template0": { + "confl_bufferpin": "0", + "confl_deadlock": "0", + "confl_lock": "0", + "confl_snapshot": "0", + "confl_tablespace": "0", + "datid": "12438", + "datname": "template0" + } + } + }, + "indexes": { + "pg_stat_user_indexes": { + "district": { + "idx_scan": "0", + "idx_tup_fetch": "0", + "idx_tup_read": "0", + "indexrelid": "48748", + "indexrelname": "district_pkey", + "relid": "48711", + "relname": "district", + "schemaname": "public" + }, + "warehouse": { + "idx_scan": "0", + "idx_tup_fetch": "0", + "idx_tup_read": "0", + "indexrelid": "48750", + "indexrelname": "warehouse_pkey", + "relid": "48734", + "relname": "warehouse", + "schemaname": "public" + }, + "item": { + "idx_scan": "0", + "idx_tup_fetch": "0", + "idx_tup_read": "0", + "indexrelid": "48757", + "indexrelname": "item_pkey", + "relid": "48718", + "relname": "item", + "schemaname": "public" + }, + "new_order": { + "idx_scan": "1", + "idx_tup_fetch": "1692083", + "idx_tup_read": "1692083", + "indexrelid": "48759", + "indexrelname": "new_order_pkey", + "relid": "48721", + "relname": "new_order", + "schemaname": "public" + }, + "oorder": { + "idx_scan": "1", + "idx_tup_fetch": "6000000", + "idx_tup_read": "6000000", + "indexrelid": "48781", + "indexrelname": "idx_order", + "relid": "48724", + "relname": "oorder", + "schemaname": "public" + }, + "customer": { + "idx_scan": "0", + "idx_tup_fetch": "0", + "idx_tup_read": "0", + "indexrelid": "48797", + "indexrelname": "idx_customer_name", + "relid": "48704", + "relname": "customer", + "schemaname": "public" + }, + "order_line": { + "idx_scan": "1", + "idx_tup_fetch": "59995443", + "idx_tup_read": "59995443", + "indexrelid": "48813", + "indexrelname": "order_line_pkey", + "relid": "48728", + "relname": "order_line", + "schemaname": "public" + }, + "stock": { + "idx_scan": "59995443", + "idx_tup_fetch": "59995443", + "idx_tup_read": "59995443", + "indexrelid": "48815", + "indexrelname": "stock_pkey", + "relid": "48731", + "relname": "stock", + "schemaname": "public" + } + }, + "pg_statio_user_indexes": { + "district": { + "idx_blks_hit": "1", + "idx_blks_read": "1", + "indexrelid": "48748", + "indexrelname": "district_pkey", + "relid": "48711", + "relname": "district", + "schemaname": "public" + }, + "warehouse": { + "idx_blks_hit": "0", + "idx_blks_read": "1", + "indexrelid": "48750", + "indexrelname": "warehouse_pkey", + "relid": "48734", + "relname": "warehouse", + "schemaname": "public" + }, + "item": { + "idx_blks_hit": "0", + "idx_blks_read": "1", + "indexrelid": "48757", + "indexrelname": "item_pkey", + "relid": "48718", + "relname": "item", + "schemaname": "public" + }, + "new_order": { + "idx_blks_hit": "0", + "idx_blks_read": "6487", + "indexrelid": "48759", + "indexrelname": "new_order_pkey", + "relid": "48721", + "relname": "new_order", + "schemaname": "public" + }, + "oorder": { + "idx_blks_hit": "1", + "idx_blks_read": "22992", + "indexrelid": "48781", + "indexrelname": "idx_order", + "relid": "48724", + "relname": "oorder", + "schemaname": "public" + }, + "customer": { + "idx_blks_hit": "0", + "idx_blks_read": "1", + "indexrelid": "48797", + "indexrelname": "idx_customer_name", + "relid": "48704", + "relname": "customer", + "schemaname": "public" + }, + "order_line": { + "idx_blks_hit": "0", + "idx_blks_read": "229872", + "indexrelid": "48813", + "indexrelname": "order_line_pkey", + "relid": "48728", + "relname": "order_line", + "schemaname": "public" + }, + "stock": { + "idx_blks_hit": "180095972", + "idx_blks_read": "54841", + "indexrelid": "48815", + "indexrelname": "stock_pkey", + "relid": "48731", + "relname": "stock", + "schemaname": "public" + } + } + } + } +} diff --git a/client/driver/integrationTests/data/x__summary.json b/client/driver/integrationTests/data/x__summary.json new file mode 100644 index 0000000..3a86dea --- /dev/null +++ b/client/driver/integrationTests/data/x__summary.json @@ -0,0 +1 @@ +{"start_time": 620000000, "end_time": 640000000, "observation_time": 100, "database_type": "postgres", "database_version": "9.6", "workload_name": "tpcc"} \ No newline at end of file diff --git a/server/website/website/views.py b/server/website/website/views.py index e1a49eb..b0c6b7f 100644 --- a/server/website/website/views.py +++ b/server/website/website/views.py @@ -1784,10 +1784,12 @@ def alt_create_or_edit_session(request): @csrf_exempt def pipeline_data_ready(request): # pylint: disable=unused-argument LOG.debug("Latest pipeline run: %s", PipelineRun.objects.get_latest()) - if PipelineRun.objects.get_latest() is None: - response = "Pipeline data ready: False" - else: + newest_result = Result.objects.filter().order_by('-pk')[0] + pipeline_data = PipelineData.objects.filter(workload=newest_result.workload).order_by('-pk') + if pipeline_data.exists() and pipeline_data[0].pipeline_run.end_time is not None: response = "Pipeline data ready: True" + else: + response = "Pipeline data ready: False" return HttpResponse(response)