From 28121e618490b245e1f02aec07bccd2ae227f92d Mon Sep 17 00:00:00 2001 From: Jorrit Schaap <schaap@astron.nl> Date: Thu, 12 Nov 2020 12:05:25 +0100 Subject: [PATCH] TMSS-190: lazy loading of lofar.lta.sip reduces startup time --- SAS/TMSS/src/tmss/tmssapp/viewsets/scheduling.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SAS/TMSS/src/tmss/tmssapp/viewsets/scheduling.py b/SAS/TMSS/src/tmss/tmssapp/viewsets/scheduling.py index 8ad75743cc3..9883d4058dd 100644 --- a/SAS/TMSS/src/tmss/tmssapp/viewsets/scheduling.py +++ b/SAS/TMSS/src/tmss/tmssapp/viewsets/scheduling.py @@ -35,8 +35,6 @@ from lofar.sas.tmss.tmss.tmssapp.renderers import PlainTextRenderer from rest_framework.views import APIView from rest_framework.decorators import api_view, renderer_classes -from lofar.sas.tmss.tmss.tmssapp.adapters.sip import generate_sip_for_dataproduct - class TextPlainAutoSchema(SwaggerAutoSchema): def get_produces(self): @@ -322,6 +320,7 @@ class DataproductViewSet(LOFARViewSet): @action(methods=['get'], detail=True, url_name="sip") def sip(self, request, pk=None): dataproduct = get_object_or_404(models.Dataproduct, pk=pk) + from lofar.sas.tmss.tmss.tmssapp.adapters.sip import generate_sip_for_dataproduct return HttpResponse(generate_sip_for_dataproduct(dataproduct).get_prettyxml(), content_type='application/xml') @swagger_auto_schema(responses={200: 'The SIP graph for this dataproduct', @@ -331,6 +330,7 @@ class DataproductViewSet(LOFARViewSet): def sip_graph(self, request, pk=None): dataproduct = get_object_or_404(models.Dataproduct, pk=pk) from lofar.lta.sip import visualizer + from lofar.sas.tmss.tmss.tmssapp.adapters.sip import generate_sip_for_dataproduct return HttpResponse(visualizer.visualize_sip(generate_sip_for_dataproduct(dataproduct)), content_type='image/svg+xml') -- GitLab