Skip to content

Commit

Permalink
Merge pull request #26 from mlbench/update-django
Browse files Browse the repository at this point in the history
Update to Django 2.2.12
  • Loading branch information
Panaetius authored Apr 20, 2020
2 parents 68df6b0 + fb9a5b6 commit 7683b20
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion Docker/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Django==2.0.8
Django==2.2.12
uwsgi==2.0.17
django-livesync==0.4
django-constance==2.2.0
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pytest==5.3.5
pytest-runner>=2.11.1
pytest-django==3.8.0

Django==2.0.8
Django==2.2.12
django-livesync==0.4
django-constance==2.2.0
django-picklefield==1.0.0
Expand Down
32 changes: 17 additions & 15 deletions src/api/views.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import io
import json
import logging
import os
import zipfile
from datetime import datetime
Expand Down Expand Up @@ -52,8 +53,8 @@ def __format_result(self, metrics, q, summarize, last_n):
temp_filter = q & Q(name=name)
filtered_metrics = (
metrics.filter(temp_filter)
.order_by("date")
.values("date", "value", "cumulative")
.order_by("date")
.values("date", "value", "cumulative")
)

metric_count = filtered_metrics.count()
Expand Down Expand Up @@ -103,8 +104,8 @@ def __format_zip_result(self, metrics, q, summarize, last_n, prefix, zf):
temp_filter = q & Q(name=name)
filtered_metrics = (
metrics.filter(temp_filter)
.order_by("date")
.values("date", "value", "cumulative")
.order_by("date")
.values("date", "value", "cumulative")
)

metric_count = filtered_metrics.count()
Expand Down Expand Up @@ -170,9 +171,9 @@ def list(self, request, format=None):
for e in sorted(g[1], key=lambda x: x.date)
]
for g in groupby(
sorted(pod.metrics.all(), key=lambda m: m.name),
key=lambda m: m.name,
)
sorted(pod.metrics.all(), key=lambda m: m.name),
key=lambda m: m.name,
)
}
for pod in KubePod.objects.all()
}
Expand All @@ -184,9 +185,9 @@ def list(self, request, format=None):
for e in sorted(g[1], key=lambda x: x.date)
]
for g in groupby(
sorted(run.metrics.all(), key=lambda m: m.name),
key=lambda m: m.name,
)
sorted(run.metrics.all(), key=lambda m: m.name),
key=lambda m: m.name,
)
}
for run in ModelRun.objects.all()
}
Expand Down Expand Up @@ -250,7 +251,7 @@ def retrieve(self, request, pk=None, format=None):
result_file = io.BytesIO()

with zipfile.ZipFile(
result_file, mode="w", compression=zipfile.ZIP_DEFLATED
result_file, mode="w", compression=zipfile.ZIP_DEFLATED
) as zf:

if metric_type == "run":
Expand Down Expand Up @@ -479,6 +480,7 @@ def destroy(self, request, pk=None):
Keyword Arguments:
pk {int} -- [the id of the run] (default: {None})
"""
logger = logging.getLogger("dashboard")
run = ModelRun.objects.get(pk=pk)

release_name = os.environ.get("MLBENCH_KUBE_RELEASENAME")
Expand All @@ -488,13 +490,13 @@ def destroy(self, request, pk=None):
).lower()

if run is not None:
run.delete()

try:
delete_statefulset(statefulset_name, ns)
delete_service(statefulset_name, ns)
except (BaseException, Exception):
pass
except (BaseException, Exception) as e:
logger.error("Couldn't delete run {}: {}".format(run.id, repr(e)))

run.delete()

return Response(
{"status": "Deleted", "message": "The run was deleted"},
Expand Down
Binary file modified src/db.sqlite3
Binary file not shown.

0 comments on commit 7683b20

Please sign in to comment.