Removed obsolete methods from parser and fields from Session model

This commit is contained in:
Dana Van Aken 2019-10-01 21:11:46 -04:00
parent b3c42a81fb
commit c14a337695
11 changed files with 8 additions and 127 deletions

View File

@ -154,9 +154,6 @@ class BaseParserTests(object, metaclass=ABCMeta):
def test_create_knob_configuration(self):
pass
def test_get_nondefault_knob_settings(self):
self.assertEqual(self.test_dbms.get_nondefault_knob_settings({}), {})
def test_format_bool(self):
mock_other_knob = mock.Mock(spec=KnobCatalog)
mock_other_knob.unit = KnobUnitType.OTHER
@ -279,27 +276,7 @@ class PostgresParserTests(BaseParserTests, TestCase):
self.assertEqual(test_convert_metrics.get('pg_FAKE_METRIC'), None)
def test_properties(self):
base_config = self.test_dbms.base_configuration_settings
base_config_set = set(base_config)
self.assertTrue('global.data_directory' in base_config_set)
self.assertTrue('global.hba_file' in base_config_set)
self.assertTrue('global.ident_file' in base_config_set)
self.assertTrue('global.external_pid_file' in base_config_set)
self.assertTrue('global.listen_addresses' in base_config_set)
self.assertTrue('global.port' in base_config_set)
self.assertTrue('global.max_connections' in base_config_set)
self.assertTrue('global.unix_socket_directories' in base_config_set)
self.assertTrue('global.log_line_prefix' in base_config_set)
self.assertTrue('global.track_counts' in base_config_set)
self.assertTrue('global.track_io_timing' in base_config_set)
self.assertTrue('global.autovacuum' in base_config_set)
self.assertTrue('global.default_text_search_config' in base_config_set)
self.assertEqual(self.test_dbms
.knob_configuration_filename, 'postgresql.conf')
self.assertEqual(self.test_dbms
.transactions_counter, 'pg_stat_database.xact_commit')
self.assertEqual(self.test_dbms.transactions_counter, 'pg_stat_database.xact_commit')
def test_parse_version_string(self):
self.assertTrue(self.test_dbms.parse_version_string("9.6.1"), "9.6")

View File

@ -34,7 +34,6 @@
"upload_code": "1234567890",
"tuning_session": "no_tuning_session",
"target_objective": null,
"nondefault_settings": null,
"creation_time": "2017-11-30T02:00:49.611Z",
"last_update": "2017-11-30T02:00:49.611Z"
},
@ -52,7 +51,6 @@
"upload_code": "0987654321",
"tuning_session": "tuning_session",
"target_objective": "throughput_txn_per_sec",
"nondefault_settings": null,
"creation_time": "2017-11-30T02:00:49.611Z",
"last_update": "2017-11-30T02:00:49.611Z"
},

File diff suppressed because one or more lines are too long

View File

@ -194,7 +194,6 @@ class Migration(migrations.Migration):
('upload_code', models.CharField(max_length=30, unique=True)),
('tuning_session', models.CharField(choices=[('tuning_session', 'Tuning Session'), ('no_tuning_session', 'No Tuning'), ('randomly_generate', 'Randomly Generate')], max_length=64)),
('target_objective', models.CharField(choices=[(b'throughput_txn_per_sec', b'Throughput'), (b'99th_lat_ms', b'99 Percentile Latency')], max_length=64, null=True)),
('nondefault_settings', models.TextField(null=True)),
('dbms', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='website.DBMSCatalog')),
('hardware', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='website.Hardware')),
('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='website.Project')),

View File

@ -211,7 +211,6 @@ class Session(BaseModel):
('99th_lat_ms', '99 Percentile Latency')
]
target_objective = models.CharField(choices=TARGET_OBJECTIVES, max_length=64, null=True)
nondefault_settings = models.TextField(null=True)
def clean(self):
if self.target_objective is None:

View File

@ -3,8 +3,6 @@
#
# Copyright (c) 2017-18, Carnegie Mellon University Database Group
#
from abc import ABCMeta, abstractmethod, abstractproperty
from collections import OrderedDict
from website.models import KnobCatalog, MetricCatalog
@ -12,7 +10,7 @@ from website.types import BooleanType, MetricType, VarType
# pylint: disable=no-self-use
class BaseParser(object, metaclass=ABCMeta):
class BaseParser:
def __init__(self, dbms_obj):
knobs = KnobCatalog.objects.filter(dbms=dbms_obj)
@ -33,21 +31,13 @@ class BaseParser(object, metaclass=ABCMeta):
self.true_value = 'on'
self.false_value = 'off'
@abstractproperty
def base_configuration_settings(self):
pass
@abstractproperty
def knob_configuration_filename(self):
pass
@abstractproperty
@property
def transactions_counter(self):
pass
raise NotImplementedError()
@abstractproperty
@property
def latency_timer(self):
pass
raise NotImplementedError()
def target_metric(self, target_objective=None):
if target_objective == 'throughput_txn_per_sec' or target_objective is None:
@ -61,9 +51,8 @@ class BaseParser(object, metaclass=ABCMeta):
return res
@abstractmethod
def parse_version_string(self, version_string):
pass
return version_string
def convert_bool(self, bool_value, metadata):
if isinstance(bool_value, str):
@ -337,18 +326,6 @@ class BaseParser(object, metaclass=ABCMeta):
configuration = OrderedDict(sorted(configuration.items()))
return configuration
def get_nondefault_knob_settings(self, knobs):
nondefault_settings = OrderedDict()
for knob_name, metadata in list(self.knob_catalog_.items()):
if metadata.tunable is True:
continue
if knob_name not in knobs:
continue
knob_value = knobs[knob_name]
if knob_value != metadata.default:
nondefault_settings[knob_name] = knob_value
return nondefault_settings
def format_bool(self, bool_value, metadata):
return self.true_value if bool_value == BooleanType.TRUE else self.false_value

View File

@ -14,25 +14,10 @@ from website.utils import ConversionUtil
class MyRocksParser(BaseParser):
MYROCKS_BASE_KNOBS = {
'session_variables.rocksdb_max_open_files': '-1'
}
@property
def base_configuration_settings(self):
return dict(self.MYROCKS_BASE_KNOBS)
@property
def knob_configuration_filename(self):
return 'myrocks.conf'
@property
def transactions_counter(self):
return 'session_status.questions'
def latency_timer(self):
return 'session_status.questions'
def convert_integer(self, int_value, metadata):
converted = None
try:

View File

@ -14,24 +14,6 @@ class OracleParser(BaseParser):
self.true_value = 'TRUE'
self.false_value = 'FALSE'
ORACLE_BASE_KNOBS = {
}
@property
def base_configuration_settings(self):
return dict(self.ORACLE_BASE_KNOBS)
@property
def knob_configuration_filename(self):
return 'initorcldb.ora'
@property
def transactions_counter(self):
return 'global.user commits'
@property
def latency_timer(self):
return 'global.user commits'
def parse_version_string(self, version_string):
return version_string

View File

@ -83,10 +83,6 @@ class Parser():
def format_dbms_knobs(dbms_id, knobs):
return Parser.__utils(dbms_id).format_dbms_knobs(knobs)
@staticmethod
def get_knob_configuration_filename(dbms_id):
return Parser.__utils(dbms_id).knob_configuration_filename
@staticmethod
def filter_numeric_metrics(dbms_id, metrics):
return Parser.__utils(dbms_id).filter_numeric_metrics(metrics)

View File

@ -18,38 +18,10 @@ class PostgresParser(BaseParser):
self.valid_true_val = ("on", "true", "yes", 1)
self.valid_false_val = ("off", "false", "no", 0)
POSTGRES_BASE_KNOBS = {
'global.data_directory': None,
'global.hba_file': None,
'global.ident_file': None,
'global.external_pid_file': None,
'global.listen_addresses': None,
'global.port': None,
'global.max_connections': None,
'global.unix_socket_directories': None,
'global.log_line_prefix': '%t [%p-%l] %q%u@%d ',
'global.track_counts': 'on',
'global.track_io_timing': 'on',
'global.autovacuum': 'on',
'global.default_text_search_config': 'pg_catalog.english',
}
@property
def base_configuration_settings(self):
return dict(self.POSTGRES_BASE_KNOBS)
@property
def knob_configuration_filename(self):
return 'postgresql.conf'
@property
def transactions_counter(self):
return 'pg_stat_database.xact_commit'
@property
def latency_timer(self):
return 'pg_stat_database.xact_commit'
def convert_integer(self, int_value, metadata):
converted = None
try:

View File

@ -516,12 +516,8 @@ def handle_result_files(session, files):
metric_log=initial_metric_diffs)
backup_data.save()
nondefault_settings = Parser.get_nondefault_knob_settings(
dbms.pk, knob_dict)
session.project.last_update = now()
session.last_update = now()
if session.nondefault_settings is None:
session.nondefault_settings = JSONUtil.dumps(nondefault_settings)
session.project.save()
session.save()