airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [airavata-django-portal] 01/02: Allow passing experimentDataDir to create experiment
Date Wed, 08 May 2019 20:30:36 GMT
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 4d2fb01a8670ecca8a290cb093a33dd6e746fac2
Author: Marcus Christie <machristie@apache.org>
AuthorDate: Wed May 8 14:52:09 2019 -0400

    Allow passing experimentDataDir to create experiment
---
 django_airavata/apps/api/views.py                             | 11 ++++++-----
 .../js/containers/CreateExperimentContainer.vue               |  5 ++++-
 .../django_airavata_workspace/js/entry-create-experiment.js   |  6 +++++-
 .../django_airavata_workspace/create_experiment.html          |  5 ++++-
 django_airavata/apps/workspace/views.py                       | 11 ++++++++---
 5 files changed, 27 insertions(+), 11 deletions(-)

diff --git a/django_airavata/apps/api/views.py b/django_airavata/apps/api/views.py
index dffba15..d5a03af 100644
--- a/django_airavata/apps/api/views.py
+++ b/django_airavata/apps/api/views.py
@@ -181,7 +181,7 @@ class ExperimentViewSet(APIBackedViewSet):
             gatewayId=self.gateway_id,
             userName=self.username)
         # The project or exp name may have changed, so update the exp data dir
-        self._set_storage_id_and_data_dir(experiment)
+        # self._set_storage_id_and_data_dir(experiment)
         self.request.airavata_client.updateExperiment(
             self.authz_token, experiment.experimentId, experiment)
         self._update_most_recent_project(experiment.projectId)
@@ -193,10 +193,11 @@ class ExperimentViewSet(APIBackedViewSet):
         # Create experiment dir and set it on model
         project = self.request.airavata_client.getProject(
             self.authz_token, experiment.projectId)
-        exp_dir = datastore.get_experiment_dir(self.username,
-                                               project.name,
-                                               experiment.experimentName)
-        experiment.userConfigurationData.experimentDataDir = exp_dir
+        if not experiment.userConfigurationData.experimentDataDir:
+            exp_dir = datastore.get_experiment_dir(self.username,
+                                                   project.name,
+                                                   experiment.experimentName)
+            experiment.userConfigurationData.experimentDataDir = exp_dir
 
     @detail_route(methods=['post'])
     def launch(self, request, experiment_id=None):
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/containers/CreateExperimentContainer.vue
b/django_airavata/apps/workspace/static/django_airavata_workspace/js/containers/CreateExperimentContainer.vue
index c7f7d0b..d820834 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/containers/CreateExperimentContainer.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/containers/CreateExperimentContainer.vue
@@ -20,7 +20,7 @@ import moment from "moment";
 
 export default {
   name: "create-experiment-container",
-  props: ["app-module-id", "user-input-files"],
+  props: ["app-module-id", "user-input-files", "experiment-data-dir"],
   data() {
     return {
       experiment: null,
@@ -66,6 +66,9 @@ export default {
       }
       experiment.executionId = appInterface.applicationInterfaceId;
     });
+    if (this.experimentDataDir) {
+      experiment.userConfigurationData.experimentDataDir = this.experimentDataDir;
+    }
     Promise.all([loadAppModule, loadAppInterface])
       .then(() => (this.experiment = experiment))
       .catch(error => {
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/entry-create-experiment.js
b/django_airavata/apps/workspace/static/django_airavata_workspace/js/entry-create-experiment.js
index 386d665..4f2e983 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/entry-create-experiment.js
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/entry-create-experiment.js
@@ -8,7 +8,8 @@ entry(Vue => {
         h(CreateExperimentContainer, {
           props: {
             appModuleId: this.appModuleId,
-            userInputFiles: this.userInputFiles
+            userInputFiles: this.userInputFiles,
+            experimentDataDir: this.experimentDataDir
           }
         })
       ]);
@@ -26,6 +27,9 @@ entry(Vue => {
       if (this.$el.dataset.userInputFiles) {
         this.userInputFiles = JSON.parse(this.$el.dataset.userInputFiles);
       }
+      if (this.$el.dataset.experimentDataDir) {
+        this.experimentDataDir = this.$el.dataset.experimentDataDir;
+      }
     }
   }).$mount("#create-experiment");
 });
diff --git a/django_airavata/apps/workspace/templates/django_airavata_workspace/create_experiment.html
b/django_airavata/apps/workspace/templates/django_airavata_workspace/create_experiment.html
index 327d5a3..08939a2 100644
--- a/django_airavata/apps/workspace/templates/django_airavata_workspace/create_experiment.html
+++ b/django_airavata/apps/workspace/templates/django_airavata_workspace/create_experiment.html
@@ -2,6 +2,9 @@
 
 {% block content %}
 
-<div id="{{ bundle_name }}" data-app-module-id="{{ app_module_id }}" data-user-input-files="{{
user_input_files }}"></div>
+<div id="{{ bundle_name }}" data-app-module-id="{{ app_module_id }}" data-user-input-files="{{
user_input_files }}"
+  {% if experiment_data_dir %}data-experiment-data-dir="{{ experiment_data_dir }}"{% endif
%}
+>
+</div>
 
 {% endblock content %}
diff --git a/django_airavata/apps/workspace/views.py b/django_airavata/apps/workspace/views.py
index 402bceb..45675cf 100644
--- a/django_airavata/apps/workspace/views.py
+++ b/django_airavata/apps/workspace/views.py
@@ -94,12 +94,17 @@ def create_experiment(request, app_module_id):
                 data_product_uri = request.airavata_client.registerDataProduct(
                     request.authz_token, data_product)
                 user_input_files[app_input['name']] = data_product_uri
+    context = {
+        'bundle_name': 'create-experiment',
+        'app_module_id': app_module_id,
+        'user_input_files': json.dumps(user_input_files)
+    }
+    if 'experiment-data-dir' in request.GET:
+        context['experiment_data_dir'] = request.GET['experiment-data-dir']
 
     return render(request,
                   'django_airavata_workspace/create_experiment.html',
-                  {'bundle_name': 'create-experiment',
-                   'app_module_id': app_module_id,
-                   'user_input_files': json.dumps(user_input_files)})
+                  context)
 
 
 @login_required


Mime
View raw message