You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by di...@apache.org on 2021/02/26 09:08:45 UTC

[airavata] branch custos-integration updated: Setting custos id to experiment

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

dimuthuupe pushed a commit to branch custos-integration
in repository https://gitbox.apache.org/repos/asf/airavata.git


The following commit(s) were added to refs/heads/custos-integration by this push:
     new 53ccef4  Setting custos id to experiment
53ccef4 is described below

commit 53ccef400adfa563a5063765e75c42c3cd7f06a2
Author: Dimuthu Wannipurage <di...@gmail.com>
AuthorDate: Fri Feb 26 04:08:27 2021 -0500

    Setting custos id to experiment
---
 .../api/server/handler/AiravataServerHandler.java  |   2 +-
 .../airavata/model/experiment/ExperimentModel.java | 113 ++++++++++++++++++++-
 .../core/entities/expcatalog/ExperimentEntity.java |   3 +
 .../experiment_model.thrift                        |   3 +-
 4 files changed, 115 insertions(+), 6 deletions(-)

diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
index c0004df..be6a32b 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
@@ -1550,7 +1550,7 @@ public class AiravataServerHandler implements Airavata.Iface {
         logger.info("Api server accepted experiment creation with name {}", experiment.getExperimentName());
         RegistryService.Client regClient = registryClientPool.getResource();
         String custosId = authzToken.getClaimsMap().get(Constants.CUSTOS_ID);
-
+        experiment.setCustosId(custosId);
         try {
             String experimentId = regClient.createExperiment(gatewayId, experiment);
 
diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/experiment/ExperimentModel.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/experiment/ExperimentModel.java
index 6d9f40b..39ca143 100644
--- a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/experiment/ExperimentModel.java
+++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/experiment/ExperimentModel.java
@@ -64,6 +64,7 @@ public class ExperimentModel implements org.apache.thrift.TBase<ExperimentModel,
   private static final org.apache.thrift.protocol.TField ERRORS_FIELD_DESC = new org.apache.thrift.protocol.TField("errors", org.apache.thrift.protocol.TType.LIST, (short)18);
   private static final org.apache.thrift.protocol.TField PROCESSES_FIELD_DESC = new org.apache.thrift.protocol.TField("processes", org.apache.thrift.protocol.TType.LIST, (short)19);
   private static final org.apache.thrift.protocol.TField WORKFLOW_FIELD_DESC = new org.apache.thrift.protocol.TField("workflow", org.apache.thrift.protocol.TType.STRUCT, (short)20);
+  private static final org.apache.thrift.protocol.TField CUSTOS_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("custosId", org.apache.thrift.protocol.TType.STRING, (short)21);
 
   private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new ExperimentModelStandardSchemeFactory();
   private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new ExperimentModelTupleSchemeFactory();
@@ -88,6 +89,7 @@ public class ExperimentModel implements org.apache.thrift.TBase<ExperimentModel,
   private java.util.List<org.apache.airavata.model.commons.ErrorModel> errors; // optional
   private java.util.List<org.apache.airavata.model.process.ProcessModel> processes; // optional
   private org.apache.airavata.model.workflow.AiravataWorkflow workflow; // optional
+  private java.lang.String custosId; // optional
 
   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
@@ -114,7 +116,8 @@ public class ExperimentModel implements org.apache.thrift.TBase<ExperimentModel,
     EXPERIMENT_STATUS((short)17, "experimentStatus"),
     ERRORS((short)18, "errors"),
     PROCESSES((short)19, "processes"),
-    WORKFLOW((short)20, "workflow");
+    WORKFLOW((short)20, "workflow"),
+    CUSTOS_ID((short)21, "custosId");
 
     private static final java.util.Map<java.lang.String, _Fields> byName = new java.util.HashMap<java.lang.String, _Fields>();
 
@@ -169,6 +172,8 @@ public class ExperimentModel implements org.apache.thrift.TBase<ExperimentModel,
           return PROCESSES;
         case 20: // WORKFLOW
           return WORKFLOW;
+        case 21: // CUSTOS_ID
+          return CUSTOS_ID;
         default:
           return null;
       }
@@ -212,7 +217,7 @@ public class ExperimentModel implements org.apache.thrift.TBase<ExperimentModel,
   private static final int __CREATIONTIME_ISSET_ID = 0;
   private static final int __ENABLEEMAILNOTIFICATION_ISSET_ID = 1;
   private byte __isset_bitfield = 0;
-  private static final _Fields optionals[] = {_Fields.CREATION_TIME,_Fields.DESCRIPTION,_Fields.EXECUTION_ID,_Fields.GATEWAY_EXECUTION_ID,_Fields.GATEWAY_INSTANCE_ID,_Fields.ENABLE_EMAIL_NOTIFICATION,_Fields.EMAIL_ADDRESSES,_Fields.USER_CONFIGURATION_DATA,_Fields.EXPERIMENT_INPUTS,_Fields.EXPERIMENT_OUTPUTS,_Fields.EXPERIMENT_STATUS,_Fields.ERRORS,_Fields.PROCESSES,_Fields.WORKFLOW};
+  private static final _Fields optionals[] = {_Fields.CREATION_TIME,_Fields.DESCRIPTION,_Fields.EXECUTION_ID,_Fields.GATEWAY_EXECUTION_ID,_Fields.GATEWAY_INSTANCE_ID,_Fields.ENABLE_EMAIL_NOTIFICATION,_Fields.EMAIL_ADDRESSES,_Fields.USER_CONFIGURATION_DATA,_Fields.EXPERIMENT_INPUTS,_Fields.EXPERIMENT_OUTPUTS,_Fields.EXPERIMENT_STATUS,_Fields.ERRORS,_Fields.PROCESSES,_Fields.WORKFLOW,_Fields.CUSTOS_ID};
   public static final java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
   static {
     java.util.Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new java.util.EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
@@ -262,6 +267,8 @@ public class ExperimentModel implements org.apache.thrift.TBase<ExperimentModel,
             new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.airavata.model.process.ProcessModel.class))));
     tmpMap.put(_Fields.WORKFLOW, new org.apache.thrift.meta_data.FieldMetaData("workflow", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, org.apache.airavata.model.workflow.AiravataWorkflow.class)));
+    tmpMap.put(_Fields.CUSTOS_ID, new org.apache.thrift.meta_data.FieldMetaData("custosId", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
     metaDataMap = java.util.Collections.unmodifiableMap(tmpMap);
     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ExperimentModel.class, metaDataMap);
   }
@@ -372,6 +379,9 @@ public class ExperimentModel implements org.apache.thrift.TBase<ExperimentModel,
     if (other.isSetWorkflow()) {
       this.workflow = new org.apache.airavata.model.workflow.AiravataWorkflow(other.workflow);
     }
+    if (other.isSetCustosId()) {
+      this.custosId = other.custosId;
+    }
   }
 
   public ExperimentModel deepCopy() {
@@ -404,6 +414,7 @@ public class ExperimentModel implements org.apache.thrift.TBase<ExperimentModel,
     this.errors = null;
     this.processes = null;
     this.workflow = null;
+    this.custosId = null;
   }
 
   public java.lang.String getExperimentId() {
@@ -962,6 +973,29 @@ public class ExperimentModel implements org.apache.thrift.TBase<ExperimentModel,
     }
   }
 
+  public java.lang.String getCustosId() {
+    return this.custosId;
+  }
+
+  public void setCustosId(java.lang.String custosId) {
+    this.custosId = custosId;
+  }
+
+  public void unsetCustosId() {
+    this.custosId = null;
+  }
+
+  /** Returns true if field custosId is set (has been assigned a value) and false otherwise */
+  public boolean isSetCustosId() {
+    return this.custosId != null;
+  }
+
+  public void setCustosIdIsSet(boolean value) {
+    if (!value) {
+      this.custosId = null;
+    }
+  }
+
   public void setFieldValue(_Fields field, java.lang.Object value) {
     switch (field) {
     case EXPERIMENT_ID:
@@ -1124,6 +1158,14 @@ public class ExperimentModel implements org.apache.thrift.TBase<ExperimentModel,
       }
       break;
 
+    case CUSTOS_ID:
+      if (value == null) {
+        unsetCustosId();
+      } else {
+        setCustosId((java.lang.String)value);
+      }
+      break;
+
     }
   }
 
@@ -1189,6 +1231,9 @@ public class ExperimentModel implements org.apache.thrift.TBase<ExperimentModel,
     case WORKFLOW:
       return getWorkflow();
 
+    case CUSTOS_ID:
+      return getCustosId();
+
     }
     throw new java.lang.IllegalStateException();
   }
@@ -1240,6 +1285,8 @@ public class ExperimentModel implements org.apache.thrift.TBase<ExperimentModel,
       return isSetProcesses();
     case WORKFLOW:
       return isSetWorkflow();
+    case CUSTOS_ID:
+      return isSetCustosId();
     }
     throw new java.lang.IllegalStateException();
   }
@@ -1439,6 +1486,15 @@ public class ExperimentModel implements org.apache.thrift.TBase<ExperimentModel,
         return false;
     }
 
+    boolean this_present_custosId = true && this.isSetCustosId();
+    boolean that_present_custosId = true && that.isSetCustosId();
+    if (this_present_custosId || that_present_custosId) {
+      if (!(this_present_custosId && that_present_custosId))
+        return false;
+      if (!this.custosId.equals(that.custosId))
+        return false;
+    }
+
     return true;
   }
 
@@ -1526,6 +1582,10 @@ public class ExperimentModel implements org.apache.thrift.TBase<ExperimentModel,
     if (isSetWorkflow())
       hashCode = hashCode * 8191 + workflow.hashCode();
 
+    hashCode = hashCode * 8191 + ((isSetCustosId()) ? 131071 : 524287);
+    if (isSetCustosId())
+      hashCode = hashCode * 8191 + custosId.hashCode();
+
     return hashCode;
   }
 
@@ -1737,6 +1797,16 @@ public class ExperimentModel implements org.apache.thrift.TBase<ExperimentModel,
         return lastComparison;
       }
     }
+    lastComparison = java.lang.Boolean.valueOf(isSetCustosId()).compareTo(other.isSetCustosId());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetCustosId()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.custosId, other.custosId);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
     return 0;
   }
 
@@ -1936,6 +2006,16 @@ public class ExperimentModel implements org.apache.thrift.TBase<ExperimentModel,
       }
       first = false;
     }
+    if (isSetCustosId()) {
+      if (!first) sb.append(", ");
+      sb.append("custosId:");
+      if (this.custosId == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.custosId);
+      }
+      first = false;
+    }
     sb.append(")");
     return sb.toString();
   }
@@ -2238,6 +2318,14 @@ public class ExperimentModel implements org.apache.thrift.TBase<ExperimentModel,
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
+          case 21: // CUSTOS_ID
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.custosId = iprot.readString();
+              struct.setCustosIdIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
           default:
             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
         }
@@ -2417,6 +2505,13 @@ public class ExperimentModel implements org.apache.thrift.TBase<ExperimentModel,
           oprot.writeFieldEnd();
         }
       }
+      if (struct.custosId != null) {
+        if (struct.isSetCustosId()) {
+          oprot.writeFieldBegin(CUSTOS_ID_FIELD_DESC);
+          oprot.writeString(struct.custosId);
+          oprot.writeFieldEnd();
+        }
+      }
       oprot.writeFieldStop();
       oprot.writeStructEnd();
     }
@@ -2483,7 +2578,10 @@ public class ExperimentModel implements org.apache.thrift.TBase<ExperimentModel,
       if (struct.isSetWorkflow()) {
         optionals.set(13);
       }
-      oprot.writeBitSet(optionals, 14);
+      if (struct.isSetCustosId()) {
+        optionals.set(14);
+      }
+      oprot.writeBitSet(optionals, 15);
       if (struct.isSetCreationTime()) {
         oprot.writeI64(struct.creationTime);
       }
@@ -2562,6 +2660,9 @@ public class ExperimentModel implements org.apache.thrift.TBase<ExperimentModel,
       if (struct.isSetWorkflow()) {
         struct.workflow.write(oprot);
       }
+      if (struct.isSetCustosId()) {
+        oprot.writeString(struct.custosId);
+      }
     }
 
     @Override
@@ -2579,7 +2680,7 @@ public class ExperimentModel implements org.apache.thrift.TBase<ExperimentModel,
       struct.setUserNameIsSet(true);
       struct.experimentName = iprot.readString();
       struct.setExperimentNameIsSet(true);
-      java.util.BitSet incoming = iprot.readBitSet(14);
+      java.util.BitSet incoming = iprot.readBitSet(15);
       if (incoming.get(0)) {
         struct.creationTime = iprot.readI64();
         struct.setCreationTimeIsSet(true);
@@ -2697,6 +2798,10 @@ public class ExperimentModel implements org.apache.thrift.TBase<ExperimentModel,
         struct.workflow.read(iprot);
         struct.setWorkflowIsSet(true);
       }
+      if (incoming.get(14)) {
+        struct.custosId = iprot.readString();
+        struct.setCustosIdIsSet(true);
+      }
     }
   }
 
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ExperimentEntity.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ExperimentEntity.java
index 73e9ded..aa3d32b 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ExperimentEntity.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ExperimentEntity.java
@@ -73,6 +73,9 @@ public class ExperimentEntity implements Serializable {
     @Column(name = "ENABLE_EMAIL_NOTIFICATION")
     public boolean enableEmailNotification;
 
+    @Column(name = "CUSTOS_ID")
+    public boolean custosId;
+
     @Lob
     @Column(name = "EMAIL_ADDRESSES")
     public String emailAddresses;
diff --git a/thrift-interface-descriptions/data-models/experiment-catalog-models/experiment_model.thrift b/thrift-interface-descriptions/data-models/experiment-catalog-models/experiment_model.thrift
index 1941d64..c0e0121 100644
--- a/thrift-interface-descriptions/data-models/experiment-catalog-models/experiment_model.thrift
+++ b/thrift-interface-descriptions/data-models/experiment-catalog-models/experiment_model.thrift
@@ -108,7 +108,8 @@ struct ExperimentModel {
     17: optional list<status_models.ExperimentStatus> experimentStatus,
     18: optional list<airavata_commons.ErrorModel> errors,
     19: optional list<process_model.ProcessModel> processes,
-    20: optional airavata_workflow_model.AiravataWorkflow workflow
+    20: optional airavata_workflow_model.AiravataWorkflow workflow,
+    21: optional string custosId
     }
 
 struct ExperimentSummaryModel {