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

DImuthuUpe pushed a commit to branch workflow-pause-on-auth
in repository https://gitbox.apache.org/repos/asf/airavata.git


The following commit(s) were added to refs/heads/workflow-pause-on-auth by this 
push:
     new 292c1ff4a1 Recording both workflow success and running status
292c1ff4a1 is described below

commit 292c1ff4a19f8f733e83716c2b2d084d578224e3
Author: DImuthuUpe <[email protected]>
AuthorDate: Sat Nov 7 00:40:42 2026 -0500

    Recording both workflow success and running status
---
 internal/orchestration/engine.go              | 28 ++++++++++++++++++---------
 internal/orchestration/workflows/workflows.go |  7 ++++++-
 2 files changed, 25 insertions(+), 10 deletions(-)

diff --git a/internal/orchestration/engine.go b/internal/orchestration/engine.go
index 5f018647aa..234a77c20e 100644
--- a/internal/orchestration/engine.go
+++ b/internal/orchestration/engine.go
@@ -51,11 +51,12 @@ import (
 // ExecutionEngine runs the workflows that carry out a process, and starts 
them when a
 // process is launched or the scheduler reports its job has finished.
 type ExecutionEngine struct {
-       workflows     *workflows.Workflows
-       orchestrator  *worker.WorkflowOrchestrator
-       processes     *processrepo.ProcessRepository
-       batchStatus   *processrepo.BatchJobStatusRepository
-       processStatus *processrepo.StatusRepository
+       workflows        *workflows.Workflows
+       orchestrator     *worker.WorkflowOrchestrator
+       processes        *processrepo.ProcessRepository
+       batchStatus      *processrepo.BatchJobStatusRepository
+       processStatus    *processrepo.StatusRepository
+       processWorkflows *processrepo.WorkflowRepository
 }
 
 // NewExecutionEngine returns the workflow set scheduling acts.
@@ -92,10 +93,11 @@ func NewExecutionEngine(dataStagingTasks 
*processrepo.DataStagingTaskRepository,
                        dataStagingTasks, jobSubmissionTasks, 
jobMonitoringTasks, processStatus,
                        processWorkflows,
                ),
-               orchestrator:  orchestrator,
-               processes:     processes,
-               batchStatus:   batchStatus,
-               processStatus: processStatus,
+               orchestrator:     orchestrator,
+               processes:        processes,
+               batchStatus:      batchStatus,
+               processStatus:    processStatus,
+               processWorkflows: processWorkflows,
        }
 }
 
@@ -177,6 +179,14 @@ func (w *ExecutionEngine) HandleBatchJobEmailResponse(ctx 
context.Context, email
                        slog.Error("Failed to create workflow instance for 
batch job completion", "error", err)
                        return nil
                }
+
+               // Update the process workflow repository to indicate that the 
job completion workflow is running
+               _, err = w.processWorkflows.Record(ctx, process.ID, workflowId, 
model.ProcessWorkflowTypeJobCompletion, model.ProcessWorkflowStatusTypeRunning)
+               if err != nil {
+                       slog.Error("Failed to record process workflow", 
"processID", process.ID, "error", err)
+                       return nil
+               }
+
        }
 
        if parsed.Status == model.BatchJobStatusBegin {
diff --git a/internal/orchestration/workflows/workflows.go 
b/internal/orchestration/workflows/workflows.go
index d320642558..f6482b7fbd 100644
--- a/internal/orchestration/workflows/workflows.go
+++ b/internal/orchestration/workflows/workflows.go
@@ -171,7 +171,7 @@ func (w *Workflows) HandleBatchJobCompletion(ctx 
workflow.Context, processID str
        }
 
        // record workflow completion
-       if _, err := w.processWorkflows.Record(ctxInt, processID, 
workflow.WorkflowInstance(ctx).InstanceID, 
model.ProcessWorkflowTypeBatchJobSubmission, 
model.ProcessWorkflowStatusTypeSucceeded); err != nil {
+       if _, err := w.processWorkflows.Record(ctxInt, processID, 
workflow.WorkflowInstance(ctx).InstanceID, 
model.ProcessWorkflowTypeJobCompletion, 
model.ProcessWorkflowStatusTypeSucceeded); err != nil {
                slog.Error("Failed to record process workflow", "processId", 
processID, "error", err)
                return err
        }
@@ -244,6 +244,11 @@ func (w *Workflows) HandleBatchJobSubmission(ctx 
workflow.Context, processID str
                return err
        }
 
+       if _, err := w.processWorkflows.Record(ctxInt, processID, 
workflow.WorkflowInstance(ctx).InstanceID, 
model.ProcessWorkflowTypeBatchJobSubmission, 
model.ProcessWorkflowStatusTypeSucceeded); err != nil {
+               slog.Error("Failed to record process workflow", "processId", 
processID, "error", err)
+               return err
+       }
+
        return nil
 }
 

Reply via email to