Skip to content
Snippets Groups Projects

WIP: Do not run development server for backend dev server on Kubernetes

Closed Kenzo-Hugo Hillion requested to merge 76-prod-backend-and-logs into dev
7 files
+ 92
59
Compare changes
  • Side-by-side
  • Inline
Files
7
 
import logging
 
from rest_framework import permissions
from rest_framework import permissions
from rest_framework.response import Response
from rest_framework.response import Response
from rest_framework.status import HTTP_500_INTERNAL_SERVER_ERROR
from rest_framework.status import HTTP_500_INTERNAL_SERVER_ERROR
@@ -8,6 +10,8 @@ from metagenedb.apps.catalog.management.commands.compute_stats import (
@@ -8,6 +10,8 @@ from metagenedb.apps.catalog.management.commands.compute_stats import (
ComputeCounts, ComputeGeneLength, ComputeTaxonomyRepartition
ComputeCounts, ComputeGeneLength, ComputeTaxonomyRepartition
)
)
 
logger = logging.getLogger(__name__)
 
class AdminCommandsAPI(APIView):
class AdminCommandsAPI(APIView):
authentication_classes = [JSONWebTokenAuthentication]
authentication_classes = [JSONWebTokenAuthentication]
@@ -22,9 +26,8 @@ class ComputeStatisticsAPI(AdminCommandsAPI):
@@ -22,9 +26,8 @@ class ComputeStatisticsAPI(AdminCommandsAPI):
def get(self, request, format=None):
def get(self, request, format=None):
try:
try:
self.compute_class().all()
self.compute_class().all()
# ComputeGeneLength().all()
except Exception as exception:
# ComputeTaxonomyRepartition().all()
logger.warning(exception)
except Exception:
return Response({"message": self.error_message},
return Response({"message": self.error_message},
status=HTTP_500_INTERNAL_SERVER_ERROR)
status=HTTP_500_INTERNAL_SERVER_ERROR)
return Response({"message": self.success_message})
return Response({"message": self.success_message})
Loading