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 c57921d140 updating process status by replacing current one
     new 6a3736262a Merge pull request #357 from isururanawaka/metaschedular
c57921d140 is described below

commit c57921d14061d41c7af381566b6740b200067dda
Author: Isuru Ranawaka <[email protected]>
AuthorDate: Fri Dec 2 16:11:20 2022 -0500

    updating process status by replacing current one
---
 .../apache/airavata/metascheduler/core/utils/Utils.java  | 16 ++++++++++++++++
 .../rescheduler/ExponentialBackOffReScheduler.java       |  4 ++--
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git 
a/modules/airavata-metascheduler/metascheduler-core/src/main/java/org/apache/airavata/metascheduler/core/utils/Utils.java
 
b/modules/airavata-metascheduler/metascheduler-core/src/main/java/org/apache/airavata/metascheduler/core/utils/Utils.java
index 2f2e058950..466abae27d 100644
--- 
a/modules/airavata-metascheduler/metascheduler-core/src/main/java/org/apache/airavata/metascheduler/core/utils/Utils.java
+++ 
b/modules/airavata-metascheduler/metascheduler-core/src/main/java/org/apache/airavata/metascheduler/core/utils/Utils.java
@@ -84,6 +84,22 @@ public class Utils {
         getStatusPublisher().publish(msgCtx);
     }
 
+    public static void updateProcessStatusAndPublishStatus(ProcessState 
processState, String processId,
+                                                   String experimentId, String 
gatewayId)
+            throws RegistryServiceException, TException, AiravataException {
+
+        ProcessStatus processStatus = new ProcessStatus(processState);
+        
processStatus.setTimeOfStateChange(AiravataUtils.getCurrentTimestamp().getTime());
+
+        registryClientPool.getResource().updateProcessStatus(processStatus, 
processId);
+        ProcessIdentifier identifier = new ProcessIdentifier(processId, 
experimentId, gatewayId);
+        ProcessStatusChangeEvent processStatusChangeEvent = new 
ProcessStatusChangeEvent(processState, identifier);
+        MessageContext msgCtx = new MessageContext(processStatusChangeEvent, 
MessageType.PROCESS,
+                AiravataUtils.getId(MessageType.PROCESS.name()), gatewayId);
+        msgCtx.setUpdatedTime(AiravataUtils.getCurrentTimestamp());
+        getStatusPublisher().publish(msgCtx);
+    }
+
     public static synchronized Publisher getStatusPublisher() throws 
AiravataException {
         if (statusPublisher == null) {
             statusPublisher = MessagingFactory.getPublisher(Type.STATUS);
diff --git 
a/modules/airavata-metascheduler/process-scheduler/src/main/java/org/apache/airavata/metascheduler/process/scheduling/engine/rescheduler/ExponentialBackOffReScheduler.java
 
b/modules/airavata-metascheduler/process-scheduler/src/main/java/org/apache/airavata/metascheduler/process/scheduling/engine/rescheduler/ExponentialBackOffReScheduler.java
index 2d3bb70e91..2f6be1230b 100644
--- 
a/modules/airavata-metascheduler/process-scheduler/src/main/java/org/apache/airavata/metascheduler/process/scheduling/engine/rescheduler/ExponentialBackOffReScheduler.java
+++ 
b/modules/airavata-metascheduler/process-scheduler/src/main/java/org/apache/airavata/metascheduler/process/scheduling/engine/rescheduler/ExponentialBackOffReScheduler.java
@@ -42,13 +42,13 @@ public class ExponentialBackOffReScheduler implements 
ReScheduler {
                 if (computationalResourceSchedulingModel.isPresent()) {
                     
processModel.setProcessResourceSchedule(computationalResourceSchedulingModel.get());
                     client.updateProcess(processModel, 
processModel.getProcessId());
-                    Utils.saveAndPublishProcessStatus(ProcessState.DEQUEUING, 
processModel.getProcessId(), processModel.getExperimentId(),
+                    
Utils.updateProcessStatusAndPublishStatus(ProcessState.DEQUEUING, 
processModel.getProcessId(), processModel.getExperimentId(),
                             experimentModel.getGatewayId());
                 }
             } else if (processState.equals(ProcessState.REQUEUED)) {
                 int currentCount = getRequeuedCount(processStatusList);
                 if (currentCount >= maxReschedulingCount) {
-                    Utils.saveAndPublishProcessStatus(ProcessState.FAILED, 
processModel.getProcessId(), processModel.getExperimentId(),
+                    
Utils.updateProcessStatusAndPublishStatus(ProcessState.FAILED, 
processModel.getProcessId(), processModel.getExperimentId(),
                             experimentModel.getGatewayId());
                 } else {
 

Reply via email to