airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From machris...@apache.org
Subject [airavata-django-portal] 21/28: AIRAVATA-2876 Automatically add stdout, stderr outputs
Date Tue, 11 Sep 2018 17:12:09 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 183bc6cfa5925b8216309a35d970847e02f8b258
Author: Marcus Christie <machrist@iu.edu>
AuthorDate: Thu Sep 6 11:24:32 2018 -0400

    AIRAVATA-2876 Automatically add stdout, stderr outputs
---
 .../src/store/applications/app_interfaces.js           |  4 +++-
 django_airavata/apps/api/serializers.py                | 11 ++++++-----
 .../js/models/ApplicationInterfaceDefinition.js        | 18 ++++++++++++++++++
 3 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/django_airavata/apps/admin/static/django_airavata_admin/src/store/applications/app_interfaces.js
b/django_airavata/apps/admin/static/django_airavata_admin/src/store/applications/app_interfaces.js
index e1c9f9e..cfdffae 100644
--- a/django_airavata/apps/admin/static/django_airavata_admin/src/store/applications/app_interfaces.js
+++ b/django_airavata/apps/admin/static/django_airavata_admin/src/store/applications/app_interfaces.js
@@ -21,7 +21,9 @@ export default {
         .catch(error => {
           if (error.details.status === 404) {
             // If there is no interface, just create a new instance
-            commit('setCurrentInterface', new models.ApplicationInterfaceDefinition());
+            const appInterface = new models.ApplicationInterfaceDefinition();
+            appInterface.addStandardOutAndStandardErrorOutputs();
+            commit('setCurrentInterface', appInterface);
             return Promise.resolve(null);
           } else {
             throw error;
diff --git a/django_airavata/apps/api/serializers.py b/django_airavata/apps/api/serializers.py
index bf16c3c..e26d31d 100644
--- a/django_airavata/apps/api/serializers.py
+++ b/django_airavata/apps/api/serializers.py
@@ -298,17 +298,18 @@ class ApplicationInterfaceDescriptionSerializer(
     def to_representation(self, instance):
         rep = super().to_representation(instance)
         # Sort applicationInputs by 'inputOrder'
-        rep['applicationInputs'].sort(key=lambda input: input['inputOrder'])
+        if rep['applicationInputs'] is not None:
+            rep['applicationInputs'].sort(
+                key=lambda input: input['inputOrder'])
         return rep
 
     def to_internal_value(self, data):
         validated_data = super().to_internal_value(data)
         # Update application input order based on order in array
         app_inputs = validated_data.get('applicationInputs', [])
-        log.debug('app_inputs={}'.format(app_inputs))
-        for i in range(len(app_inputs)):
-            app_inputs[i]['inputOrder'] = i
-        log.debug('app_inputs={}'.format(app_inputs))
+        if app_inputs is not None:
+            for i in range(len(app_inputs)):
+                app_inputs[i]['inputOrder'] = i
         return validated_data
 
 
diff --git a/django_airavata/apps/api/static/django_airavata_api/js/models/ApplicationInterfaceDefinition.js
b/django_airavata/apps/api/static/django_airavata_api/js/models/ApplicationInterfaceDefinition.js
index 43c3ba6..17cb856 100644
--- a/django_airavata/apps/api/static/django_airavata_api/js/models/ApplicationInterfaceDefinition.js
+++ b/django_airavata/apps/api/static/django_airavata_api/js/models/ApplicationInterfaceDefinition.js
@@ -1,6 +1,7 @@
 import BaseModel from './BaseModel'
 import InputDataObjectType from './InputDataObjectType'
 import OutputDataObjectType from './OutputDataObjectType'
+import DataType from './DataType';
 
 
 const FIELDS = [
@@ -42,4 +43,21 @@ export default class ApplicationInterfaceDefinition extends BaseModel {
   constructor(data = {}) {
     super(FIELDS, data);
   }
+
+  addStandardOutAndStandardErrorOutputs() {
+    const stdout = new OutputDataObjectType({
+      name: "Standard-Out",
+      type: DataType.STDOUT,
+      isRequired: true,
+    });
+    const stderr = new OutputDataObjectType({
+      name: "Standard-Error",
+      type: DataType.STDERR,
+      isRequired: true,
+    });
+    if (!this.applicationOutputs) {
+      this.applicationOutputs = [];
+    }
+    this.applicationOutputs.push(stdout, stderr);
+  }
 }


Mime
View raw message