add pipeline data view

This commit is contained in:
bohanjason 2020-03-01 21:06:48 -05:00 committed by Dana Van Aken
parent f61021c32f
commit 84407eb999
3 changed files with 62 additions and 3 deletions

View File

@ -0,0 +1,43 @@
{% extends "base.html" %}
{% block body %}
<div class="container">
<table class="table table-striped table-bordered table-condensed table-hover">
<caption><h4 style="text-align: center;">Pipeline Data Info</h4></caption>
<tbody>
<tr>
<td style="width: 50%"><div class="text-right">ID:</div></td>
<td style="width: 50%">{{ id }}</td>
</tr>
<tr>
<td><div class="text-right">Creation Time:</div></td>
<td>{{ creation_time }}</td>
</tr>
<tr>
<td><div class="text-right">Task Name:</div></td>
<td>{{ task_name }}</td>
</tr>
<tr>
<td><div class="text-right">Workload:</div></td>
<td>{{ workload }}</td>
</tr>
</tbody>
</table>
</div>
<div class="container">
<table class="table table-striped table-bordered table-condensed table-hover">
<caption><h4 style="text-align: center;">{{ task_name }}</h4></caption>
<tbody>
{% for element in data %}
<tr>
<td style="width: 50%"><div class="text-right">{{forloop.counter}}</div></td>
<td style="width: 50%">{{ element }} </td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock body %}

View File

@ -80,7 +80,10 @@ urlpatterns = [
# Test # Test
url(r'^test/create/', website_views.create_test_website, name='create_test_website'), url(r'^test/create/', website_views.create_test_website, name='create_test_website'),
url(r'^test/pipeline/', website_views.pipeline_data_ready, name='pipeline_data_ready') url(r'^test/pipeline/', website_views.pipeline_data_ready, name='pipeline_data_ready'),
# Pipeline data
url(r'^pipeline/data/(?P<pipeline_id>[0-9]+)', website_views.pipeline_data_view, name='pipeline_data_view')
] ]
if settings.DEBUG: if settings.DEBUG:

View File

@ -42,10 +42,10 @@ from .db import parser, target_objectives
from .forms import NewResultForm, ProjectForm, SessionForm, SessionKnobForm from .forms import NewResultForm, ProjectForm, SessionForm, SessionKnobForm
from .models import (BackupData, DBMSCatalog, ExecutionTime, Hardware, KnobCatalog, KnobData, from .models import (BackupData, DBMSCatalog, ExecutionTime, Hardware, KnobCatalog, KnobData,
MetricCatalog, MetricData, PipelineRun, Project, Result, Session, MetricCatalog, MetricData, PipelineRun, Project, Result, Session,
SessionKnob, User, Workload) SessionKnob, User, Workload, PipelineData)
from .tasks import train_ddpg from .tasks import train_ddpg
from .types import (DBMSType, KnobUnitType, MetricType, from .types import (DBMSType, KnobUnitType, MetricType,
TaskType, VarType, WorkloadStatusType, AlgorithmType) TaskType, VarType, WorkloadStatusType, AlgorithmType, PipelineTaskType)
from .utils import (JSONUtil, LabelUtil, MediaUtil, TaskUtil) from .utils import (JSONUtil, LabelUtil, MediaUtil, TaskUtil)
from .settings import LOG_DIR, TIME_ZONE, CHECK_CELERY from .settings import LOG_DIR, TIME_ZONE, CHECK_CELERY
@ -949,6 +949,19 @@ def download_debug_info(request, project_id, session_id): # pylint: disable=unu
return response return response
@login_required(login_url=reverse_lazy('login'))
def pipeline_data_view(request, pipeline_id):
pipeline_data = PipelineData.objects.get(pk=pipeline_id)
task_name = PipelineTaskType.TYPE_NAMES[pipeline_data.task_type]
data = JSONUtil.loads(pipeline_data.data)
context = {"id": pipeline_id,
"workload": pipeline_data.workload,
"creation_time": pipeline_data.creation_time,
"task_name": task_name,
"data": data}
return render(request, "pipeline_data.html", context)
@login_required(login_url=reverse_lazy('login')) @login_required(login_url=reverse_lazy('login'))
def tuner_status_view(request, project_id, session_id, result_id): # pylint: disable=unused-argument def tuner_status_view(request, project_id, session_id, result_id): # pylint: disable=unused-argument
res = Result.objects.get(pk=result_id) res = Result.objects.get(pk=result_id)