This is an automated email from the ASF dual-hosted git repository.
isjarana pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata.git
The following commit(s) were added to refs/heads/develop by this push:
new 750393f4e2 declare ComputeResourceSchedulingEntity in persistence.xml
new 51f196ef03 Merge pull request #389 from isururanawaka/metaschedular
750393f4e2 is described below
commit 750393f4e2d47038d5140dec1df18a71e02d5fd5
Author: Isuru Ranawaka <[email protected]>
AuthorDate: Tue Mar 7 12:37:02 2023 -0500
declare ComputeResourceSchedulingEntity in persistence.xml
---
.../ComputationalResourceSchedulingEntity.java | 8 ++++----
.../entities/expcatalog/UserConfigurationDataEntity.java | 16 ++++++++--------
.../repositories/expcatalog/ExperimentRepository.java | 9 +++++++++
.../src/main/resources/META-INF/persistence.xml | 1 +
.../api/service/handler/RegistryServerHandler.java | 16 ++++++++++++++++
5 files changed, 38 insertions(+), 12 deletions(-)
diff --git
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ComputationalResourceSchedulingEntity.java
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ComputationalResourceSchedulingEntity.java
index 1bdeb634c9..e31c8f7e33 100644
---
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ComputationalResourceSchedulingEntity.java
+++
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/ComputationalResourceSchedulingEntity.java
@@ -52,11 +52,14 @@ public class ComputationalResourceSchedulingEntity
implements Serializable {
private String overrideAllocationProjectNumber;
- @ManyToOne(targetEntity = UserConfigurationDataEntity.class, cascade =
CascadeType.ALL, fetch = FetchType.LAZY)
+ @ManyToOne(targetEntity = UserConfigurationDataEntity.class, cascade =
CascadeType.ALL)
@JoinColumn(name = "EXPERIMENT_ID", referencedColumnName = "EXPERIMENT_ID")
private UserConfigurationDataEntity userConfigurationData;
+ public ComputationalResourceSchedulingEntity() {
+ }
+
public String getExperimentId() {
return experimentId;
}
@@ -154,8 +157,5 @@ public class ComputationalResourceSchedulingEntity
implements Serializable {
}
-// public void setUserConfigurationData(UserConfigurationDataEntity
userConfigurationData) {
-// this.userConfigurationData = userConfigurationData;
-// }
}
diff --git
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/UserConfigurationDataEntity.java
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/UserConfigurationDataEntity.java
index d481af5c0e..1fffa1d2f2 100644
---
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/UserConfigurationDataEntity.java
+++
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/entities/expcatalog/UserConfigurationDataEntity.java
@@ -295,12 +295,12 @@ public class UserConfigurationDataEntity implements
Serializable {
this.experiment = experiment;
}
-// public List<ComputationalResourceSchedulingEntity>
getComputationalResourceSchedulingEntities() {
-// return computationalResourceSchedulingEntities;
-// }
-//
-// public void
setComputationalResourceSchedulingEntities(List<ComputationalResourceSchedulingEntity>
-//
computationalResourceSchedulingEntities) {
-// this.computationalResourceSchedulingEntities =
computationalResourceSchedulingEntities;
-// }
+ public List<ComputationalResourceSchedulingEntity>
getComputationalResourceSchedulingEntities() {
+ return computationalResourceSchedulingEntities;
+ }
+
+ public void
setComputationalResourceSchedulingEntities(List<ComputationalResourceSchedulingEntity>
+
computationalResourceSchedulingEntities) {
+ this.computationalResourceSchedulingEntities =
computationalResourceSchedulingEntities;
+ }
}
\ No newline at end of file
diff --git
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentRepository.java
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentRepository.java
index 7e226e859e..3d90ead3c1 100644
---
a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentRepository.java
+++
b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ExperimentRepository.java
@@ -26,6 +26,7 @@ import org.apache.airavata.model.experiment.ExperimentModel;
import org.apache.airavata.model.experiment.UserConfigurationDataModel;
import org.apache.airavata.model.status.ExperimentState;
import org.apache.airavata.model.status.ExperimentStatus;
+import
org.apache.airavata.registry.core.entities.expcatalog.ComputationalResourceSchedulingEntity;
import org.apache.airavata.registry.core.entities.expcatalog.ExperimentEntity;
import org.apache.airavata.registry.core.utils.DBConstants;
import org.apache.airavata.registry.core.utils.ObjectMapperSingleton;
@@ -84,6 +85,14 @@ public class ExperimentRepository extends
ExpCatAbstractRepository<ExperimentMod
experimentEntity.getUserConfigurationData().setExperimentId(experimentId);
}
+ if
(experimentEntity.getUserConfigurationData().getComputationalResourceSchedulingEntities()
!= null) {
+ logger.debug("Populating the Primary Key of
UserConfigurationData.ComputationalResourceSchedulingEntities object for the
Experiment");
+ for(ComputationalResourceSchedulingEntity entity :
experimentEntity.getUserConfigurationData().getComputationalResourceSchedulingEntities()){
+ entity.setExperimentId(experimentId);
+ }
+
+ }
+
if (experimentEntity.getExperimentInputs() != null) {
logger.debug("Populating the Primary Key of ExperimentInput
objects for the Experiment");
experimentEntity.getExperimentInputs().forEach(experimentInputEntity ->
experimentInputEntity.setExperimentId(experimentId));
diff --git
a/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml
b/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml
index fa06080d5e..cac5e36771 100644
--- a/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml
+++ b/modules/registry/registry-core/src/main/resources/META-INF/persistence.xml
@@ -133,6 +133,7 @@
<class>org.apache.airavata.registry.core.entities.expcatalog.TaskErrorEntity</class>
<class>org.apache.airavata.registry.core.entities.expcatalog.TaskStatusEntity</class>
<class>org.apache.airavata.registry.core.entities.expcatalog.UserConfigurationDataEntity</class>
+
<class>org.apache.airavata.registry.core.entities.expcatalog.ComputationalResourceSchedulingEntity</class>
<class>org.apache.airavata.registry.core.entities.expcatalog.UserEntity</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
</persistence-unit>
diff --git
a/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java
b/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java
index 9d8ce83340..ac673a7956 100644
---
a/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java
+++
b/modules/registry/registry-server/registry-api-service/src/main/java/org/apache/airavata/registry/api/service/handler/RegistryServerHandler.java
@@ -63,6 +63,7 @@ import org.apache.airavata.model.workspace.Project;
import org.apache.airavata.registry.api.RegistryService;
import org.apache.airavata.registry.api.exception.RegistryServiceException;
import org.apache.airavata.registry.api.registry_apiConstants;
+import
org.apache.airavata.registry.core.entities.expcatalog.ComputationalResourceSchedulingEntity;
import org.apache.airavata.registry.core.entities.expcatalog.JobPK;
import org.apache.airavata.registry.core.repositories.appcatalog.*;
import org.apache.airavata.registry.core.repositories.expcatalog.*;
@@ -3826,6 +3827,21 @@ public class RegistryServerHandler implements
RegistryService.Iface {
exception.setMessage("Compute Resource is not enabled by
the Admin!");
throw exception;
}
+ } else if
(!experiment.getUserConfigurationData().getAutoScheduledCompResourceSchedulingList().isEmpty())
{
+ for(ComputationalResourceSchedulingModel
computationalResourceScheduling :
+
experiment.getUserConfigurationData().getAutoScheduledCompResourceSchedulingList())
{
+ ComputeResourceDescription computeResourceDescription =
new ComputeResourceRepository()
+
.getComputeResource(computationalResourceScheduling.getResourceHostId());
+ if (!computeResourceDescription.isEnabled()) {
+ logger.error("Compute Resource with id"+
computationalResourceScheduling.getResourceHostId() +"" +
+ " is not enabled by the Admin!");
+ AiravataSystemException exception = new
AiravataSystemException();
+
exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
+ exception.setMessage("Compute Resource with id"+
computationalResourceScheduling.getResourceHostId() +"" +
+ " is not enabled by the Admin!");
+ throw exception;
+ }
+ }
}
experiment.setGatewayId(gatewayId);