You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by is...@apache.org on 2022/12/02 16:50:55 UTC

[airavata] branch develop updated: Bug fix in getProcessInState

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 622a290c19 Bug fix in getProcessInState
     new e2c1f2b9bd Merge pull request #354 from isururanawaka/metaschedular
622a290c19 is described below

commit 622a290c193c603f12f92c5c60d4d13228ae709a
Author: Isuru Ranawaka <ir...@gmail.com>
AuthorDate: Fri Dec 2 11:49:56 2022 -0500

    Bug fix in getProcessInState
---
 .../core/repositories/expcatalog/ProcessStatusRepository.java         | 2 +-
 .../java/org/apache/airavata/registry/core/utils/QueryConstants.java  | 2 +-
 .../airavata/registry/api/service/handler/RegistryServerHandler.java  | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessStatusRepository.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessStatusRepository.java
index cc2ce54dbe..b56ffeda76 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessStatusRepository.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/repositories/expcatalog/ProcessStatusRepository.java
@@ -124,7 +124,7 @@ public class ProcessStatusRepository extends ExpCatAbstractRepository<ProcessSta
 
     public List<ProcessStatus> getProcessStatusList(ProcessState processState, int limit, int offset) throws RegistryException {
         Map<String, Object> queryMap = new HashMap<>();
-        queryMap.put(DBConstants.ProcessStatus.STATE,processState.name());
+        queryMap.put(DBConstants.ProcessStatus.STATE,processState.getValue());
        return  select(QueryConstants.FIND_PROCESS_WITH_STATUS,limit,offset,queryMap);
     }
 
diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/utils/QueryConstants.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/utils/QueryConstants.java
index b38298e17e..7bfe000658 100644
--- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/utils/QueryConstants.java
+++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/utils/QueryConstants.java
@@ -189,7 +189,7 @@ public interface QueryConstants {
             + DBConstants.QueueStatus.HOST_NAME + " AND L.queueName LIKE :" + DBConstants.QueueStatus.QUEUE_NAME +" ORDER BY L.time DESC";
 
     String FIND_PROCESS_WITH_STATUS = "SELECT P FROM " + ProcessStatusEntity.class.getSimpleName() + " P " +
-            " where P.state LIKE :" + DBConstants.ProcessStatus.STATE;
+            " where P.state.value = :" + DBConstants.ProcessStatus.STATE;
 
     String GET_ALL_PROCESSES = "SELECT P FROM " + ProcessEntity.class.getSimpleName() +" P ";
 }
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 ff109086cb..4f19d1d762 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
@@ -985,7 +985,7 @@ public class RegistryServerHandler implements RegistryService.Iface {
           int offset =0;
           int limit = 100;
           int count =0;
-          while(count==limit) {
+          do {
               List<ProcessStatus> processStatusList = processStatusRepository.getProcessStatusList(processState,offset,limit);
               offset += processStatusList.size();
               count = processStatusList.size();
@@ -995,7 +995,7 @@ public class RegistryServerHandler implements RegistryService.Iface {
                       finalProcessList.add(processRepository.getProcess(latestStatus.getProcessId()));
                   }
               }
-          }
+          } while(count==limit);
             return finalProcessList;
         } catch (Exception e) {
             AiravataSystemException exception = new AiravataSystemException();