You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2020/10/30 13:58:57 UTC

[airavata-django-portal] branch develop updated: AIRAVATA-3380 Remove unused and poorly performing ExperimentViewSet.get_list()

This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git


The following commit(s) were added to refs/heads/develop by this push:
     new 87fa4ea  AIRAVATA-3380 Remove unused and poorly performing ExperimentViewSet.get_list()
87fa4ea is described below

commit 87fa4ea557c64e96c5f180bfed657cc90aa15ac1
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Fri Oct 30 09:58:27 2020 -0400

    AIRAVATA-3380 Remove unused and poorly performing ExperimentViewSet.get_list()
---
 django_airavata/apps/api/view_utils.py | 9 ++++++++-
 django_airavata/apps/api/views.py      | 9 ++++-----
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/django_airavata/apps/api/view_utils.py b/django_airavata/apps/api/view_utils.py
index 7886ff3..45616f9 100644
--- a/django_airavata/apps/api/view_utils.py
+++ b/django_airavata/apps/api/view_utils.py
@@ -33,7 +33,14 @@ class GenericAPIBackedViewSet(GenericViewSet):
         raise NotImplementedError()
 
     def get_queryset(self):
-        return self.get_list()
+        if isinstance(self, mixins.ListModelMixin):
+            return self.get_list()
+        else:
+            # get_queryset() is invoked whenever a detail extra action route
+            # returns a many valued response. For ViewSets that have such
+            # actions, return None here so they don't need to provide a
+            # get_list() implementation
+            return None
 
     def get_object(self):
         lookup_url_kwarg = self.lookup_url_kwarg or self.lookup_field
diff --git a/django_airavata/apps/api/views.py b/django_airavata/apps/api/views.py
index 7a07075..5e5da73 100644
--- a/django_airavata/apps/api/views.py
+++ b/django_airavata/apps/api/views.py
@@ -191,14 +191,13 @@ class ProjectViewSet(APIBackedViewSet):
         prefs.save()
 
 
-class ExperimentViewSet(APIBackedViewSet):
+class ExperimentViewSet(mixins.CreateModelMixin,
+                        mixins.RetrieveModelMixin,
+                        mixins.UpdateModelMixin,
+                        GenericAPIBackedViewSet):
     serializer_class = serializers.ExperimentSerializer
     lookup_field = 'experiment_id'
 
-    def get_list(self):
-        return self.request.airavata_client.getUserExperiments(
-            self.authz_token, self.gateway_id, self.username, -1, 0)
-
     def get_instance(self, lookup_value):
         return self.request.airavata_client.getExperiment(
             self.authz_token, lookup_value)