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

yasith pushed a commit to branch feat/airavata-service-layer
in repository https://gitbox.apache.org/repos/asf/airavata.git

commit fd4a3632a2405ceac9cecd8976316ccffb283564
Author: yasithdev <[email protected]>
AuthorDate: Thu Mar 26 12:51:40 2026 -0500

    refactor: simplify launchExperiment handler to pure one-liner
    
    Moved group resource profile lookup from 
AiravataServerHandler.launchExperiment into
    ExperimentService.launchExperiment, removing the List<GroupResourceProfile> 
parameter.
    ExperimentService gains an optional GroupResourceProfileService set via 
setter. Handler
    method is now a single ThriftAdapter.executeVoid call.
---
 .../airavata/service/experiment/ExperimentService.java      | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git 
a/airavata-api/src/main/java/org/apache/airavata/service/experiment/ExperimentService.java
 
b/airavata-api/src/main/java/org/apache/airavata/service/experiment/ExperimentService.java
index 7e7b52098a..5c8def6640 100644
--- 
a/airavata-api/src/main/java/org/apache/airavata/service/experiment/ExperimentService.java
+++ 
b/airavata-api/src/main/java/org/apache/airavata/service/experiment/ExperimentService.java
@@ -27,6 +27,7 @@ import org.apache.airavata.sharing.registry.models.Entity;
 import org.apache.airavata.sharing.registry.models.SearchCriteria;
 import org.apache.airavata.sharing.registry.models.EntitySearchField;
 import org.apache.airavata.sharing.registry.models.SearchCondition;
+import org.apache.airavata.service.groupprofile.GroupResourceProfileService;
 import org.apache.airavata.service.sharing.SharingHelper;
 import 
org.apache.airavata.sharing.registry.server.SharingRegistryServerHandler;
 import org.slf4j.Logger;
@@ -48,6 +49,7 @@ public class ExperimentService {
     private final RegistryServerHandler registryHandler;
     private final SharingRegistryServerHandler sharingHandler;
     private final EventPublisher eventPublisher;
+    private GroupResourceProfileService groupResourceProfileService;
 
     public ExperimentService(
             RegistryServerHandler registryHandler,
@@ -58,6 +60,10 @@ public class ExperimentService {
         this.eventPublisher = eventPublisher;
     }
 
+    public void setGroupResourceProfileService(GroupResourceProfileService 
groupResourceProfileService) {
+        this.groupResourceProfileService = groupResourceProfileService;
+    }
+
     public String createExperiment(RequestContext ctx, ExperimentModel 
experiment) throws ServiceException {
         try {
             String experimentId = 
registryHandler.createExperiment(ctx.getGatewayId(), experiment);
@@ -569,8 +575,7 @@ public class ExperimentService {
         }
     }
 
-    public void launchExperiment(RequestContext ctx, String experimentId, 
String gatewayId,
-            
List<org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile>
 accessibleGroupResourceProfiles)
+    public void launchExperiment(RequestContext ctx, String experimentId, 
String gatewayId)
             throws ServiceException {
         try {
             ExperimentModel experiment = 
registryHandler.getExperiment(experimentId);
@@ -580,6 +585,10 @@ public class ExperimentService {
 
             // For backwards compatibility, if there is no 
groupResourceProfileId, pick one
             if 
(!experiment.getUserConfigurationData().isSetGroupResourceProfileId()) {
+                
List<org.apache.airavata.model.appcatalog.groupresourceprofile.GroupResourceProfile>
+                        accessibleGroupResourceProfiles = 
groupResourceProfileService != null
+                                ? 
groupResourceProfileService.getGroupResourceList(ctx, gatewayId)
+                                : List.of();
                 if (!accessibleGroupResourceProfiles.isEmpty()) {
                     final String groupResourceProfileId =
                             
accessibleGroupResourceProfiles.get(0).getGroupResourceProfileId();

Reply via email to