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 2023/09/27 19:00:34 UTC

[airavata-cookiecutter-django-output-view] 05/10: Airavata API sample code

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

machristie pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airavata-cookiecutter-django-output-view.git

commit b209f2a851ec4bbeee57db75c1219efe8bfd453e
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Thu Jun 3 10:03:20 2021 -0400

    Airavata API sample code
---
 .../{{cookiecutter.project_slug}}.py               | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/{{cookiecutter.custom_django_app_module_name}}/{{cookiecutter.output_views_directory_name}}/{{cookiecutter.project_slug}}.py b/{{cookiecutter.custom_django_app_module_name}}/{{cookiecutter.output_views_directory_name}}/{{cookiecutter.project_slug}}.py
index 188769f..5fa1c89 100644
--- a/{{cookiecutter.custom_django_app_module_name}}/{{cookiecutter.output_views_directory_name}}/{{cookiecutter.project_slug}}.py
+++ b/{{cookiecutter.custom_django_app_module_name}}/{{cookiecutter.output_views_directory_name}}/{{cookiecutter.project_slug}}.py
@@ -43,6 +43,30 @@ class {{ cookiecutter.output_view_provider_class_name }}:
         # for more information.
 
 
+        # Example code: Airavata API client
+        # Make calls to the Airavata API from the output view provider, for example:
+        #
+        # data_product = request.airavata_client.getDataProduct(
+        #        request.authz_token, experiment_output.value)
+        #
+        # In this example, the DataProduct object is loaded for the output file.
+        # 'experiment_output.value' has the Data Product URI for the output
+        # file, the unique identifier in the Airavata API for this output file.
+        # The returned DataProduct object contains metadata about the output
+        # file and the location(s) where it is stored. See
+        # http://airavata.apache.org/api-docs/master/replica_catalog_models.html#Struct_DataProductModel
+        # for more information.
+        #
+        # The authorization token is always the first argument of Airavata API calls
+        # and is available as 'request.authz_token'. Some API methods require a
+        # 'gatewayID' argument and that is available on the Django settings object
+        # as 'settings.GATEWAY_ID'.
+        # For documentation on other Airavata API methods, see
+        # https://docs.airavata.org/en/master/technical-documentation/airavata-api/.
+        # The Airavata Django Portal uses the Airavata Python Client SDK:
+        # https://github.com/apache/airavata/tree/master/airavata-api/airavata-client-sdks/airavata-python-sdk
+
+
     {% if cookiecutter.output_view_display_type == "link" %}
         label = "Link to Google"
         url = "https://google.com"