airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [airavata-django-portal] 06/06: AIRAVATA-2615 Stop polling if experiment no longer progressing
Date Thu, 25 Jan 2018 22:09:39 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 9ba962dce6e193da89b4a50ed69bf49cfdb1ea48
Author: Marcus Christie <machrist@iu.edu>
AuthorDate: Thu Jan 25 17:08:32 2018 -0500

    AIRAVATA-2615 Stop polling if experiment no longer progressing
---
 .../api/static/django_airavata_api/js/models/BaseModel.js     |  5 +++++
 .../api/static/django_airavata_api/js/models/Experiment.js    | 11 +++++++++++
 django_airavata/apps/api/views.py                             | 10 ++++++++--
 .../js/components/experiment/ExperimentSummary.vue            | 11 ++++++++++-
 4 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/django_airavata/apps/api/static/django_airavata_api/js/models/BaseModel.js b/django_airavata/apps/api/static/django_airavata_api/js/models/BaseModel.js
index 8b5679f..5bb0c63 100644
--- a/django_airavata/apps/api/static/django_airavata_api/js/models/BaseModel.js
+++ b/django_airavata/apps/api/static/django_airavata_api/js/models/BaseModel.js
@@ -54,6 +54,11 @@ export default class BaseModel {
     convertModelField(modelClass, fieldValue, fieldDefault) {
         if (typeof fieldValue !== 'undefined') {
             if (modelClass.prototype instanceof BaseEnum) {
+                // When cloning the fieldValue is an enum instance
+                if (fieldValue instanceof BaseEnum){
+                    return fieldValue;
+                }
+                // Otherwise it is an integer that we need to convert to enum
                 return modelClass.byValue(fieldValue);
             } else {
                 return new modelClass(fieldValue);
diff --git a/django_airavata/apps/api/static/django_airavata_api/js/models/Experiment.js b/django_airavata/apps/api/static/django_airavata_api/js/models/Experiment.js
index 1f249dc..560e4ce 100644
--- a/django_airavata/apps/api/static/django_airavata_api/js/models/Experiment.js
+++ b/django_airavata/apps/api/static/django_airavata_api/js/models/Experiment.js
@@ -1,6 +1,7 @@
 
 import BaseModel from './BaseModel';
 import ErrorModel from './ErrorModel'
+import ExperimentState from './ExperimentState'
 import ExperimentStatus from './ExperimentStatus'
 import InputDataObjectType from './InputDataObjectType'
 import OutputDataObjectType from './OutputDataObjectType'
@@ -98,4 +99,14 @@ export default class Experiment extends BaseModel {
         }
         return validationResults;
     }
+
+    get isProgressing() {
+        const progressingStates = [ExperimentState.SCHEDULED,
+                                   ExperimentState.LAUNCHED,
+                                   ExperimentState.EXECUTING,
+                                   ExperimentState.CANCELING];
+        return this.experimentStatus
+            && this.experimentStatus.length > 0
+            && progressingStates.indexOf(this.experimentStatus[0].state) >= 0;
+    }
 }
diff --git a/django_airavata/apps/api/views.py b/django_airavata/apps/api/views.py
index 45be9db..99fce0d 100644
--- a/django_airavata/apps/api/views.py
+++ b/django_airavata/apps/api/views.py
@@ -275,12 +275,18 @@ class FullExperimentViewSet(mixins.RetrieveModelMixin,
             self.request.airavata_client.getDataProduct(self.authz_token,
                                                         output.value)
             for output in experimentModel.experimentOutputs
-            if output.type in (DataType.URI, DataType.STDOUT, DataType.STDERR)]
+            if (output.value.startswith('airavata-dp')
+                and output.type in (DataType.URI,
+                                    DataType.STDOUT,
+                                    DataType.STDERR))]
         inputDataProducts = [
             self.request.airavata_client.getDataProduct(self.authz_token,
                                                         inp.value)
             for inp in experimentModel.experimentInputs
-            if inp.type in (DataType.URI, DataType.STDOUT, DataType.STDERR)]
+            if (inp.value.startswith('airavata-dp')
+                and inp.type in (DataType.URI,
+                                 DataType.STDOUT,
+                                 DataType.STDERR))]
         appInterfaceId = experimentModel.executionId
         applicationInterface = self.request.airavata_client\
             .getApplicationInterface(self.authz_token, appInterfaceId)
diff --git a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/ExperimentSummary.vue
b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/ExperimentSummary.vue
index 77c7535..ba00545 100644
--- a/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/ExperimentSummary.vue
+++ b/django_airavata/apps/workspace/static/django_airavata_workspace/js/components/experiment/ExperimentSummary.vue
@@ -52,7 +52,13 @@
                                 </tr>
                                 <tr>
                                     <th scope="row">Experiment Status</th>
-                                    <td>{{ fullExperiment.experimentStatusName }}</td>
+                                    <td>
+                                        <template v-if="fullExperiment.experiment.isProgressing">
+                                            <i class="fa fa-refresh fa-spin"></i>
+                                            <span class="sr-only">Progressing...</span>
+                                        </template>
+                                        {{ fullExperiment.experimentStatusName }}
+                                    </td>
                                 </tr>
                                 <!--  TODO: leave this out for now -->
                                 <!-- <tr>
@@ -147,6 +153,9 @@ export default {
         },
         initPollingExperiment: function() {
             var pollExperiment = function() {
+                if (!this.localFullExperiment.experiment.isProgressing) {
+                    return;
+                }
                 this.loadExperiment()
                     .then(exp => {
                         setTimeout(pollExperiment.bind(this), 3000);

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

Mime
View raw message