Added if statements to run algorithms

This commit is contained in:
arifiorino 2019-09-10 03:13:01 +00:00 committed by Dana Van Aken
parent cf4c02496e
commit 5d4d4a05c9
2 changed files with 13 additions and 4 deletions

View File

@ -185,7 +185,8 @@ class Session(BaseModel):
description = models.TextField(null=True, blank=True)
dbms = models.ForeignKey(DBMSCatalog)
hardware = models.ForeignKey(Hardware)
algorithm = models.IntegerField(choices=AlgorithmType.choices())
algorithm = models.IntegerField(choices=AlgorithmType.choices(),
default=AlgorithmType.OTTERTUNE)
project = models.ForeignKey(Project)
creation_time = models.DateTimeField()

View File

@ -527,9 +527,17 @@ def handle_result_files(session, files):
return HttpResponse("Result stored successfully!")
result_id = result.pk
response = None
if session.algorithm == AlgorithmType.OTTERTUNE:
response = chain(aggregate_target_results.s(result.pk),
map_workload.s(),
configuration_recommendation.s()).apply_async()
elif session.algorithm == AlgorithmType.ALGORITHM1:
pass
elif session.algorithm == AlgorithmType.ALGORITHM2:
pass
elif session.algorithm == AlgorithmType.ALGORITHM3:
pass
taskmeta_ids = [response.parent.parent.id, response.parent.id, response.id]
result.task_ids = ','.join(taskmeta_ids)
result.save()