Updated knob tunability getter
This commit is contained in:
parent
c23308e9f1
commit
4ab2fdfd52
|
@ -196,18 +196,19 @@ class SessionKnobManager(models.Manager):
|
||||||
return knob_dicts
|
return knob_dicts
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_knob_min_max_tunability(session):
|
def get_knob_min_max_tunability(session, tunable_only=False):
|
||||||
# Returns a dict of the knob
|
# Returns a dict of the knob
|
||||||
knobs = KnobCatalog.objects.filter(dbms=session.dbms)
|
filter_args=dict(session=session)
|
||||||
knob_dicts = list(knobs.values())
|
if tunable_only:
|
||||||
|
filter_args['tunable'] = True
|
||||||
|
session_knobs = SessionKnob.objects.filter(**filter_args).values(
|
||||||
|
'knob__name', 'tunable', 'minval', 'maxval')
|
||||||
|
|
||||||
session_knob_dicts = {}
|
session_knob_dicts = {}
|
||||||
for i, _ in enumerate(knob_dicts):
|
for entry in session_knobs:
|
||||||
if SessionKnob.objects.filter(session=session, knob=knobs[i]).exists():
|
new_entry = dict(entry)
|
||||||
new_knob = SessionKnob.objects.filter(session=session, knob=knobs[i])[0]
|
knob_name = new_entry.pop('knob__name')
|
||||||
min_max_tunability = {"minval": new_knob.minval,
|
session_knob_dicts[knob_name] = new_entry
|
||||||
"maxval": new_knob.maxval,
|
|
||||||
"tunable": new_knob.tunable}
|
|
||||||
session_knob_dicts[new_knob.name] = min_max_tunability
|
|
||||||
return session_knob_dicts
|
return session_knob_dicts
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
Loading…
Reference in New Issue