context info in result
This commit is contained in:
parent
09226edece
commit
c8996382dc
|
@ -87,6 +87,10 @@ class KnobCatalog(BaseModel):
|
|||
tunable = models.BooleanField(verbose_name="tunable")
|
||||
resource = models.IntegerField(choices=KnobResourceType.choices(), default=4)
|
||||
|
||||
@property
|
||||
def clean_name(self):
|
||||
return self.name.split('.')[-1]
|
||||
|
||||
|
||||
class MetricCatalog(BaseModel):
|
||||
dbms = models.ForeignKey(DBMSCatalog)
|
||||
|
@ -97,6 +101,10 @@ class MetricCatalog(BaseModel):
|
|||
scope = models.CharField(max_length=16)
|
||||
metric_type = models.IntegerField(choices=MetricType.choices())
|
||||
|
||||
@property
|
||||
def clean_name(self):
|
||||
return self.name.split('.')[-1]
|
||||
|
||||
|
||||
class Project(BaseModel):
|
||||
user = models.ForeignKey(User)
|
||||
|
|
|
@ -565,12 +565,15 @@ def create_and_save_recommendation(recommended_knobs, result, status, **kwargs):
|
|||
dbms_id = result.dbms.pk
|
||||
formatted_knobs = db.parser.format_dbms_knobs(dbms_id, recommended_knobs)
|
||||
config = db.parser.create_knob_configuration(dbms_id, formatted_knobs)
|
||||
|
||||
knob_names = recommended_knobs.keys()
|
||||
knobs = KnobCatalog.objects.filter(name__in=knob_names)
|
||||
knob_contexts = {knob.clean_name: knob.context for knob in knobs}
|
||||
retval = dict(**kwargs)
|
||||
retval.update(
|
||||
status=status,
|
||||
result_id=result.pk,
|
||||
recommendation=config,
|
||||
context=knob_contexts
|
||||
)
|
||||
result.next_configuration = JSONUtil.dumps(retval)
|
||||
result.save()
|
||||
|
|
Loading…
Reference in New Issue