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 2021/04/28 22:03:17 UTC

[airavata-django-portal-sdk] branch mft-integration updated: AIRAVATA-3458 Get file metadata for a data product

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

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


The following commit(s) were added to refs/heads/mft-integration by this push:
     new e02efcc  AIRAVATA-3458 Get file metadata for a data product
e02efcc is described below

commit e02efcced32fe34d2b9825f7d65a76b7c33b2dcf
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Wed Apr 28 18:02:43 2021 -0400

    AIRAVATA-3458 Get file metadata for a data product
---
 airavata_django_portal_sdk/user_storage/__init__.py | 2 ++
 airavata_django_portal_sdk/user_storage/api.py      | 7 +++++++
 2 files changed, 9 insertions(+)

diff --git a/airavata_django_portal_sdk/user_storage/__init__.py b/airavata_django_portal_sdk/user_storage/__init__.py
index 283b2b9..d491a94 100644
--- a/airavata_django_portal_sdk/user_storage/__init__.py
+++ b/airavata_django_portal_sdk/user_storage/__init__.py
@@ -7,6 +7,7 @@ from .api import (
     dir_exists,
     exists,
     experiment_dir_exists,
+    get_data_product_metadata,
     get_download_url,
     get_experiment_dir,
     get_file,
@@ -34,6 +35,7 @@ __all__ = [
     'dir_exists',
     'exists',
     'experiment_dir_exists',
+    'get_data_product_metadata',
     'get_download_url',
     'get_experiment_dir',
     'get_file',
diff --git a/airavata_django_portal_sdk/user_storage/api.py b/airavata_django_portal_sdk/user_storage/api.py
index 1c47f29..76761d4 100644
--- a/airavata_django_portal_sdk/user_storage/api.py
+++ b/airavata_django_portal_sdk/user_storage/api.py
@@ -394,6 +394,13 @@ def get_file_metadata(request, path, storage_resource_id=None):
         raise ObjectDoesNotExist("File does not exist at that path.")
 
 
+def get_data_product_metadata(request, data_product=None, data_product_uri=None):
+    if data_product is None:
+        data_product = _get_data_product(request, data_product_uri)
+    storage_resource_id, path = _get_replica_resource_id_and_filepath(data_product)
+    return get_file_metadata(request, path, storage_resource_id)
+
+
 def get_file(request, path, storage_resource_id=None):
     warnings.warn("Use 'get_file_metadata' instead.", DeprecationWarning)
     return get_file_metadata(request, path, storage_resource_id)