Added algorithm selection

This commit is contained in:
arifiorino 2019-09-10 02:56:17 +00:00 committed by Dana Van Aken
parent 7aea07f4c1
commit cf4c02496e
6 changed files with 27 additions and 6 deletions

View File

@ -90,7 +90,7 @@ class SessionForm(forms.ModelForm):
model = Session
fields = ('name', 'description', 'tuning_session', 'dbms', 'cpu', 'memory', 'storage',
'target_objective')
'algorithm', 'target_objective')
widgets = {
'name': forms.TextInput(attrs={'required': True}),

View File

@ -12,7 +12,7 @@ from django.utils.timezone import now
from .types import (DBMSType, LabelStyleType, MetricType, KnobUnitType,
PipelineTaskType, VarType, KnobResourceType,
WorkloadStatusType)
WorkloadStatusType, AlgorithmType)
class BaseModel(models.Model):
@ -179,13 +179,13 @@ class Hardware(BaseModel):
def __unicode__(self):
return 'CPU:{}, RAM:{}, Storage:{}'.format(self.cpu, self.memory, self.storage)
class Session(BaseModel):
user = models.ForeignKey(User)
name = models.CharField(max_length=64, verbose_name="session name")
description = models.TextField(null=True, blank=True)
dbms = models.ForeignKey(DBMSCatalog)
hardware = models.ForeignKey(Hardware)
algorithm = models.IntegerField(choices=AlgorithmType.choices())
project = models.ForeignKey(Project)
creation_time = models.DateTimeField()

View File

@ -21,7 +21,6 @@
<td>{{ form.dbms.label_tag }}</td>
<td>{{ form.dbms }}</td>
</tr>
<tr id="cpu_row">
<td>{{ form.cpu.label_tag }}</td>
<td>{{ form.cpu }}</td>
@ -34,7 +33,10 @@
<td>{{ form.storage.label_tag }}</td>
<td>{{ form.storage }}</td>
</tr>
<tr id="algorithm_row">
<td>{{ form.algorithm.label_tag }}</td>
<td>{{ form.algorithm }}</td>
</tr>
<tr>
<td>{{ form.tuning_session.label_tag }}</td>
<td>{{ form.tuning_session }}</td>

View File

@ -32,6 +32,10 @@
<td><div class="text-right">{{ labels.hardware }}</div></td>
<td>{{ session.hardware }}</td>
</tr>
<tr>
<td><div class="text-right">{{ labels.algorithm }}</div></td>
<td>{{ algorithm_name }}</td>
</tr>
<tr>
<td><div class="text-right">{{ labels.creation_time }}</div></td>
<td>{{ session.creation_time }}</td>

View File

@ -170,3 +170,16 @@ class LabelStyleType(BaseType):
CAPFIRST: 'capfirst',
LOWER: 'lower'
}
class AlgorithmType(BaseType):
OTTERTUNE = 1
ALGORITHM1 = 2
ALGORITHM2 = 3
ALGORITHM3 = 4
TYPE_NAMES = {
OTTERTUNE: 'Ottertune Default',
ALGORITHM1: 'Algorithm 1',
ALGORITHM2: 'Algorithm 2',
ALGORITHM3: 'Algorithm 3'
}

View File

@ -33,7 +33,7 @@ from .parser import Parser
from .tasks import (aggregate_target_results, map_workload,
configuration_recommendation)
from .types import (DBMSType, KnobUnitType, MetricType,
TaskType, VarType, WorkloadStatusType)
TaskType, VarType, WorkloadStatusType, AlgorithmType)
from .utils import JSONUtil, LabelUtil, MediaUtil, TaskUtil
from .settings import TIME_ZONE
@ -261,6 +261,7 @@ def session_view(request, project_id, session_id):
'knob_names': knob_names,
'filters': [],
'session': session,
'algorithm_name': AlgorithmType.TYPE_NAMES[session.algorithm],
'results': results,
'labels': form_labels,
}
@ -313,6 +314,7 @@ def create_or_edit_session(request, project_id, session_id=''):
initial={
'dbms': DBMSCatalog.objects.get(
type=DBMSType.POSTGRES, version='9.6'),
'algorithm': AlgorithmType.OTTERTUNE,
'target_objective': 'throughput_txn_per_sec',
})
context = {