Updated Branches: refs/heads/master da4c153a4 -> b8152e39f
http://git-wip-us.apache.org/repos/asf/airavata/blob/b8152e39/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java new file mode 100644 index 0000000..84eeda3 --- /dev/null +++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/ExperimentRegistry.java @@ -0,0 +1,130 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +package org.apache.airavata.persistance.registry.jpa.impl; + +import org.apache.airavata.common.exception.ApplicationSettingsException; +import org.apache.airavata.model.experiment.BasicMetadata; +import org.apache.airavata.model.experiment.ConfigurationData; +import org.apache.airavata.persistance.registry.jpa.Resource; +import org.apache.airavata.persistance.registry.jpa.ResourceType; +import org.apache.airavata.persistance.registry.jpa.resources.ExperimentConfigDataResource; +import org.apache.airavata.persistance.registry.jpa.resources.ExperimentMetadataResource; +import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource; +import org.apache.airavata.registry.cpi.DependentDataType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.sql.Timestamp; +import java.util.Calendar; +import java.util.List; +import java.util.UUID; + +public class ExperimentRegistry { + private GatewayRegistry gatewayRegistry; + private final static Logger logger = LoggerFactory.getLogger(ExperimentRegistry.class); + + public void add(BasicMetadata basicMetadata) { + try { + gatewayRegistry = new GatewayRegistry(); + GatewayResource gateway = gatewayRegistry.getGateway(); + ExperimentMetadataResource exBasicData = gateway.createBasicMetada(getExperimentID(basicMetadata.getExperimentName())); + exBasicData.setExperimentName(basicMetadata.getExperimentName()); + exBasicData.setDescription(basicMetadata.getExperimentDescription()); + exBasicData.setExecutionUser(basicMetadata.getUserName()); + exBasicData.setSubmittedDate(getCurrentTimestamp()); + exBasicData.setShareExp(basicMetadata.isSetShareExperimentPublicly()); + exBasicData.save(); + } catch (ApplicationSettingsException e) { + logger.error("Unable to read airavata-server properties", e.getMessage()); + } + } + + public void add(ConfigurationData configurationData, String experimentID) { + try { + gatewayRegistry = new GatewayRegistry(); + GatewayResource gateway = gatewayRegistry.getGateway(); + ExperimentMetadataResource exBasicData = (ExperimentMetadataResource)gateway.get(ResourceType.EXPERIMENT_METADATA, experimentID); + ExperimentConfigDataResource exConfigData = (ExperimentConfigDataResource)exBasicData.create(ResourceType.EXPERIMENT_CONFIG_DATA); + BasicMetadata updatedBasicMetadata = configurationData.getBasicMetadata(); + if (updatedBasicMetadata != null){ + if (updatedBasicMetadata.getExperimentName() != null && !updatedBasicMetadata.getExperimentName().equals("")){ + exBasicData.setExperimentName(updatedBasicMetadata.getExperimentName()); + } + if (updatedBasicMetadata.getExperimentDescription() != null && !updatedBasicMetadata.getExperimentDescription().equals("")){ + exBasicData.setDescription(updatedBasicMetadata.getExperimentDescription()); + } + if (updatedBasicMetadata.getUserName() != null && !updatedBasicMetadata.getUserName().equals("")){ + exBasicData.setExecutionUser(updatedBasicMetadata.getUserName()); + } + exBasicData.setShareExp(updatedBasicMetadata.isSetShareExperimentPublicly()); + exBasicData.save(); + } + exConfigData.setExMetadata(exBasicData); + exConfigData.setApplicationID(configurationData.getApplicationId()); + exConfigData.setApplicationVersion(configurationData.getApplicationVersion()); + exConfigData.setWorkflowTemplateId(configurationData.getWorkflowTemplateId()); + exConfigData.setWorkflowTemplateVersion(configurationData.getWorklfowTemplateVersion()); + + exConfigData.setCpuCount(configurationData.getComputationalResourceScheduling().getTotalCPUCount()); + exConfigData.setAiravataAutoSchedule(configurationData.getComputationalResourceScheduling().isAiravataAutoSchedule()); + exConfigData.setOverrideManualSchedule(configurationData.getComputationalResourceScheduling().isOverrideManualScheduledParams()); + exConfigData.setResourceHostID(configurationData.getComputationalResourceScheduling().getResourceHostId()); + + } catch (ApplicationSettingsException e) { + logger.error("Unable to read airavata-server properties", e.getMessage()); + } + } + + public String getExperimentID (String experimentName){ + return experimentName + "_" + UUID.randomUUID(); + } + + public void update(DependentDataType dataType, Object newObjectToUpdate) { + + } + + public void update(DependentDataType dataType, Object identifier, Object field, Object value) { + + } + + public List<Object> get(DependentDataType dataType, Object filteredBy, Object value) { + return null; + } + + public Object getValue(DependentDataType dataType, Object identifier, Object field) { + return null; + } + + public void remove(DependentDataType dataType, Object identifier) { + + } + + public boolean isExist(DependentDataType dataType, Object identifier) { + return false; + } + + public Timestamp getCurrentTimestamp() { + Calendar calender = Calendar.getInstance(); + java.util.Date d = calender.getTime(); + return new Timestamp(d.getTime()); + } +} http://git-wip-us.apache.org/repos/asf/airavata/blob/b8152e39/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/GatewayRegistry.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/GatewayRegistry.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/GatewayRegistry.java new file mode 100644 index 0000000..931f62f --- /dev/null +++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/GatewayRegistry.java @@ -0,0 +1,35 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +package org.apache.airavata.persistance.registry.jpa.impl; + +import org.apache.airavata.common.exception.ApplicationSettingsException; +import org.apache.airavata.common.utils.ServerSettings; +import org.apache.airavata.persistance.registry.jpa.ResourceUtils; +import org.apache.airavata.persistance.registry.jpa.resources.GatewayResource; + +public class GatewayRegistry { + public GatewayResource getGateway () throws ApplicationSettingsException { + GatewayResource gateway = (GatewayResource)ResourceUtils.getGateway(ServerSettings.getSystemUserGateway()); + return gateway; + } + +} http://git-wip-us.apache.org/repos/asf/airavata/blob/b8152e39/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryImpl.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryImpl.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryImpl.java new file mode 100644 index 0000000..bd1be77 --- /dev/null +++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/impl/RegistryImpl.java @@ -0,0 +1,127 @@ +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +package org.apache.airavata.persistance.registry.jpa.impl; + +import org.apache.airavata.model.experiment.BasicMetadata; +import org.apache.airavata.model.experiment.ConfigurationData; +import org.apache.airavata.registry.cpi.DataType; +import org.apache.airavata.registry.cpi.TopLevelDataType; +import org.apache.airavata.registry.cpi.DependentDataType; +import org.apache.airavata.registry.cpi.Registry; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.List; + +public class RegistryImpl implements Registry { + private final static Logger logger = LoggerFactory.getLogger(RegistryImpl.class); + ExperimentRegistry experimentRegistry = new ExperimentRegistry(); + + public void add(TopLevelDataType dataType, Object newObjectToAdd) { + switch (dataType){ + case EXPERIMENT_BASIC_DATA: + experimentRegistry.add((BasicMetadata)newObjectToAdd); + break; + default: + logger.error("Unsupported data type", new UnsupportedOperationException()); + throw new UnsupportedOperationException(); + } + } + + @Override + public void add(DependentDataType dataType, Object newObjectToAdd, Object dependentIdentifier) { + switch (dataType){ + case EXPERIMENT_CONFIGURATION_DATA: + experimentRegistry.add((ConfigurationData)newObjectToAdd, (String)dependentIdentifier); + break; + case EXPERIMENT_SUMMARY: + break; + case EXPERIMENT_GENERATED_DATA: + break; + case EXECUTION_ERROR: + break; + default: + logger.error("Unsupported data type", new UnsupportedOperationException()); + throw new UnsupportedOperationException(); + } + + } + + @Override + public void update(TopLevelDataType dataType, Object newObjectToUpdate) { + + } + + @Override + public void update(DependentDataType dataType, Object newObjectToUpdate, Object dependentIdentifier) { + + } + + @Override + public void update(DataType dataType, Object identifier, Object field, Object value) { + + } + + @Override + public List<Object> get(DataType dataType, Object filteredBy, Object value) { + return null; + } + + @Override + public Object getValue(DataType dataType, Object identifier, Object field) { + return null; + } + + @Override + public void remove(DataType dataType, Object identifier) { + + } + + @Override + public boolean isExist(DataType dataType, Object identifier) { + return false; + } + + public void update(DependentDataType dataType, Object newObjectToUpdate) { + + } + + public void update(DependentDataType dataType, Object identifier, Object field, Object value) { + + } + + public List<Object> get(DependentDataType dataType, Object filteredBy, Object value) { + return null; + } + + public Object getValue(DependentDataType dataType, Object identifier, Object field) { + return null; + } + + public void remove(DependentDataType dataType, Object identifier) { + + } + + public boolean isExist(DependentDataType dataType, Object identifier) { + return false; + } +} http://git-wip-us.apache.org/repos/asf/airavata/blob/b8152e39/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Configuration_Data.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Configuration_Data.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Configuration_Data.java index 8ba17d4..dc68cb3 100644 --- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Configuration_Data.java +++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/model/Experiment_Configuration_Data.java @@ -37,7 +37,6 @@ public class Experiment_Configuration_Data { private int total_cpu_count; @Column(name = "NODE_COUNT") private int node_count; - @Column(name = "NUMBER_OF_THREADS") private int number_of_threads; @Column(name = "QUEUE_NAME") @@ -50,13 +49,12 @@ public class Experiment_Configuration_Data { private int total_physical_memory; @Column(name = "COMPUTATIONAL_PROJECT_ACCOUNT") private String computational_project_account; - @Column(name = "AIRAVATA_AUTO_SCHEDULE") private boolean airavata_auto_schedule; @Column(name = "OVERRIDE_MANUAL_SCHEDULE_PARAMS") private boolean override_manual_schedule; - @Column(name = "WORKING_DIR") - private String working_dir; + @Column(name = "UNIQUE_WORKING_DIR") + private String unique_working_dir; @Column(name = "STAGE_INPUT_FILES_TO_WORKING_DIR") private boolean stage_input_files_to_working_dir; @Column(name = "OUTPUT_DATA_DIR") @@ -67,6 +65,23 @@ public class Experiment_Configuration_Data { private boolean persist_output_data; @Column(name = "CLEAN_AFTER_JOB") private boolean clean_after_job; + @Column(name = "APPLICATION_ID") + private String application_id; + @Column(name = "APPLICATION_VERSION") + private String application_version; + @Column(name = "WORKFLOW_TEMPLATE_ID") + private String workflow_template_id; + @Column(name = "WORKFLOW_TEMPLATE_VERSION") + private String workflow_template_version; + @Column(name = "WORKING_DIR_PARENT") + private String working_dir_parent; + @Column(name = "START_EXECUTION_AT") + private String start_execution_at; + @Column(name = "EXECUTE_BEFORE") + private String execute_before; + @Column(name = "NUMBER_OF_RETRIES") + private int number_of_retries; + @Lob @Column(name = "EXPERIMENT_CONFIG_DATA") private byte[] experiment_config_data; @@ -167,14 +182,6 @@ public class Experiment_Configuration_Data { this.override_manual_schedule = override_manual_schedule; } - public String getWorking_dir() { - return working_dir; - } - - public void setWorking_dir(String working_dir) { - this.working_dir = working_dir; - } - public boolean isStage_input_files_to_working_dir() { return stage_input_files_to_working_dir; } @@ -222,4 +229,76 @@ public class Experiment_Configuration_Data { public void setExperiment_config_data(byte[] experiment_config_data) { this.experiment_config_data = experiment_config_data; } + + public String getUnique_working_dir() { + return unique_working_dir; + } + + public void setUnique_working_dir(String unique_working_dir) { + this.unique_working_dir = unique_working_dir; + } + + public String getApplication_id() { + return application_id; + } + + public void setApplication_id(String application_id) { + this.application_id = application_id; + } + + public String getApplication_version() { + return application_version; + } + + public void setApplication_version(String application_version) { + this.application_version = application_version; + } + + public String getWorkflow_template_id() { + return workflow_template_id; + } + + public void setWorkflow_template_id(String workflow_template_id) { + this.workflow_template_id = workflow_template_id; + } + + public String getWorkflow_template_version() { + return workflow_template_version; + } + + public void setWorkflow_template_version(String workflow_template_version) { + this.workflow_template_version = workflow_template_version; + } + + public String getWorking_dir_parent() { + return working_dir_parent; + } + + public void setWorking_dir_parent(String working_dir_parent) { + this.working_dir_parent = working_dir_parent; + } + + public String getStart_execution_at() { + return start_execution_at; + } + + public void setStart_execution_at(String start_execution_at) { + this.start_execution_at = start_execution_at; + } + + public String getExecute_before() { + return execute_before; + } + + public void setExecute_before(String execute_before) { + this.execute_before = execute_before; + } + + public int getNumber_of_retries() { + return number_of_retries; + } + + public void setNumber_of_retries(int number_of_retries) { + this.number_of_retries = number_of_retries; + } } http://git-wip-us.apache.org/repos/asf/airavata/blob/b8152e39/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentConfigDataResource.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentConfigDataResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentConfigDataResource.java index 09272cb..72b2ef6 100644 --- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentConfigDataResource.java +++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/ExperimentConfigDataResource.java @@ -53,6 +53,15 @@ public class ExperimentConfigDataResource extends AbstractResource { private String dataRegURL; private boolean persistOutputData; private boolean cleanAfterJob; + private String applicationID; + private String applicationVersion; + private String workflowTemplateId; + private String workflowTemplateVersion; + private String workingDirParent; + private String startExecutionAt; + private String executeBefore; + private int numberOfRetries; + private byte[] request; public ExperimentMetadataResource getExMetadata() { @@ -207,6 +216,74 @@ public class ExperimentConfigDataResource extends AbstractResource { this.request = request; } + public static Logger getLogger() { + return logger; + } + + public String getApplicationID() { + return applicationID; + } + + public void setApplicationID(String applicationID) { + this.applicationID = applicationID; + } + + public String getApplicationVersion() { + return applicationVersion; + } + + public void setApplicationVersion(String applicationVersion) { + this.applicationVersion = applicationVersion; + } + + public String getWorkflowTemplateId() { + return workflowTemplateId; + } + + public void setWorkflowTemplateId(String workflowTemplateId) { + this.workflowTemplateId = workflowTemplateId; + } + + public String getWorkflowTemplateVersion() { + return workflowTemplateVersion; + } + + public void setWorkflowTemplateVersion(String workflowTemplateVersion) { + this.workflowTemplateVersion = workflowTemplateVersion; + } + + public String getWorkingDirParent() { + return workingDirParent; + } + + public void setWorkingDirParent(String workingDirParent) { + this.workingDirParent = workingDirParent; + } + + public String getStartExecutionAt() { + return startExecutionAt; + } + + public void setStartExecutionAt(String startExecutionAt) { + this.startExecutionAt = startExecutionAt; + } + + public String getExecuteBefore() { + return executeBefore; + } + + public void setExecuteBefore(String executeBefore) { + this.executeBefore = executeBefore; + } + + public int getNumberOfRetries() { + return numberOfRetries; + } + + public void setNumberOfRetries(int numberOfRetries) { + this.numberOfRetries = numberOfRetries; + } + public Resource create(ResourceType type) { logger.error("Unsupported resource type for experiment config data resource.", new UnsupportedOperationException()); throw new UnsupportedOperationException(); @@ -251,7 +328,15 @@ public class ExperimentConfigDataResource extends AbstractResource { exconfig.setTotal_cpu_count(cpuCount); exconfig.setTotal_physical_memory(physicalMemory); exconfig.setWalltime_limit(wallTimeLimit); - exconfig.setWorking_dir(workingDir); + exconfig.setUnique_working_dir(workingDir); + exconfig.setWorking_dir_parent(workingDirParent); + exconfig.setApplication_id(applicationID); + exconfig.setApplication_version(applicationVersion); + exconfig.setWorkflow_template_id(workflowTemplateId); + exconfig.setWorkflow_template_version(workflowTemplateVersion); + exconfig.setStart_execution_at(startExecutionAt); + exconfig.setExecute_before(executeBefore); + exconfig.setNumber_of_retries(numberOfRetries); if (existingConfig != null){ existingConfig.setAiravata_auto_schedule(isAiravataAutoSchedule()); @@ -272,7 +357,16 @@ public class ExperimentConfigDataResource extends AbstractResource { existingConfig.setTotal_cpu_count(cpuCount); existingConfig.setTotal_physical_memory(physicalMemory); existingConfig.setWalltime_limit(wallTimeLimit); - existingConfig.setWorking_dir(workingDir); + existingConfig.setUnique_working_dir(workingDir); + existingConfig.setUnique_working_dir(workingDir); + existingConfig.setWorking_dir_parent(workingDirParent); + existingConfig.setApplication_id(applicationID); + existingConfig.setApplication_version(applicationVersion); + existingConfig.setWorkflow_template_id(workflowTemplateId); + existingConfig.setWorkflow_template_version(workflowTemplateVersion); + existingConfig.setStart_execution_at(startExecutionAt); + existingConfig.setExecute_before(executeBefore); + existingConfig.setNumber_of_retries(numberOfRetries); exconfig = em.merge(existingConfig); } else { http://git-wip-us.apache.org/repos/asf/airavata/blob/b8152e39/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java index 31ddfc1..5e030fb 100644 --- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java +++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/GatewayResource.java @@ -781,5 +781,11 @@ public class GatewayResource extends AbstractResource { dataResource.setExperimentID(experimentID); return dataResource; } + + public ExperimentMetadataResource createBasicMetada (String experimentID){ + ExperimentMetadataResource metadataResource = (ExperimentMetadataResource)create(ResourceType.EXPERIMENT_METADATA); + metadataResource.setExpID(experimentID); + return metadataResource; + } } http://git-wip-us.apache.org/repos/asf/airavata/blob/b8152e39/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java index 417a724..e9703b5 100644 --- a/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java +++ b/modules/registry/airavata-jpa-registry/src/main/java/org/apache/airavata/persistance/registry/jpa/resources/Utils.java @@ -569,7 +569,15 @@ public class Utils { exConfigDataResource.setStageInputsToWDir(o.isStage_input_files_to_working_dir()); exConfigDataResource.setWallTimeLimit(o.getWalltime_limit()); exConfigDataResource.setOverrideManualSchedule(o.isOverride_manual_schedule()); - exConfigDataResource.setWorkingDir(o.getWorking_dir()); + exConfigDataResource.setWorkingDir(o.getUnique_working_dir()); + exConfigDataResource.setWorkingDirParent(o.getWorking_dir_parent()); + exConfigDataResource.setApplicationID(o.getApplication_id()); + exConfigDataResource.setApplicationVersion(o.getApplication_version()); + exConfigDataResource.setWorkflowTemplateId(o.getWorkflow_template_id()); + exConfigDataResource.setWorkflowTemplateVersion(o.getWorkflow_template_version()); + exConfigDataResource.setStartExecutionAt(o.getStart_execution_at()); + exConfigDataResource.setExecuteBefore(o.getExecute_before()); + exConfigDataResource.setNumberOfRetries(o.getNumber_of_retries()); return exConfigDataResource; } http://git-wip-us.apache.org/repos/asf/airavata/blob/b8152e39/modules/registry/airavata-jpa-registry/src/main/resources/airavata-registry-derby.sql ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-jpa-registry/src/main/resources/airavata-registry-derby.sql b/modules/registry/airavata-jpa-registry/src/main/resources/airavata-registry-derby.sql index c5a9065..04e25c0 100644 --- a/modules/registry/airavata-jpa-registry/src/main/resources/airavata-registry-derby.sql +++ b/modules/registry/airavata-jpa-registry/src/main/resources/airavata-registry-derby.sql @@ -151,6 +151,10 @@ CREATE TABLE EXPERIMENT_SUMMARY CREATE TABLE EXPERIMENT_CONFIGURATION_DATA ( EXPERIMENT_ID VARCHAR(255) NOT NULL, + APPLICATION_ID VARCHAR(255), + APPLICATION_VERSION VARCHAR(255), + WORKFLOW_TEMPLATE_ID VARCHAR(255), + WORKFLOW_TEMPLATE_VERSION VARCHAR(255), RESOURCE_HOST_ID VARCHAR (255), TOTAL_CPU_COUNT INTEGER, NODE_COUNT INTEGER, @@ -162,12 +166,16 @@ CREATE TABLE EXPERIMENT_CONFIGURATION_DATA COMPUTATIONAL_PROJECT_ACCOUNT VARCHAR(255), AIRAVATA_AUTO_SCHEDULE SMALLINT, OVERRIDE_MANUAL_SCHEDULE_PARAMS SMALLINT, - WORKING_DIR VARCHAR(255), + WORKING_DIR_PARENT VARCHAR(255), + UNIQUE_WORKING_DIR VARCHAR(255), STAGE_INPUT_FILES_TO_WORKING_DIR SMALLINT, OUTPUT_DATA_DIR VARCHAR(255), DATA_REG_URL VARCHAR (255), PERSIST_OUTPUT_DATA SMALLINT, CLEAN_AFTER_JOB SMALLINT, + START_EXECUTION_AT VARCHAR(255), + EXECUTE_BEFORE VARCHAR(255), + NUMBER_OF_RETRIES INTEGER, EXPERIMENT_CONFIG_DATA BLOB, PRIMARY KEY (EXPERIMENT_ID), FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT_METADATA(EXPERIMENT_ID) ON DELETE CASCADE http://git-wip-us.apache.org/repos/asf/airavata/blob/b8152e39/modules/registry/airavata-jpa-registry/src/main/resources/airavata-registry-mysql.sql ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-jpa-registry/src/main/resources/airavata-registry-mysql.sql b/modules/registry/airavata-jpa-registry/src/main/resources/airavata-registry-mysql.sql index f5e9f4f..ac38407 100644 --- a/modules/registry/airavata-jpa-registry/src/main/resources/airavata-registry-mysql.sql +++ b/modules/registry/airavata-jpa-registry/src/main/resources/airavata-registry-mysql.sql @@ -153,6 +153,10 @@ CREATE TABLE EXPERIMENT_SUMMARY CREATE TABLE EXPERIMENT_CONFIGURATION_DATA ( EXPERIMENT_ID VARCHAR(255) NOT NULL, + APPLICATION_ID VARCHAR(255), + APPLICATION_VERSION VARCHAR(255), + WORKFLOW_TEMPLATE_ID VARCHAR(255), + WORKFLOW_TEMPLATE_VERSION VARCHAR(255), RESOURCE_HOST_ID VARCHAR (255), TOTAL_CPU_COUNT INT(11), NODE_COUNT INT(11), @@ -164,12 +168,16 @@ CREATE TABLE EXPERIMENT_CONFIGURATION_DATA COMPUTATIONAL_PROJECT_ACCOUNT VARCHAR(255), AIRAVATA_AUTO_SCHEDULE SMALLINT, OVERRIDE_MANUAL_SCHEDULE_PARAMS SMALLINT, - WORKING_DIR VARCHAR(255), + WORKING_DIR_PARENT VARCHAR(255), + UNIQUE_WORKING_DIR VARCHAR(255), STAGE_INPUT_FILES_TO_WORKING_DIR SMALLINT, OUTPUT_DATA_DIR VARCHAR(255), DATA_REG_URL VARCHAR (255), PERSIST_OUTPUT_DATA SMALLINT, CLEAN_AFTER_JOB SMALLINT, + START_EXECUTION_AT VARCHAR(255), + EXECUTE_BEFORE VARCHAR(255), + NUMBER_OF_RETRIES INTEGER, EXPERIMENT_CONFIG_DATA BLOB, PRIMARY KEY (EXPERIMENT_ID), FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT_METADATA(EXPERIMENT_ID) ON DELETE CASCADE http://git-wip-us.apache.org/repos/asf/airavata/blob/b8152e39/modules/registry/airavata-jpa-registry/src/test/resources/airavata-registry-derby.sql ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-jpa-registry/src/test/resources/airavata-registry-derby.sql b/modules/registry/airavata-jpa-registry/src/test/resources/airavata-registry-derby.sql index c5a9065..04e25c0 100644 --- a/modules/registry/airavata-jpa-registry/src/test/resources/airavata-registry-derby.sql +++ b/modules/registry/airavata-jpa-registry/src/test/resources/airavata-registry-derby.sql @@ -151,6 +151,10 @@ CREATE TABLE EXPERIMENT_SUMMARY CREATE TABLE EXPERIMENT_CONFIGURATION_DATA ( EXPERIMENT_ID VARCHAR(255) NOT NULL, + APPLICATION_ID VARCHAR(255), + APPLICATION_VERSION VARCHAR(255), + WORKFLOW_TEMPLATE_ID VARCHAR(255), + WORKFLOW_TEMPLATE_VERSION VARCHAR(255), RESOURCE_HOST_ID VARCHAR (255), TOTAL_CPU_COUNT INTEGER, NODE_COUNT INTEGER, @@ -162,12 +166,16 @@ CREATE TABLE EXPERIMENT_CONFIGURATION_DATA COMPUTATIONAL_PROJECT_ACCOUNT VARCHAR(255), AIRAVATA_AUTO_SCHEDULE SMALLINT, OVERRIDE_MANUAL_SCHEDULE_PARAMS SMALLINT, - WORKING_DIR VARCHAR(255), + WORKING_DIR_PARENT VARCHAR(255), + UNIQUE_WORKING_DIR VARCHAR(255), STAGE_INPUT_FILES_TO_WORKING_DIR SMALLINT, OUTPUT_DATA_DIR VARCHAR(255), DATA_REG_URL VARCHAR (255), PERSIST_OUTPUT_DATA SMALLINT, CLEAN_AFTER_JOB SMALLINT, + START_EXECUTION_AT VARCHAR(255), + EXECUTE_BEFORE VARCHAR(255), + NUMBER_OF_RETRIES INTEGER, EXPERIMENT_CONFIG_DATA BLOB, PRIMARY KEY (EXPERIMENT_ID), FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT_METADATA(EXPERIMENT_ID) ON DELETE CASCADE http://git-wip-us.apache.org/repos/asf/airavata/blob/b8152e39/modules/registry/airavata-registry-test/src/test/resources/airavata-registry-derby.sql ---------------------------------------------------------------------- diff --git a/modules/registry/airavata-registry-test/src/test/resources/airavata-registry-derby.sql b/modules/registry/airavata-registry-test/src/test/resources/airavata-registry-derby.sql index c5a9065..04e25c0 100644 --- a/modules/registry/airavata-registry-test/src/test/resources/airavata-registry-derby.sql +++ b/modules/registry/airavata-registry-test/src/test/resources/airavata-registry-derby.sql @@ -151,6 +151,10 @@ CREATE TABLE EXPERIMENT_SUMMARY CREATE TABLE EXPERIMENT_CONFIGURATION_DATA ( EXPERIMENT_ID VARCHAR(255) NOT NULL, + APPLICATION_ID VARCHAR(255), + APPLICATION_VERSION VARCHAR(255), + WORKFLOW_TEMPLATE_ID VARCHAR(255), + WORKFLOW_TEMPLATE_VERSION VARCHAR(255), RESOURCE_HOST_ID VARCHAR (255), TOTAL_CPU_COUNT INTEGER, NODE_COUNT INTEGER, @@ -162,12 +166,16 @@ CREATE TABLE EXPERIMENT_CONFIGURATION_DATA COMPUTATIONAL_PROJECT_ACCOUNT VARCHAR(255), AIRAVATA_AUTO_SCHEDULE SMALLINT, OVERRIDE_MANUAL_SCHEDULE_PARAMS SMALLINT, - WORKING_DIR VARCHAR(255), + WORKING_DIR_PARENT VARCHAR(255), + UNIQUE_WORKING_DIR VARCHAR(255), STAGE_INPUT_FILES_TO_WORKING_DIR SMALLINT, OUTPUT_DATA_DIR VARCHAR(255), DATA_REG_URL VARCHAR (255), PERSIST_OUTPUT_DATA SMALLINT, CLEAN_AFTER_JOB SMALLINT, + START_EXECUTION_AT VARCHAR(255), + EXECUTE_BEFORE VARCHAR(255), + NUMBER_OF_RETRIES INTEGER, EXPERIMENT_CONFIG_DATA BLOB, PRIMARY KEY (EXPERIMENT_ID), FOREIGN KEY (EXPERIMENT_ID) REFERENCES EXPERIMENT_METADATA(EXPERIMENT_ID) ON DELETE CASCADE http://git-wip-us.apache.org/repos/asf/airavata/blob/b8152e39/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/DependentDataType.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/DependentDataType.java b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/DependentDataType.java new file mode 100644 index 0000000..843f543 --- /dev/null +++ b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/DependentDataType.java @@ -0,0 +1,10 @@ +package org.apache.airavata.registry.cpi; + +public enum DependentDataType { + EXPERIMENT_SUMMARY, + EXPERIMENT_CONFIGURATION_DATA, + EXPERIMENT_GENERATED_DATA, + MONITORING_DATA, + PROVENANCE_DATA, + EXECUTION_ERROR +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/b8152e39/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/Registry.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/Registry.java b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/Registry.java index a740f09..7bc9198 100644 --- a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/Registry.java +++ b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/Registry.java @@ -1,5 +1,6 @@ package org.apache.airavata.registry.cpi; +import javax.xml.crypto.Data; import java.util.List; /** @@ -15,7 +16,32 @@ public interface Registry { * thrift model object. In experiment case this object can be BasicMetadata, ConfigurationData * etc */ - public void add(DataType dataType, Object newObjectToAdd); + public void add(TopLevelDataType dataType, Object newObjectToAdd); + + /** + * This method is to add an object in to the registry + * @param dataType Data type is a predefined type which the programmer should choose according to the object he + * is going to save in to registry + * @param newObjectToAdd Object which contains the fields that need to be saved in to registry. This object is a + * thrift model object. In experiment case this object can be BasicMetadata, ConfigurationData + * etc + * @param dependentIdentifier Object which contains the identifier if the object that is going to add is not a top + * level object in the data model. If it is a top level object, programmer can pass it as + * null + */ + public void add(DependentDataType dataType, Object newObjectToAdd, Object dependentIdentifier); + + /** + * This method is to update the whole object in registry + * @param dataType Data type is a predefined type which the programmer should choose according to the object he + * is going to save in to registry + * @param newObjectToUpdate Object which contains the fields that need to be updated in to registry. This object is a + * thrift model object. In experiment case this object can be BasicMetadata, ConfigurationData + * etc. CPI programmer can only fill necessary fields that need to be updated. He does not + * have to fill the whole object. He needs to only fill the mandatory fields and whatever the + * other fields that need to be updated. + */ + public void update(TopLevelDataType dataType, Object newObjectToUpdate); /** * This method is to update the whole object in registry @@ -26,9 +52,11 @@ public interface Registry { * etc. CPI programmer can only fill necessary fields that need to be updated. He does not * have to fill the whole object. He needs to only fill the mandatory fields and whatever the * other fields that need to be updated. - * + * @param dependentIdentifier Object which contains the identifier if the object that is going to add is not a top + * level object in the data model. If it is a top level object, programmer can pass it as + * null */ - public void update(DataType dataType, Object newObjectToUpdate); + public void update(DependentDataType dataType, Object newObjectToUpdate, Object dependentIdentifier); /** * This method is to update a specific field of the data model http://git-wip-us.apache.org/repos/asf/airavata/blob/b8152e39/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/TopLevelDataType.java ---------------------------------------------------------------------- diff --git a/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/TopLevelDataType.java b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/TopLevelDataType.java new file mode 100644 index 0000000..5262192 --- /dev/null +++ b/modules/registry/registry-cpi/src/main/java/org/apache/airavata/registry/cpi/TopLevelDataType.java @@ -0,0 +1,12 @@ +package org.apache.airavata.registry.cpi; + +public enum TopLevelDataType { + APPLiCATION_CATALOG, + GROUP, + USER, + PROJECT, + EXPERIMENT_BASIC_DATA +} + + + http://git-wip-us.apache.org/repos/asf/airavata/blob/b8152e39/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index 1ae708a..10744f1 100644 --- a/pom.xml +++ b/pom.xml @@ -430,6 +430,7 @@ <activeByDefault>true</activeByDefault> </activation> <modules> + <module>modules/airavata-api</module> <module>modules/gfac</module> <module>modules/ws-messenger</module> <module>modules/workflow-model</module>
