update integration tests
This commit is contained in:
parent
1808a7a50a
commit
8bb3de85e7
|
@ -182,22 +182,17 @@ class Session(BaseModel):
|
||||||
|
|
||||||
class SessionKnobManager(models.Manager):
|
class SessionKnobManager(models.Manager):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_knobs_for_session(session, only_session_knobs=False):
|
def get_knobs_for_session(session):
|
||||||
# Returns a dict of the knob
|
# Returns a dict of the knob
|
||||||
knobs = KnobCatalog.objects.filter(dbms=session.dbms)
|
knobs = KnobCatalog.objects.filter(dbms=session.dbms)
|
||||||
knob_dicts = list(knobs.values())
|
knob_dicts = list(knobs.values())
|
||||||
session_knob_dicts = []
|
|
||||||
for i, _ in enumerate(knob_dicts):
|
for i, _ in enumerate(knob_dicts):
|
||||||
if SessionKnob.objects.filter(session=session, knob=knobs[i]).exists():
|
if SessionKnob.objects.filter(session=session, knob=knobs[i]).exists():
|
||||||
new_knob = SessionKnob.objects.filter(session=session, knob=knobs[i])[0]
|
new_knob = SessionKnob.objects.filter(session=session, knob=knobs[i])[0]
|
||||||
knob_dicts[i]["minval"] = new_knob.minval
|
knob_dicts[i]["minval"] = new_knob.minval
|
||||||
knob_dicts[i]["maxval"] = new_knob.maxval
|
knob_dicts[i]["maxval"] = new_knob.maxval
|
||||||
knob_dicts[i]["tunable"] = new_knob.tunable
|
knob_dicts[i]["tunable"] = new_knob.tunable
|
||||||
session_knob_dicts.append(new_knob)
|
knob_dicts = [knob for knob in knob_dicts if knob["tunable"]]
|
||||||
if only_session_knobs:
|
|
||||||
knob_dicts = session_knob_dicts
|
|
||||||
else:
|
|
||||||
knob_dicts = [knob for knob in knob_dicts if knob["tunable"]]
|
|
||||||
return knob_dicts
|
return knob_dicts
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
|
@ -544,8 +544,7 @@ def configuration_recommendation(recommendation_input):
|
||||||
X_max = np.empty(X_scaled.shape[1])
|
X_max = np.empty(X_scaled.shape[1])
|
||||||
X_scaler_matrix = np.zeros([1, X_scaled.shape[1]])
|
X_scaler_matrix = np.zeros([1, X_scaled.shape[1]])
|
||||||
|
|
||||||
session_knobs = SessionKnob.objects.get_knobs_for_session(newest_result.session,
|
session_knobs = SessionKnob.objects.get_knobs_for_session(newest_result.session)
|
||||||
only_session_knobs=True)
|
|
||||||
|
|
||||||
# Set min/max for knob values
|
# Set min/max for knob values
|
||||||
for i in range(X_scaled.shape[1]):
|
for i in range(X_scaled.shape[1]):
|
||||||
|
|
|
@ -1069,24 +1069,28 @@ def create_test_website(request): # pylint: disable=unused-argument
|
||||||
test_project = Project.objects.create(user=test_user, name='ottertune_test_project',
|
test_project = Project.objects.create(user=test_user, name='ottertune_test_project',
|
||||||
creation_time=now(), last_update=now())
|
creation_time=now(), last_update=now())
|
||||||
# create no tuning session
|
# create no tuning session
|
||||||
Session.objects.create(name='test_session_no_tuning', tuning_session='no_tuning_session',
|
s1 = Session.objects.create(name='test_session_no_tuning', tuning_session='no_tuning_session',
|
||||||
dbms_id=1, hardware=test_hardware, project=test_project,
|
dbms_id=1, hardware=test_hardware, project=test_project,
|
||||||
creation_time=now(), last_update=now(), user=test_user,
|
creation_time=now(), last_update=now(), user=test_user,
|
||||||
upload_code='ottertuneTestNoTuning')
|
upload_code='ottertuneTestNoTuning')
|
||||||
|
set_default_knobs(s1)
|
||||||
# create gpr session
|
# create gpr session
|
||||||
Session.objects.create(name='test_session_gpr', user=test_user, tuning_session='tuning_session',
|
s2 = Session.objects.create(name='test_session_gpr', tuning_session='tuning_session',
|
||||||
dbms_id=1, hardware=test_hardware, project=test_project,
|
dbms_id=1, hardware=test_hardware, project=test_project,
|
||||||
creation_time=now(), last_update=now(), algorithm=AlgorithmType.GPR,
|
creation_time=now(), last_update=now(), algorithm=AlgorithmType.GPR,
|
||||||
upload_code='ottertuneTestTuningGPR')
|
upload_code='ottertuneTestTuningGPR', user=test_user)
|
||||||
|
set_default_knobs(s2)
|
||||||
# create dnn session
|
# create dnn session
|
||||||
Session.objects.create(name='test_session_dnn', user=test_user, tuning_session='tuning_session',
|
s3 = Session.objects.create(name='test_session_dnn', tuning_session='tuning_session',
|
||||||
dbms_id=1, hardware=test_hardware, project=test_project,
|
dbms_id=1, hardware=test_hardware, project=test_project,
|
||||||
creation_time=now(), last_update=now(), algorithm=AlgorithmType.DNN,
|
creation_time=now(), last_update=now(), algorithm=AlgorithmType.DNN,
|
||||||
upload_code='ottertuneTestTuningDNN')
|
upload_code='ottertuneTestTuningDNN', user=test_user)
|
||||||
|
set_default_knobs(s3)
|
||||||
# create ddpg session
|
# create ddpg session
|
||||||
Session.objects.create(name='test_session_ddpg', tuning_session='tuning_session',
|
s4 = Session.objects.create(name='test_session_ddpg', tuning_session='tuning_session',
|
||||||
dbms_id=1, hardware=test_hardware, project=test_project,
|
dbms_id=1, hardware=test_hardware, project=test_project,
|
||||||
creation_time=now(), last_update=now(), user=test_user,
|
creation_time=now(), last_update=now(), user=test_user,
|
||||||
upload_code='ottertuneTestTuningDDPG', algorithm=AlgorithmType.DDPG)
|
upload_code='ottertuneTestTuningDDPG', algorithm=AlgorithmType.DDPG)
|
||||||
|
set_default_knobs(s4)
|
||||||
response = HttpResponse("Success: create test website successfully")
|
response = HttpResponse("Success: create test website successfully")
|
||||||
return response
|
return response
|
||||||
|
|
Loading…
Reference in New Issue