This is an automated email from the ASF dual-hosted git repository. yasith pushed a commit to branch resource-mgmt-rest-api in repository https://gitbox.apache.org/repos/asf/airavata.git
commit 32bef4bf73f399b81ccb5a9ebd4e3d2717305582 Author: lahiruj <[email protected]> AuthorDate: Thu Oct 30 18:04:05 2025 -0400 apply spotless styles --- .../airavata/helix/impl/task/TaskContext.java | 34 ++++++++---- .../helix/impl/task/staging/ArchiveTask.java | 4 +- .../helix/impl/task/staging/DataStagingTask.java | 53 +++++++++++++----- .../connection/service/config/AsyncConfig.java | 35 ++++++------ .../db/entity/AgentBatchAssignmentEntity.java | 36 ++++++------- .../service/db/entity/JobBatchEntity.java | 40 +++++++------- .../service/db/entity/JobUnitEntity.java | 38 ++++++------- .../service/db/repo/AgentBatchAssignmentRepo.java | 38 ++++++------- .../connection/service/db/repo/JobBatchRepo.java | 38 ++++++------- .../connection/service/db/repo/JobUnitRepo.java | 63 +++++++++++++--------- .../service/handlers/AgentConnectionHandler.java | 18 ++++--- .../service/handlers/AgentManagementHandler.java | 16 ++++-- .../service/handlers/AgentWorkService.java | 42 +++++++-------- .../service/handlers/JobBatchHandler.java | 56 ++++++++++--------- .../service/handlers/JobBatchWorker.java | 51 +++++++++--------- .../service/handlers/JobUnitAllocator.java | 41 +++++++------- .../connection/service/models/AssignResult.java | 40 +++++++------- .../connection/service/models/JobBatchSpec.java | 38 ++++++------- .../connection/service/models/JobUnitStatus.java | 40 +++++++------- 19 files changed, 398 insertions(+), 323 deletions(-) diff --git a/airavata-api/src/main/java/org/apache/airavata/helix/impl/task/TaskContext.java b/airavata-api/src/main/java/org/apache/airavata/helix/impl/task/TaskContext.java index 24e01bf606..5bab41ae8f 100644 --- a/airavata-api/src/main/java/org/apache/airavata/helix/impl/task/TaskContext.java +++ b/airavata-api/src/main/java/org/apache/airavata/helix/impl/task/TaskContext.java @@ -330,7 +330,7 @@ public class TaskContext { /** * Returns the default storage preference for the gateway. * Prefers gateway-specific storage (ID starting with gatewayId), otherwise uses the first available preference. - * + * * @deprecated Use {@link #getInputGatewayStorageResourcePreference()} for input staging operations * or {@link #getOutputGatewayStorageResourcePreference()} for output staging operations. */ @@ -340,7 +340,7 @@ public class TaskContext { try { GatewayResourceProfile gatewayProfile = getGatewayResourceProfile(); List<StoragePreference> storagePreferences = gatewayProfile.getStoragePreferences(); - + if (storagePreferences == null || storagePreferences.isEmpty()) { throw new Exception("No storage preferences found for gateway " + gatewayId); } @@ -353,12 +353,16 @@ public class TaskContext { }) .findFirst() .orElseGet(() -> { - logger.debug("No gateway-specific storage found, using first available: {}", storagePreferences.get(0).getStorageResourceId()); + logger.debug( + "No gateway-specific storage found, using first available: {}", + storagePreferences.get(0).getStorageResourceId()); return storagePreferences.get(0); }); if (this.gatewayStorageResourcePreference.getStorageResourceId().startsWith(gatewayPrefix)) { - logger.debug("Using gateway-specific storage preference: {}", this.gatewayStorageResourcePreference.getStorageResourceId()); + logger.debug( + "Using gateway-specific storage preference: {}", + this.gatewayStorageResourcePreference.getStorageResourceId()); } } catch (TException e) { logger.error("Failed to fetch gateway storage preference for gateway {}", gatewayId, e); @@ -764,7 +768,8 @@ public class TaskContext { } public String getInputStorageResourceId() throws Exception { - if (processModel.getInputStorageResourceId() != null && !processModel.getInputStorageResourceId().trim().isEmpty()) { + if (processModel.getInputStorageResourceId() != null + && !processModel.getInputStorageResourceId().trim().isEmpty()) { return processModel.getInputStorageResourceId(); } return getStorageResourceId(); @@ -775,15 +780,20 @@ public class TaskContext { try { return registryClient.getGatewayStoragePreference(gatewayId, inputStorageId); } catch (TException e) { - logger.error("Failed to fetch gateway storage preference for input storage {} in gateway {}", inputStorageId, gatewayId, e); + logger.error( + "Failed to fetch gateway storage preference for input storage {} in gateway {}", + inputStorageId, + gatewayId, + e); throw e; } } public String getOutputStorageResourceId() throws Exception { - if (processModel.getOutputStorageResourceId() != null && !processModel.getOutputStorageResourceId().trim().isEmpty()) { - return processModel.getOutputStorageResourceId(); - } + if (processModel.getOutputStorageResourceId() != null + && !processModel.getOutputStorageResourceId().trim().isEmpty()) { + return processModel.getOutputStorageResourceId(); + } return getStorageResourceId(); } @@ -792,7 +802,11 @@ public class TaskContext { try { return registryClient.getGatewayStoragePreference(gatewayId, outputStorageId); } catch (TException e) { - logger.error("Failed to fetch gateway storage preference for output storage {} in gateway {}", outputStorageId, gatewayId, e); + logger.error( + "Failed to fetch gateway storage preference for output storage {} in gateway {}", + outputStorageId, + gatewayId, + e); throw e; } } diff --git a/airavata-api/src/main/java/org/apache/airavata/helix/impl/task/staging/ArchiveTask.java b/airavata-api/src/main/java/org/apache/airavata/helix/impl/task/staging/ArchiveTask.java index 95cd43c6e6..46ed806e6f 100644 --- a/airavata-api/src/main/java/org/apache/airavata/helix/impl/task/staging/ArchiveTask.java +++ b/airavata-api/src/main/java/org/apache/airavata/helix/impl/task/staging/ArchiveTask.java @@ -68,7 +68,9 @@ public class ArchiveTask extends DataStagingTask { tarDirPath = sourceURI.getPath(); } - String inputPath = getTaskContext().getOutputGatewayStorageResourcePreference().getFileSystemRootLocation(); + String inputPath = getTaskContext() + .getOutputGatewayStorageResourcePreference() + .getFileSystemRootLocation(); destFilePath = buildDestinationFilePath(inputPath, archiveFileName); tarCreationAbsPath = tarDirPath + File.separator + archiveFileName; diff --git a/airavata-api/src/main/java/org/apache/airavata/helix/impl/task/staging/DataStagingTask.java b/airavata-api/src/main/java/org/apache/airavata/helix/impl/task/staging/DataStagingTask.java index b090619763..4320f72463 100644 --- a/airavata-api/src/main/java/org/apache/airavata/helix/impl/task/staging/DataStagingTask.java +++ b/airavata-api/src/main/java/org/apache/airavata/helix/impl/task/staging/DataStagingTask.java @@ -30,13 +30,13 @@ import org.apache.airavata.agents.api.AgentAdaptor; import org.apache.airavata.agents.api.AgentException; import org.apache.airavata.agents.api.FileMetadata; import org.apache.airavata.agents.api.StorageResourceAdaptor; -import org.apache.airavata.model.appcatalog.gatewayprofile.StoragePreference; import org.apache.airavata.agents.streaming.TransferResult; import org.apache.airavata.agents.streaming.VirtualStreamProducer; import org.apache.airavata.common.utils.ServerSettings; import org.apache.airavata.helix.impl.task.AiravataTask; import org.apache.airavata.helix.impl.task.TaskOnFailException; import org.apache.airavata.helix.task.api.support.AdaptorSupport; +import org.apache.airavata.model.appcatalog.gatewayprofile.StoragePreference; import org.apache.airavata.model.appcatalog.storageresource.StorageResourceDescription; import org.apache.airavata.model.task.DataStagingTaskModel; import org.apache.airavata.patform.monitoring.CountMonitor; @@ -90,8 +90,12 @@ public abstract class DataStagingTask extends AiravataTask { return createStorageAdaptorFromPreference(adaptorSupport, storageId, gatewayStoragePref, "Default"); } catch (Exception e) { - logger.error("Failed to obtain adaptor for default storage resource {} in task {}", storageId, getTaskId(), e); - throw new TaskOnFailException("Failed to obtain adaptor for default storage resource " + storageId + " in task " + getTaskId(), false, e); + logger.error( + "Failed to obtain adaptor for default storage resource {} in task {}", storageId, getTaskId(), e); + throw new TaskOnFailException( + "Failed to obtain adaptor for default storage resource " + storageId + " in task " + getTaskId(), + false, + e); } } @@ -105,7 +109,11 @@ public abstract class DataStagingTask extends AiravataTask { storageId = getTaskContext().getInputStorageResourceId(); if (getTaskContext().getProcessModel().getInputStorageResourceId() != null - && !getTaskContext().getProcessModel().getInputStorageResourceId().trim().isEmpty()) { + && !getTaskContext() + .getProcessModel() + .getInputStorageResourceId() + .trim() + .isEmpty()) { StoragePreference inputStoragePref = getTaskContext().getInputGatewayStorageResourcePreference(); return createStorageAdaptorFromPreference(adaptorSupport, storageId, inputStoragePref, "Input"); @@ -114,8 +122,12 @@ public abstract class DataStagingTask extends AiravataTask { return getStorageAdaptor(adaptorSupport); } } catch (Exception e) { - logger.error("Failed to obtain adaptor for input storage resource {} in task {}", storageId, getTaskId(), e); - throw new TaskOnFailException("Failed to obtain adaptor for input storage resource " + storageId + " in task " + getTaskId(), false, e); + logger.error( + "Failed to obtain adaptor for input storage resource {} in task {}", storageId, getTaskId(), e); + throw new TaskOnFailException( + "Failed to obtain adaptor for input storage resource " + storageId + " in task " + getTaskId(), + false, + e); } } @@ -129,7 +141,11 @@ public abstract class DataStagingTask extends AiravataTask { storageId = getTaskContext().getOutputStorageResourceId(); if (getTaskContext().getProcessModel().getOutputStorageResourceId() != null - && !getTaskContext().getProcessModel().getOutputStorageResourceId().trim().isEmpty()) { + && !getTaskContext() + .getProcessModel() + .getOutputStorageResourceId() + .trim() + .isEmpty()) { StoragePreference outputStoragePref = getTaskContext().getOutputGatewayStorageResourcePreference(); return createStorageAdaptorFromPreference(adaptorSupport, storageId, outputStoragePref, "Output"); @@ -138,8 +154,12 @@ public abstract class DataStagingTask extends AiravataTask { return getStorageAdaptor(adaptorSupport); } } catch (Exception e) { - logger.error("Failed to obtain adaptor for output storage resource {} in task {}", storageId, getTaskId(), e); - throw new TaskOnFailException("Failed to obtain adaptor for output storage resource " + storageId + " in task " + getTaskId(), false, e); + logger.error( + "Failed to obtain adaptor for output storage resource {} in task {}", storageId, getTaskId(), e); + throw new TaskOnFailException( + "Failed to obtain adaptor for output storage resource " + storageId + " in task " + getTaskId(), + false, + e); } } @@ -459,8 +479,9 @@ public abstract class DataStagingTask extends AiravataTask { /** * Common method to create StorageResourceAdaptor from a StoragePreference. */ - private StorageResourceAdaptor createStorageAdaptorFromPreference(AdaptorSupport adaptorSupport, String storageId, - StoragePreference storagePreference, String adaptorType) throws TaskOnFailException { + private StorageResourceAdaptor createStorageAdaptorFromPreference( + AdaptorSupport adaptorSupport, String storageId, StoragePreference storagePreference, String adaptorType) + throws TaskOnFailException { try { String credentialToken = storagePreference.getResourceSpecificCredentialStoreToken() != null ? storagePreference.getResourceSpecificCredentialStoreToken() @@ -474,13 +495,17 @@ public abstract class DataStagingTask extends AiravataTask { storagePreference.getLoginUserName()); if (storageResourceAdaptor == null) { - throw new TaskOnFailException(adaptorType + " storage resource adaptor for " + storageId + " can not be null", true, null); + throw new TaskOnFailException( + adaptorType + " storage resource adaptor for " + storageId + " can not be null", true, null); } return storageResourceAdaptor; } catch (Exception e) { - throw new TaskOnFailException("Failed to obtain adaptor for " + adaptorType.toLowerCase() + " storage resource " + - storageId + " in task " + getTaskId(), false, e); + throw new TaskOnFailException( + "Failed to obtain adaptor for " + adaptorType.toLowerCase() + " storage resource " + storageId + + " in task " + getTaskId(), + false, + e); } } } diff --git a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/config/AsyncConfig.java b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/config/AsyncConfig.java index 17e3989fde..1b7d8a548b 100644 --- a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/config/AsyncConfig.java +++ b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/config/AsyncConfig.java @@ -1,21 +1,22 @@ /** - * 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 - * <p> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p> - * 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. - */ +* +* 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.agent.connection.service.config; import org.springframework.context.annotation.Bean; diff --git a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/db/entity/AgentBatchAssignmentEntity.java b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/db/entity/AgentBatchAssignmentEntity.java index 7e2a2a2611..48f8641219 100644 --- a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/db/entity/AgentBatchAssignmentEntity.java +++ b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/db/entity/AgentBatchAssignmentEntity.java @@ -1,28 +1,28 @@ /** - * 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 - * <p> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p> - * 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. - */ +* +* 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.agent.connection.service.db.entity; import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.Id; import jakarta.persistence.Table; - import java.time.Instant; @Entity diff --git a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/db/entity/JobBatchEntity.java b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/db/entity/JobBatchEntity.java index 00c8f728f9..a1d03a2ff3 100644 --- a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/db/entity/JobBatchEntity.java +++ b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/db/entity/JobBatchEntity.java @@ -1,21 +1,22 @@ /** - * 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 - * <p> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p> - * 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. - */ +* +* 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.agent.connection.service.db.entity; import com.fasterxml.jackson.databind.JsonNode; @@ -27,11 +28,10 @@ import jakarta.persistence.Id; import jakarta.persistence.Lob; import jakarta.persistence.OneToMany; import jakarta.persistence.Table; -import org.hibernate.annotations.JdbcTypeCode; -import org.hibernate.type.SqlTypes; - import java.time.Instant; import java.util.List; +import org.hibernate.annotations.JdbcTypeCode; +import org.hibernate.type.SqlTypes; @Entity @Table(name = "JOB_BATCH") diff --git a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/db/entity/JobUnitEntity.java b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/db/entity/JobUnitEntity.java index 1d379abccd..6fd45ed264 100644 --- a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/db/entity/JobUnitEntity.java +++ b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/db/entity/JobUnitEntity.java @@ -1,21 +1,22 @@ /** - * 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 - * <p> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p> - * 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. - */ +* +* 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.agent.connection.service.db.entity; import jakarta.persistence.Column; @@ -28,9 +29,8 @@ import jakarta.persistence.JoinColumn; import jakarta.persistence.Lob; import jakarta.persistence.ManyToOne; import jakarta.persistence.Table; -import org.apache.airavata.agent.connection.service.models.JobUnitStatus; - import java.time.Instant; +import org.apache.airavata.agent.connection.service.models.JobUnitStatus; @Entity @Table(name = "JOB_UNIT") diff --git a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/db/repo/AgentBatchAssignmentRepo.java b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/db/repo/AgentBatchAssignmentRepo.java index 5fec2fb706..6118d7e1a5 100644 --- a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/db/repo/AgentBatchAssignmentRepo.java +++ b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/db/repo/AgentBatchAssignmentRepo.java @@ -1,28 +1,28 @@ /** - * 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 - * <p> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p> - * 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. - */ +* +* 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.agent.connection.service.db.repo; +import java.util.Optional; import org.apache.airavata.agent.connection.service.db.entity.AgentBatchAssignmentEntity; import org.springframework.data.jpa.repository.JpaRepository; -import java.util.Optional; - public interface AgentBatchAssignmentRepo extends JpaRepository<AgentBatchAssignmentEntity, String> { Optional<AgentBatchAssignmentEntity> findByAgentId(String agentId); diff --git a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/db/repo/JobBatchRepo.java b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/db/repo/JobBatchRepo.java index 719394f40c..5f1f92268f 100644 --- a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/db/repo/JobBatchRepo.java +++ b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/db/repo/JobBatchRepo.java @@ -1,21 +1,22 @@ /** - * 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 - * <p> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p> - * 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. - */ +* +* 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.agent.connection.service.db.repo; import org.apache.airavata.agent.connection.service.db.entity.JobBatchEntity; @@ -23,5 +24,4 @@ import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository -public interface JobBatchRepo extends JpaRepository<JobBatchEntity, String> { -} +public interface JobBatchRepo extends JpaRepository<JobBatchEntity, String> {} diff --git a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/db/repo/JobUnitRepo.java b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/db/repo/JobUnitRepo.java index 5c8293af6a..0a4841fcef 100644 --- a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/db/repo/JobUnitRepo.java +++ b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/db/repo/JobUnitRepo.java @@ -1,21 +1,22 @@ /** - * 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 - * <p> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p> - * 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. - */ +* +* 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.agent.connection.service.db.repo; import org.apache.airavata.agent.connection.service.db.entity.JobUnitEntity; @@ -28,35 +29,47 @@ import org.springframework.stereotype.Repository; @Repository public interface JobUnitRepo extends JpaRepository<JobUnitEntity, String> { - @Query(value = """ + @Query( + value = + """ SELECT ID FROM JOB_UNIT WHERE BATCH_ID = :batchId AND STATUS = 'PENDING' ORDER BY CREATED_AT, ID FOR UPDATE SKIP LOCKED LIMIT 1 - """, nativeQuery = true) + """, + nativeQuery = true) String lockNextPending(@Param("batchId") String batchId); @Modifying - @Query(value = """ + @Query( + value = + """ UPDATE JOB_UNIT SET STATUS='IN_PROGRESS', AGENT_ID=:agentId, STARTED_AT=CURRENT_TIMESTAMP(6) WHERE ID=:id - """, nativeQuery = true) + """, + nativeQuery = true) int markInProgress(@Param("id") String id, @Param("agentId") String agentId); @Query(value = "SELECT RESOLVED_COMMAND FROM JOB_UNIT WHERE ID=:id", nativeQuery = true) String getResolvedCommand(@Param("id") String id); @Modifying - @Query(value = """ + @Query( + value = + """ UPDATE JOB_UNIT SET STATUS='COMPLETED', COMPLETED_AT=CURRENT_TIMESTAMP(6) WHERE ID=:id - """, nativeQuery = true) + """, + nativeQuery = true) int markCompleted(@Param("id") String id); - @Query(value = """ + @Query( + value = + """ SELECT COUNT(*) FROM JOB_UNIT WHERE BATCH_ID = :batchId AND STATUS IN ('PENDING','IN_PROGRESS') - """, nativeQuery = true) + """, + nativeQuery = true) int countRemaining(@Param("batchId") String batchId); } diff --git a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/AgentConnectionHandler.java b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/AgentConnectionHandler.java index 693dc9345d..84be8ac95f 100644 --- a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/AgentConnectionHandler.java +++ b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/AgentConnectionHandler.java @@ -614,16 +614,20 @@ public class AgentConnectionHandler extends AgentCommunicationServiceGrpc.AgentC try { if (assignResult instanceof AssignResult.Assigned assigned) { - responseObserver.onNext(ServerMessage.newBuilder().setAssignJobUnit(AssignJobUnit.newBuilder() - .setJobUnitId(assigned.jobUnitId()) - .setResolvedCommand(assigned.resolvedCommand()) - .build()).build()); + responseObserver.onNext(ServerMessage.newBuilder() + .setAssignJobUnit(AssignJobUnit.newBuilder() + .setJobUnitId(assigned.jobUnitId()) + .setResolvedCommand(assigned.resolvedCommand()) + .build()) + .build()); logger.info("Assigned job unit id {} to agent id {}", assigned.jobUnitId(), agentId); } else if (assignResult instanceof AssignResult.NoWork noWork) { - responseObserver.onNext(ServerMessage.newBuilder().setNoJobUnitAvailable(NoJobUnitAvailable.newBuilder() - .setReason(noWork.reason()) - .build()).build()); + responseObserver.onNext(ServerMessage.newBuilder() + .setNoJobUnitAvailable(NoJobUnitAvailable.newBuilder() + .setReason(noWork.reason()) + .build()) + .build()); logger.info("No job unit available for agent id {}, reason: {}", agentId, noWork.reason()); } } catch (Exception e) { diff --git a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/AgentManagementHandler.java b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/AgentManagementHandler.java index b528d7f86c..dced9576b5 100644 --- a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/AgentManagementHandler.java +++ b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/AgentManagementHandler.java @@ -66,8 +66,10 @@ public class AgentManagementHandler { @Value("${grpc.server.host}") private String grpcHost; - public AgentManagementHandler(AiravataService airavataService, ClusterApplicationConfig clusterApplicationConfig, - JobBatchHandler jobBatchHandler) { + public AgentManagementHandler( + AiravataService airavataService, + ClusterApplicationConfig clusterApplicationConfig, + JobBatchHandler jobBatchHandler) { this.airavataService = airavataService; this.clusterApplicationConfig = clusterApplicationConfig; this.jobBatchHandler = jobBatchHandler; @@ -175,7 +177,9 @@ public class AgentManagementHandler { // Handle job workload String batchId = jobBatchHandler.handleJobWorkload(experimentId, agentId, req.getJobBatchSpec()); - airavataService.airavata().launchExperiment(UserContext.authzToken(), experimentId, experiment.getGatewayId()); + airavataService + .airavata() + .launchExperiment(UserContext.authzToken(), experimentId, experiment.getGatewayId()); return new AgentLaunchResponse(agentId, experimentId, envName, batchId); } catch (TException e) { LOGGER.error("Error while creating the experiment with the name: {}", req.getExperimentName(), e); @@ -251,8 +255,10 @@ public class AgentManagementHandler { userConfigurationDataModel.setComputationalResourceScheduling(computationalResourceSchedulingModel); userConfigurationDataModel.setAiravataAutoSchedule(false); userConfigurationDataModel.setOverrideManualScheduledParams(false); - userConfigurationDataModel.setInputStorageResourceId(StringUtils.isNotBlank(req.getInputStorageId()) ? req.getInputStorageId() : storageResourceId); - userConfigurationDataModel.setOutputStorageResourceId(StringUtils.isNotBlank(req.getOutputStorageId()) ? req.getInputStorageId() : storageResourceId); + userConfigurationDataModel.setInputStorageResourceId( + StringUtils.isNotBlank(req.getInputStorageId()) ? req.getInputStorageId() : storageResourceId); + userConfigurationDataModel.setOutputStorageResourceId( + StringUtils.isNotBlank(req.getOutputStorageId()) ? req.getInputStorageId() : storageResourceId); String experimentDataDir = Paths.get(storagePath, gatewayId, userName, projectDir, experimentName) .toString(); userConfigurationDataModel.setExperimentDataDir(experimentDataDir); diff --git a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/AgentWorkService.java b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/AgentWorkService.java index 0771ddaa4c..c1d9beab7f 100644 --- a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/AgentWorkService.java +++ b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/AgentWorkService.java @@ -1,31 +1,31 @@ /** - * 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 - * <p> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p> - * 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. - */ +* +* 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.agent.connection.service.handlers; +import java.util.Optional; import org.apache.airavata.agent.connection.service.db.entity.AgentBatchAssignmentEntity; import org.apache.airavata.agent.connection.service.db.repo.AgentBatchAssignmentRepo; import org.apache.airavata.agent.connection.service.db.repo.JobUnitRepo; import org.apache.airavata.agent.connection.service.models.AssignResult; import org.springframework.stereotype.Service; -import java.util.Optional; - @Service public class AgentWorkService { @@ -33,7 +33,8 @@ public class AgentWorkService { private final JobUnitAllocator allocator; private final JobUnitRepo jobUnitRepo; - public AgentWorkService(AgentBatchAssignmentRepo assignmentRepo, JobUnitAllocator allocator, JobUnitRepo jobUnitRepo) { + public AgentWorkService( + AgentBatchAssignmentRepo assignmentRepo, JobUnitAllocator allocator, JobUnitRepo jobUnitRepo) { this.assignmentRepo = assignmentRepo; this.allocator = allocator; this.jobUnitRepo = jobUnitRepo; @@ -60,4 +61,3 @@ public class AgentWorkService { allocator.markCompleted(jobUnitId); } } - diff --git a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/JobBatchHandler.java b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/JobBatchHandler.java index 157321dd82..8a181b0d62 100644 --- a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/JobBatchHandler.java +++ b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/JobBatchHandler.java @@ -1,24 +1,26 @@ /** - * 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 - * <p> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p> - * 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. - */ +* +* 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.agent.connection.service.handlers; import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.UUID; import org.apache.airavata.agent.connection.service.db.entity.AgentBatchAssignmentEntity; import org.apache.airavata.agent.connection.service.db.entity.JobBatchEntity; import org.apache.airavata.agent.connection.service.db.repo.AgentBatchAssignmentRepo; @@ -28,8 +30,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; -import java.util.UUID; - @Service public class JobBatchHandler { @@ -40,7 +40,11 @@ public class JobBatchHandler { private final AgentBatchAssignmentRepo agentJobAssignmentRepo; private final ObjectMapper objectMapper; - public JobBatchHandler(JobBatchWorker jobBatchWorker, JobBatchRepo jobBatchRepo, AgentBatchAssignmentRepo agentJobAssignmentRepo, ObjectMapper objectMapper) { + public JobBatchHandler( + JobBatchWorker jobBatchWorker, + JobBatchRepo jobBatchRepo, + AgentBatchAssignmentRepo agentJobAssignmentRepo, + ObjectMapper objectMapper) { this.jobBatchWorker = jobBatchWorker; this.jobBatchRepo = jobBatchRepo; this.agentJobAssignmentRepo = agentJobAssignmentRepo; @@ -51,14 +55,17 @@ public class JobBatchHandler { String batchId = null; if (spec != null) { - if (spec.getApplicationCommand() == null || spec.getApplicationCommand().isBlank()) { + if (spec.getApplicationCommand() == null + || spec.getApplicationCommand().isBlank()) { LOGGER.warn("application_command is required for experiment with id: {}", experimentId); - throw new IllegalArgumentException("application_command is required for experiment with id: " + experimentId); + throw new IllegalArgumentException( + "application_command is required for experiment with id: " + experimentId); } if (spec.getParameterGrid() == null || spec.getParameterGrid().isEmpty()) { LOGGER.warn("parameter_grid is required for experiment with id: {}", experimentId); - throw new IllegalArgumentException("parameter_grid is required for experiment with id: " + experimentId); + throw new IllegalArgumentException( + "parameter_grid is required for experiment with id: " + experimentId); } batchId = UUID.randomUUID().toString(); @@ -75,7 +82,8 @@ public class JobBatchHandler { assign.setBatchId(batchId); agentJobAssignmentRepo.save(assign); - jobBatchWorker.expandAndPersistUnitsAsync(experimentId, batchId, spec.getApplicationCommand(), spec.getParameterGrid()); + jobBatchWorker.expandAndPersistUnitsAsync( + experimentId, batchId, spec.getApplicationCommand(), spec.getParameterGrid()); } return batchId; } diff --git a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/JobBatchWorker.java b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/JobBatchWorker.java index ca8a97f37f..db6246a414 100644 --- a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/JobBatchWorker.java +++ b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/JobBatchWorker.java @@ -1,24 +1,30 @@ /** - * 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 - * <p> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p> - * 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. - */ +* +* 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.agent.connection.service.handlers; import jakarta.transaction.Transactional; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.UUID; import org.apache.airavata.agent.connection.service.db.entity.JobBatchEntity; import org.apache.airavata.agent.connection.service.db.entity.JobUnitEntity; import org.apache.airavata.agent.connection.service.db.repo.JobUnitRepo; @@ -27,12 +33,6 @@ import org.slf4j.LoggerFactory; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.UUID; - @Service("jobBatchWorker") public class JobBatchWorker { @@ -49,8 +49,8 @@ public class JobBatchWorker { */ @Async("batchExecutor") @Transactional(dontRollbackOn = Exception.class) - public void expandAndPersistUnitsAsync(String experimentId, String batchId, - String commandTemplate, Map<String, List<String>> grid) { + public void expandAndPersistUnitsAsync( + String experimentId, String batchId, String commandTemplate, Map<String, List<String>> grid) { if (grid == null || grid.isEmpty()) { return; @@ -113,7 +113,6 @@ public class JobBatchWorker { LOGGER.info("Batch {} expansion complete (experiment {}).", batchId, experimentId); } - private static String renderCommand(String template, List<String> keys, List<String[]> values, int[] idx) { String cmd = template; for (int i = 0; i < keys.size(); i++) { diff --git a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/JobUnitAllocator.java b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/JobUnitAllocator.java index fd8b48bb6b..9e196172ec 100644 --- a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/JobUnitAllocator.java +++ b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/handlers/JobUnitAllocator.java @@ -1,31 +1,31 @@ /** - * 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 - * <p> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p> - * 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. - */ +* +* 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.agent.connection.service.handlers; import jakarta.transaction.Transactional; +import java.util.Optional; import org.apache.airavata.agent.connection.service.db.repo.JobUnitRepo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; -import java.util.Optional; - @Service public class JobUnitAllocator { @@ -33,8 +33,7 @@ public class JobUnitAllocator { private final JobUnitRepo jobUnitRepo; - public record JobUnitRow(String id, String resolvedCommand) { - } + public record JobUnitRow(String id, String resolvedCommand) {} public JobUnitAllocator(JobUnitRepo jobUnitRepo) { this.jobUnitRepo = jobUnitRepo; diff --git a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/models/AssignResult.java b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/models/AssignResult.java index 1103a9c408..9616bea8ad 100644 --- a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/models/AssignResult.java +++ b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/models/AssignResult.java @@ -1,27 +1,27 @@ /** - * 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 - * <p> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p> - * 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. - */ +* +* 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.agent.connection.service.models; public sealed interface AssignResult permits AssignResult.Assigned, AssignResult.NoWork { - record Assigned(String jobUnitId, String resolvedCommand) implements AssignResult { - } + record Assigned(String jobUnitId, String resolvedCommand) implements AssignResult {} record NoWork(String reason) implements AssignResult { public static final String EMPTY = "EMPTY"; @@ -44,4 +44,4 @@ public sealed interface AssignResult permits AssignResult.Assigned, AssignResult static NoWork noAssignment() { return new NoWork(NoWork.NO_ASSIGNMENT); } -} \ No newline at end of file +} diff --git a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/models/JobBatchSpec.java b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/models/JobBatchSpec.java index bb2c3fbb87..0517af9f3d 100644 --- a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/models/JobBatchSpec.java +++ b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/models/JobBatchSpec.java @@ -1,25 +1,25 @@ /** - * 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 - * <p> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p> - * 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. - */ +* +* 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.agent.connection.service.models; import com.fasterxml.jackson.annotation.JsonProperty; - import java.util.List; import java.util.Map; @@ -57,4 +57,4 @@ public class JobBatchSpec { public void setInputFiles(List<String> inputFiles) { this.inputFiles = inputFiles; } -} \ No newline at end of file +} diff --git a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/models/JobUnitStatus.java b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/models/JobUnitStatus.java index 670978fe57..881fef6019 100644 --- a/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/models/JobUnitStatus.java +++ b/modules/agent-framework/agent-service/src/main/java/org/apache/airavata/agent/connection/service/models/JobUnitStatus.java @@ -1,23 +1,27 @@ /** - * 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 - * <p> - * http://www.apache.org/licenses/LICENSE-2.0 - * <p> - * 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. - */ +* +* 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.agent.connection.service.models; public enum JobUnitStatus { - PENDING, IN_PROGRESS, COMPLETED, FAILED + PENDING, + IN_PROGRESS, + COMPLETED, + FAILED }
