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 2018/02/13 17:32:00 UTC

[airavata-django-portal] branch master updated (3ae702a -> bc99396)

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

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


    from 3ae702a  AIRAVATA-2599 Upload input files before saving/launching
     new b16752b  Generate thrift stubs: GroupManagerService
     new 3b9c8e6  Fix getting all groups
     new bc99396  AIRAVATA-2599 Set experimentDataDir

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../groupmanager/cpi/GroupManagerService-remote    |   7 +
 .../groupmanager/cpi/GroupManagerService.py        | 263 +++++++++++++++++++--
 django_airavata/apps/api/views.py                  |  27 ++-
 3 files changed, 270 insertions(+), 27 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
machristie@apache.org.

[airavata-django-portal] 01/03: Generate thrift stubs: GroupManagerService

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit b16752bc613d6861be61884a88ae33b350c3c2a4
Author: Marcus Christie <ma...@iu.edu>
AuthorDate: Thu Feb 8 12:05:26 2018 -0500

    Generate thrift stubs: GroupManagerService
---
 .../groupmanager/cpi/GroupManagerService-remote    |   7 +
 .../groupmanager/cpi/GroupManagerService.py        | 263 +++++++++++++++++++--
 2 files changed, 251 insertions(+), 19 deletions(-)

diff --git a/airavata/service/profile/groupmanager/cpi/GroupManagerService-remote b/airavata/service/profile/groupmanager/cpi/GroupManagerService-remote
index f2634ec..583ea67 100755
--- a/airavata/service/profile/groupmanager/cpi/GroupManagerService-remote
+++ b/airavata/service/profile/groupmanager/cpi/GroupManagerService-remote
@@ -28,6 +28,7 @@ if len(sys.argv) <= 1 or sys.argv[1] == '--help':
     print('  bool updateGroup(AuthzToken authzToken, GroupModel groupModel)')
     print('  bool deleteGroup(AuthzToken authzToken, string groupId, string ownerId)')
     print('  GroupModel getGroup(AuthzToken authzToken, string groupId)')
+    print('   getGroups(AuthzToken authzToken)')
     print('   getAllGroupsUserBelongs(AuthzToken authzToken, string userName)')
     print('  bool transferGroupOwnership(AuthzToken authzToken, string groupId, string newOwnerId)')
     print('  bool addGroupAdmins(AuthzToken authzToken, string groupId,  adminIds)')
@@ -137,6 +138,12 @@ elif cmd == 'getGroup':
         sys.exit(1)
     pp.pprint(client.getGroup(eval(args[0]), args[1],))
 
+elif cmd == 'getGroups':
+    if len(args) != 1:
+        print('getGroups requires 1 args')
+        sys.exit(1)
+    pp.pprint(client.getGroups(eval(args[0]),))
+
 elif cmd == 'getAllGroupsUserBelongs':
     if len(args) != 2:
         print('getAllGroupsUserBelongs requires 2 args')
diff --git a/airavata/service/profile/groupmanager/cpi/GroupManagerService.py b/airavata/service/profile/groupmanager/cpi/GroupManagerService.py
index bf65fc8..899ed20 100644
--- a/airavata/service/profile/groupmanager/cpi/GroupManagerService.py
+++ b/airavata/service/profile/groupmanager/cpi/GroupManagerService.py
@@ -49,6 +49,13 @@ class Iface(object):
         """
         pass
 
+    def getGroups(self, authzToken):
+        """
+        Parameters:
+         - authzToken
+        """
+        pass
+
     def getAllGroupsUserBelongs(self, authzToken, userName):
         """
         Parameters:
@@ -260,6 +267,41 @@ class Client(Iface):
             raise result.ae
         raise TApplicationException(TApplicationException.MISSING_RESULT, "getGroup failed: unknown result")
 
+    def getGroups(self, authzToken):
+        """
+        Parameters:
+         - authzToken
+        """
+        self.send_getGroups(authzToken)
+        return self.recv_getGroups()
+
+    def send_getGroups(self, authzToken):
+        self._oprot.writeMessageBegin('getGroups', TMessageType.CALL, self._seqid)
+        args = getGroups_args()
+        args.authzToken = authzToken
+        args.write(self._oprot)
+        self._oprot.writeMessageEnd()
+        self._oprot.trans.flush()
+
+    def recv_getGroups(self):
+        iprot = self._iprot
+        (fname, mtype, rseqid) = iprot.readMessageBegin()
+        if mtype == TMessageType.EXCEPTION:
+            x = TApplicationException()
+            x.read(iprot)
+            iprot.readMessageEnd()
+            raise x
+        result = getGroups_result()
+        result.read(iprot)
+        iprot.readMessageEnd()
+        if result.success is not None:
+            return result.success
+        if result.gse is not None:
+            raise result.gse
+        if result.ae is not None:
+            raise result.ae
+        raise TApplicationException(TApplicationException.MISSING_RESULT, "getGroups failed: unknown result")
+
     def getAllGroupsUserBelongs(self, authzToken, userName):
         """
         Parameters:
@@ -501,6 +543,7 @@ class Processor(Iface, TProcessor):
         self._processMap["updateGroup"] = Processor.process_updateGroup
         self._processMap["deleteGroup"] = Processor.process_deleteGroup
         self._processMap["getGroup"] = Processor.process_getGroup
+        self._processMap["getGroups"] = Processor.process_getGroups
         self._processMap["getAllGroupsUserBelongs"] = Processor.process_getAllGroupsUserBelongs
         self._processMap["transferGroupOwnership"] = Processor.process_transferGroupOwnership
         self._processMap["addGroupAdmins"] = Processor.process_addGroupAdmins
@@ -623,6 +666,31 @@ class Processor(Iface, TProcessor):
         oprot.writeMessageEnd()
         oprot.trans.flush()
 
+    def process_getGroups(self, seqid, iprot, oprot):
+        args = getGroups_args()
+        args.read(iprot)
+        iprot.readMessageEnd()
+        result = getGroups_result()
+        try:
+            result.success = self._handler.getGroups(args.authzToken)
+            msg_type = TMessageType.REPLY
+        except (TTransport.TTransportException, KeyboardInterrupt, SystemExit):
+            raise
+        except airavata.service.profile.groupmanager.cpi.error.ttypes.GroupManagerServiceException as gse:
+            msg_type = TMessageType.REPLY
+            result.gse = gse
+        except airavata.api.error.ttypes.AuthorizationException as ae:
+            msg_type = TMessageType.REPLY
+            result.ae = ae
+        except Exception as ex:
+            msg_type = TMessageType.EXCEPTION
+            logging.exception(ex)
+            result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
+        oprot.writeMessageBegin("getGroups", msg_type, seqid)
+        result.write(oprot)
+        oprot.writeMessageEnd()
+        oprot.trans.flush()
+
     def process_getAllGroupsUserBelongs(self, seqid, iprot, oprot):
         args = getAllGroupsUserBelongs_args()
         args.read(iprot)
@@ -1441,6 +1509,163 @@ class getGroup_result(object):
         return not (self == other)
 
 
+class getGroups_args(object):
+    """
+    Attributes:
+     - authzToken
+    """
+
+    thrift_spec = (
+        None,  # 0
+        (1, TType.STRUCT, 'authzToken', (airavata.model.security.ttypes.AuthzToken, airavata.model.security.ttypes.AuthzToken.thrift_spec), None, ),  # 1
+    )
+
+    def __init__(self, authzToken=None,):
+        self.authzToken = authzToken
+
+    def read(self, iprot):
+        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
+            iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec))
+            return
+        iprot.readStructBegin()
+        while True:
+            (fname, ftype, fid) = iprot.readFieldBegin()
+            if ftype == TType.STOP:
+                break
+            if fid == 1:
+                if ftype == TType.STRUCT:
+                    self.authzToken = airavata.model.security.ttypes.AuthzToken()
+                    self.authzToken.read(iprot)
+                else:
+                    iprot.skip(ftype)
+            else:
+                iprot.skip(ftype)
+            iprot.readFieldEnd()
+        iprot.readStructEnd()
+
+    def write(self, oprot):
+        if oprot._fast_encode is not None and self.thrift_spec is not None:
+            oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
+            return
+        oprot.writeStructBegin('getGroups_args')
+        if self.authzToken is not None:
+            oprot.writeFieldBegin('authzToken', TType.STRUCT, 1)
+            self.authzToken.write(oprot)
+            oprot.writeFieldEnd()
+        oprot.writeFieldStop()
+        oprot.writeStructEnd()
+
+    def validate(self):
+        if self.authzToken is None:
+            raise TProtocolException(message='Required field authzToken is unset!')
+        return
+
+    def __repr__(self):
+        L = ['%s=%r' % (key, value)
+             for key, value in self.__dict__.items()]
+        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+    def __eq__(self, other):
+        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+    def __ne__(self, other):
+        return not (self == other)
+
+
+class getGroups_result(object):
+    """
+    Attributes:
+     - success
+     - gse
+     - ae
+    """
+
+    thrift_spec = (
+        (0, TType.LIST, 'success', (TType.STRUCT, (airavata.model.group.ttypes.GroupModel, airavata.model.group.ttypes.GroupModel.thrift_spec), False), None, ),  # 0
+        (1, TType.STRUCT, 'gse', (airavata.service.profile.groupmanager.cpi.error.ttypes.GroupManagerServiceException, airavata.service.profile.groupmanager.cpi.error.ttypes.GroupManagerServiceException.thrift_spec), None, ),  # 1
+        (2, TType.STRUCT, 'ae', (airavata.api.error.ttypes.AuthorizationException, airavata.api.error.ttypes.AuthorizationException.thrift_spec), None, ),  # 2
+    )
+
+    def __init__(self, success=None, gse=None, ae=None,):
+        self.success = success
+        self.gse = gse
+        self.ae = ae
+
+    def read(self, iprot):
+        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
+            iprot._fast_decode(self, iprot, (self.__class__, self.thrift_spec))
+            return
+        iprot.readStructBegin()
+        while True:
+            (fname, ftype, fid) = iprot.readFieldBegin()
+            if ftype == TType.STOP:
+                break
+            if fid == 0:
+                if ftype == TType.LIST:
+                    self.success = []
+                    (_etype3, _size0) = iprot.readListBegin()
+                    for _i4 in range(_size0):
+                        _elem5 = airavata.model.group.ttypes.GroupModel()
+                        _elem5.read(iprot)
+                        self.success.append(_elem5)
+                    iprot.readListEnd()
+                else:
+                    iprot.skip(ftype)
+            elif fid == 1:
+                if ftype == TType.STRUCT:
+                    self.gse = airavata.service.profile.groupmanager.cpi.error.ttypes.GroupManagerServiceException()
+                    self.gse.read(iprot)
+                else:
+                    iprot.skip(ftype)
+            elif fid == 2:
+                if ftype == TType.STRUCT:
+                    self.ae = airavata.api.error.ttypes.AuthorizationException()
+                    self.ae.read(iprot)
+                else:
+                    iprot.skip(ftype)
+            else:
+                iprot.skip(ftype)
+            iprot.readFieldEnd()
+        iprot.readStructEnd()
+
+    def write(self, oprot):
+        if oprot._fast_encode is not None and self.thrift_spec is not None:
+            oprot.trans.write(oprot._fast_encode(self, (self.__class__, self.thrift_spec)))
+            return
+        oprot.writeStructBegin('getGroups_result')
+        if self.success is not None:
+            oprot.writeFieldBegin('success', TType.LIST, 0)
+            oprot.writeListBegin(TType.STRUCT, len(self.success))
+            for iter6 in self.success:
+                iter6.write(oprot)
+            oprot.writeListEnd()
+            oprot.writeFieldEnd()
+        if self.gse is not None:
+            oprot.writeFieldBegin('gse', TType.STRUCT, 1)
+            self.gse.write(oprot)
+            oprot.writeFieldEnd()
+        if self.ae is not None:
+            oprot.writeFieldBegin('ae', TType.STRUCT, 2)
+            self.ae.write(oprot)
+            oprot.writeFieldEnd()
+        oprot.writeFieldStop()
+        oprot.writeStructEnd()
+
+    def validate(self):
+        return
+
+    def __repr__(self):
+        L = ['%s=%r' % (key, value)
+             for key, value in self.__dict__.items()]
+        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+    def __eq__(self, other):
+        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
+
+    def __ne__(self, other):
+        return not (self == other)
+
+
 class getAllGroupsUserBelongs_args(object):
     """
     Attributes:
@@ -1549,11 +1774,11 @@ class getAllGroupsUserBelongs_result(object):
             if fid == 0:
                 if ftype == TType.LIST:
                     self.success = []
-                    (_etype3, _size0) = iprot.readListBegin()
-                    for _i4 in range(_size0):
-                        _elem5 = airavata.model.group.ttypes.GroupModel()
-                        _elem5.read(iprot)
-                        self.success.append(_elem5)
+                    (_etype10, _size7) = iprot.readListBegin()
+                    for _i11 in range(_size7):
+                        _elem12 = airavata.model.group.ttypes.GroupModel()
+                        _elem12.read(iprot)
+                        self.success.append(_elem12)
                     iprot.readListEnd()
                 else:
                     iprot.skip(ftype)
@@ -1582,8 +1807,8 @@ class getAllGroupsUserBelongs_result(object):
         if self.success is not None:
             oprot.writeFieldBegin('success', TType.LIST, 0)
             oprot.writeListBegin(TType.STRUCT, len(self.success))
-            for iter6 in self.success:
-                iter6.write(oprot)
+            for iter13 in self.success:
+                iter13.write(oprot)
             oprot.writeListEnd()
             oprot.writeFieldEnd()
         if self.gse is not None:
@@ -1831,10 +2056,10 @@ class addGroupAdmins_args(object):
             elif fid == 3:
                 if ftype == TType.LIST:
                     self.adminIds = []
-                    (_etype10, _size7) = iprot.readListBegin()
-                    for _i11 in range(_size7):
-                        _elem12 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
-                        self.adminIds.append(_elem12)
+                    (_etype17, _size14) = iprot.readListBegin()
+                    for _i18 in range(_size14):
+                        _elem19 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
+                        self.adminIds.append(_elem19)
                     iprot.readListEnd()
                 else:
                     iprot.skip(ftype)
@@ -1859,8 +2084,8 @@ class addGroupAdmins_args(object):
         if self.adminIds is not None:
             oprot.writeFieldBegin('adminIds', TType.LIST, 3)
             oprot.writeListBegin(TType.STRING, len(self.adminIds))
-            for iter13 in self.adminIds:
-                oprot.writeString(iter13.encode('utf-8') if sys.version_info[0] == 2 else iter13)
+            for iter20 in self.adminIds:
+                oprot.writeString(iter20.encode('utf-8') if sys.version_info[0] == 2 else iter20)
             oprot.writeListEnd()
             oprot.writeFieldEnd()
         oprot.writeFieldStop()
@@ -2015,10 +2240,10 @@ class removeGroupAdmins_args(object):
             elif fid == 3:
                 if ftype == TType.LIST:
                     self.adminIds = []
-                    (_etype17, _size14) = iprot.readListBegin()
-                    for _i18 in range(_size14):
-                        _elem19 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
-                        self.adminIds.append(_elem19)
+                    (_etype24, _size21) = iprot.readListBegin()
+                    for _i25 in range(_size21):
+                        _elem26 = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
+                        self.adminIds.append(_elem26)
                     iprot.readListEnd()
                 else:
                     iprot.skip(ftype)
@@ -2043,8 +2268,8 @@ class removeGroupAdmins_args(object):
         if self.adminIds is not None:
             oprot.writeFieldBegin('adminIds', TType.LIST, 3)
             oprot.writeListBegin(TType.STRING, len(self.adminIds))
-            for iter20 in self.adminIds:
-                oprot.writeString(iter20.encode('utf-8') if sys.version_info[0] == 2 else iter20)
+            for iter27 in self.adminIds:
+                oprot.writeString(iter27.encode('utf-8') if sys.version_info[0] == 2 else iter27)
             oprot.writeListEnd()
             oprot.writeFieldEnd()
         oprot.writeFieldStop()

-- 
To stop receiving notification emails like this one, please contact
machristie@apache.org.

[airavata-django-portal] 03/03: AIRAVATA-2599 Set experimentDataDir

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit bc993969845740fe2b0d37d2b743a7d3156e4a40
Author: Marcus Christie <ma...@iu.edu>
AuthorDate: Tue Feb 13 12:31:54 2018 -0500

    AIRAVATA-2599 Set experimentDataDir
---
 django_airavata/apps/api/views.py | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/django_airavata/apps/api/views.py b/django_airavata/apps/api/views.py
index 361ad5f..2c58a58 100644
--- a/django_airavata/apps/api/views.py
+++ b/django_airavata/apps/api/views.py
@@ -16,6 +16,7 @@ from rest_framework.utils.urls import replace_query_param, remove_query_param
 from rest_framework import status
 
 from django.conf import settings
+from django.core.files.storage import FileSystemStorage
 from django.http import JsonResponse, Http404
 from django.shortcuts import render
 from django.views.decorators.csrf import csrf_exempt
@@ -28,6 +29,7 @@ from airavata.model.application.io.ttypes import DataType
 
 from collections import OrderedDict
 import logging
+import os
 
 log = logging.getLogger(__name__)
 
@@ -262,8 +264,22 @@ class ExperimentViewSet(APIBackedViewSet):
 
     def perform_create(self, serializer):
         experiment = serializer.save()
-        experiment.userConfigurationData.storageId = settings.GATEWAY_DATA_STORE_RESOURCE_ID
-        experiment_id = self.request.airavata_client.createExperiment(self.authz_token, self.gateway_id, experiment)
+        experiment.userConfigurationData.storageId =\
+            settings.GATEWAY_DATA_STORE_RESOURCE_ID
+        # Set the experimentDataDir
+        # TODO: move this to a common code location
+        project = self.request.airavata_client.getProject(
+            self.authz_token, experiment.projectId)
+        experiment_data_storage = FileSystemStorage(
+            location=settings.GATEWAY_DATA_STORE_DIR)
+        exp_dir = os.path.join(
+            settings.GATEWAY_DATA_STORE_DIR,
+            experiment_data_storage.get_valid_name(self.username),
+            experiment_data_storage.get_valid_name(project.name),
+            experiment_data_storage.get_valid_name(experiment.experimentName))
+        experiment.userConfigurationData.experimentDataDir = exp_dir
+        experiment_id = self.request.airavata_client.createExperiment(
+            self.authz_token, self.gateway_id, experiment)
         experiment.experimentId = experiment_id
 
     def perform_update(self, serializer):

-- 
To stop receiving notification emails like this one, please contact
machristie@apache.org.

[airavata-django-portal] 02/03: Fix getting all groups

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 3b9c8e6d635bd5e3f0f0aa2a298ecd3e974a971b
Author: Marcus Christie <ma...@iu.edu>
AuthorDate: Thu Feb 8 12:05:43 2018 -0500

    Fix getting all groups
---
 django_airavata/apps/api/views.py | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/django_airavata/apps/api/views.py b/django_airavata/apps/api/views.py
index dd90a1b..361ad5f 100644
--- a/django_airavata/apps/api/views.py
+++ b/django_airavata/apps/api/views.py
@@ -193,14 +193,9 @@ class GroupViewSet(APIBackedViewSet):
 
     serializer_class = serializers.GroupSerializer
     lookup_field = 'group_id'
-    pagination_class = APIResultPagination
-    pagination_viewname = 'django_airavata_api:group-list'
 
     def get_list(self):
-        class GroupMemberResultIterator(APIResultIterator):
-            def get_results(self, limit=-1, offset=0):
-                return self.request.sharing_client.getGroups(self.gateway_id, limit, offset)
-        return GroupMemberResultIterator()
+        return self.request.profile_service['group_manager'].getGroups(self.authz_token)
 
     def get_instance(self, lookup_value):
         return self.request.airavata_client.getGroup(self.authz_token, self.gateway_id, lookup_value)

-- 
To stop receiving notification emails like this one, please contact
machristie@apache.org.