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 1101c1d7a3 Add task status tracking support
1101c1d7a3 is described below

commit 1101c1d7a3003260eb12e476e1d44c2279049c36
Author: DImuthuUpe <[email protected]>
AuthorDate: Fri Nov 6 17:06:23 2026 -0500

    Add task status tracking support
---
 api/process/repository/task_status.go              |  70 ++++++++++
 internal/app/app.go                                |   4 +-
 internal/orchestration/engine.go                   |  10 +-
 internal/orchestration/execution/tracker.go        |  89 ++++++++++++
 internal/orchestration/execution/tracker_test.go   | 153 +++++++++++++++++++++
 internal/orchestration/tasks/batch/batch.go        |  11 ++
 internal/orchestration/tasks/data/data.go          |  12 ++
 .../orchestration/tasks/monitoring/monitoring.go   |  15 +-
 8 files changed, 358 insertions(+), 6 deletions(-)

diff --git a/api/process/repository/task_status.go 
b/api/process/repository/task_status.go
new file mode 100644
index 0000000000..383e4a300e
--- /dev/null
+++ b/api/process/repository/task_status.go
@@ -0,0 +1,70 @@
+/**
+*
+* 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 repository
+
+import (
+       "context"
+
+       "gorm.io/gorm"
+
+       model "github.com/apache/airavata/api/process/model"
+)
+
+// TaskStatusRepository reads and writes task statuses.
+//
+// There is no Update: statuses are append-only history, never corrected in 
place.
+type TaskStatusRepository struct{ db *gorm.DB }
+
+// NewTaskStatusRepository returns a repository backed by db.
+func NewTaskStatusRepository(db *gorm.DB) *TaskStatusRepository {
+       return &TaskStatusRepository{db: db}
+}
+
+// WithTx returns a repository bound to tx.
+func (r *TaskStatusRepository) WithTx(tx *gorm.DB) *TaskStatusRepository {
+       return &TaskStatusRepository{db: tx}
+}
+
+// FindByTaskID returns every status recorded for one task, oldest first.
+func (r *TaskStatusRepository) FindByTaskID(ctx context.Context, taskID 
string) ([]model.TaskStatus, error) {
+       var out []model.TaskStatus
+       err := r.db.WithContext(ctx).
+               Where("task_id = ?", taskID).
+               Order("timestamp").
+               Find(&out).Error
+       return out, err
+}
+
+// FindByProcessID returns every status recorded for the tasks of one process, 
oldest
+// first.
+func (r *TaskStatusRepository) FindByProcessID(ctx context.Context, processID 
string) ([]model.TaskStatus, error) {
+       var out []model.TaskStatus
+       err := r.db.WithContext(ctx).
+               Where("process_id = ?", processID).
+               Order("timestamp").
+               Find(&out).Error
+       return out, err
+}
+
+// Create inserts a status row. BeforeCreate assigns its id.
+func (r *TaskStatusRepository) Create(ctx context.Context, s 
*model.TaskStatus) error {
+       return r.db.WithContext(ctx).Create(s).Error
+}
diff --git a/internal/app/app.go b/internal/app/app.go
index d7b88d1642..ef4ec0d953 100644
--- a/internal/app/app.go
+++ b/internal/app/app.go
@@ -126,6 +126,7 @@ type Repositories struct {
        Shares                  *sharingrepo.Repository
        Processes               *processrepo.ProcessRepository
        Statuses                *processrepo.StatusRepository
+       TaskStatuses            *processrepo.TaskStatusRepository
        BatchJobStatuses        *processrepo.BatchJobStatusRepository
        DataStagingTasks        *processrepo.DataStagingTaskRepository
        JobSubmissionTasks      *processrepo.JobSubmissionTaskRepository
@@ -151,6 +152,7 @@ func NewRepositories(db *gorm.DB) *Repositories {
                Shares:                  sharingrepo.NewRepository(db),
                Processes:               processrepo.NewProcessRepository(db),
                Statuses:                processrepo.NewStatusRepository(db),
+               TaskStatuses:            
processrepo.NewTaskStatusRepository(db),
                BatchJobStatuses:        
processrepo.NewBatchJobStatusRepository(db),
                DataStagingTasks:        
processrepo.NewDataStagingTaskRepository(db),
                JobSubmissionTasks:      
processrepo.NewJobSubmissionTaskRepository(db),
@@ -211,7 +213,7 @@ func NewServices(cfg config.Config, db *gorm.DB, repos 
*Repositories, workflowBa
        sshCredentialSvc := 
credentialssvc.NewSSHCredentialService(sshCredentials, users, clusterConfigs, 
storages)
 
        executionEngine := orchestration.NewExecutionEngine(stagingTasks, 
submissionTasks,
-               monitoringTasks, storages, clusterConfigs, processes, 
deployments, templates, batchStatus, statuses, workflowBackend, sshContext)
+               monitoringTasks, storages, clusterConfigs, processes, 
deployments, templates, batchStatus, statuses, repos.TaskStatuses, 
workflowBackend, sshContext)
        executionEngine.StartEngine()
 
        return &Services{
diff --git a/internal/orchestration/engine.go b/internal/orchestration/engine.go
index 6760e67ba0..38596e989d 100644
--- a/internal/orchestration/engine.go
+++ b/internal/orchestration/engine.go
@@ -39,6 +39,7 @@ import (
        datastorerepo "github.com/apache/airavata/api/data/repository"
        model "github.com/apache/airavata/api/process/model"
        processrepo "github.com/apache/airavata/api/process/repository"
+       "github.com/apache/airavata/internal/orchestration/execution"
        "github.com/apache/airavata/internal/orchestration/tasks/batch"
        "github.com/apache/airavata/internal/orchestration/tasks/data"
        "github.com/apache/airavata/internal/orchestration/tasks/monitoring"
@@ -68,6 +69,7 @@ func NewExecutionEngine(dataStagingTasks 
*processrepo.DataStagingTaskRepository,
        templates *applicationrepo.TemplateRepository,
        batchStatus *processrepo.BatchJobStatusRepository,
        processStatus *processrepo.StatusRepository,
+       taskStatus *processrepo.TaskStatusRepository,
        workflowBackend backend.Backend,
        sshContext *ssh.GlobalSSHContext,
 ) *ExecutionEngine {
@@ -79,11 +81,13 @@ func NewExecutionEngine(dataStagingTasks 
*processrepo.DataStagingTaskRepository,
                orchestrator = worker.NewWorkflowOrchestrator(workflowBackend, 
nil)
        }
 
+       tracker := execution.NewTaskTracker(taskStatus)
+
        return &ExecutionEngine{
                workflows: workflows.New(
-                       data.New(processes, dataStagingTasks, scpStorages, 
slurmClusterConfigs, sshContext),
-                       batch.New(processes, jobSubmissionTasks, 
slurmClusterConfigs, batchDeployments, templates, batchStatus, sshContext),
-                       monitoring.New(processes, jobMonitoringTasks),
+                       data.New(processes, dataStagingTasks, scpStorages, 
slurmClusterConfigs, sshContext, tracker),
+                       batch.New(processes, jobSubmissionTasks, 
slurmClusterConfigs, batchDeployments, templates, batchStatus, sshContext, 
tracker),
+                       monitoring.New(processes, jobMonitoringTasks, tracker),
                        dataStagingTasks, jobSubmissionTasks, 
jobMonitoringTasks, processStatus,
                ),
                orchestrator:  orchestrator,
diff --git a/internal/orchestration/execution/tracker.go 
b/internal/orchestration/execution/tracker.go
new file mode 100644
index 0000000000..c8b47c8fa8
--- /dev/null
+++ b/internal/orchestration/execution/tracker.go
@@ -0,0 +1,89 @@
+/**
+*
+* 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 execution
+
+import (
+       "context"
+       "log/slog"
+       "time"
+
+       model "github.com/apache/airavata/api/process/model"
+       processrepo "github.com/apache/airavata/api/process/repository"
+       internalptr "github.com/apache/airavata/internal/ptr"
+)
+
+// TaskTracker records the status history of the tasks an activity carries out.
+type TaskTracker struct {
+       statuses *processrepo.TaskStatusRepository
+}
+
+// NewTaskTracker returns a tracker writing to statuses.
+func NewTaskTracker(statuses *processrepo.TaskStatusRepository) *TaskTracker {
+       return &TaskTracker{statuses: statuses}
+}
+
+// Track runs one attempt of a task between an EXECUTING status and the status 
its
+// outcome earns: COMPLETED on success, FAILED with the error as the log 
otherwise.
+//
+// It is called from inside an activity, never from the workflow, since a 
workflow body
+// is replayed and must not write. Each retry of the activity is an attempt of 
its own,
+// so a task retried twice shows two FAILED entries before its last outcome.
+//
+// A status that cannot be written is logged and dropped rather than failing 
the task:
+// the history describes the work, and losing an entry of it is no reason to 
redo work
+// that succeeded.
+func (t *TaskTracker) Track(ctx context.Context, processID, taskID string, 
taskType model.TaskType,
+       run func() (*Context, error)) (*Context, error) {
+
+       t.Record(ctx, processID, taskID, taskType, 
model.TaskStatusTypeExecuting, nil)
+
+       out, err := run()
+       if err != nil {
+               t.Record(ctx, processID, taskID, taskType, 
model.TaskStatusTypeFailed, internalptr.To(err.Error()))
+               return out, err
+       }
+       t.Record(ctx, processID, taskID, taskType, 
model.TaskStatusTypeCompleted, nil)
+       return out, nil
+}
+
+// Record appends one status to a task's history, logging rather than 
returning a
+// failure to write it.
+func (t *TaskTracker) Record(ctx context.Context, processID, taskID string, 
taskType model.TaskType,
+       status model.TaskStatusType, log *string) {
+
+       if t == nil || t.statuses == nil {
+               return
+       }
+       // The task's own context may already be cancelled by the time its 
outcome is known,
+       // and the outcome is exactly what most needs recording.
+       ctx = context.WithoutCancel(ctx)
+       if err := t.statuses.Create(ctx, &model.TaskStatus{
+               TaskID:    taskID,
+               TaskType:  taskType,
+               ProcessID: &processID,
+               Status:    &status,
+               Log:       log,
+               Timestamp: internalptr.To(time.Now().UnixMilli()),
+       }); err != nil {
+               slog.Error("Failed to record task status", "taskId", taskID, 
"processId", processID,
+                       "taskType", taskType, "status", status, "error", err)
+       }
+}
diff --git a/internal/orchestration/execution/tracker_test.go 
b/internal/orchestration/execution/tracker_test.go
new file mode 100644
index 0000000000..7cfae54248
--- /dev/null
+++ b/internal/orchestration/execution/tracker_test.go
@@ -0,0 +1,153 @@
+/**
+*
+* 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 execution_test
+
+import (
+       "context"
+       "errors"
+       "testing"
+
+       "github.com/glebarez/sqlite"
+       "gorm.io/gorm"
+       "gorm.io/gorm/logger"
+
+       model "github.com/apache/airavata/api/process/model"
+       processrepo "github.com/apache/airavata/api/process/repository"
+       "github.com/apache/airavata/internal/db"
+       "github.com/apache/airavata/internal/orchestration/execution"
+)
+
+func newTracker(t *testing.T) (*execution.TaskTracker, 
*processrepo.TaskStatusRepository, *gorm.DB) {
+       t.Helper()
+       gdb, err := 
gorm.Open(sqlite.Open("file::memory:?_pragma=foreign_keys(1)"), &gorm.Config{
+               Logger: logger.Default.LogMode(logger.Silent),
+       })
+       if err != nil {
+               t.Fatalf("open sqlite: %v", err)
+       }
+       if err := db.AutoMigrate(gdb); err != nil {
+               t.Fatalf("automigrate: %v", err)
+       }
+       statuses := processrepo.NewTaskStatusRepository(gdb)
+       return execution.NewTaskTracker(statuses), statuses, gdb
+}
+
+func statusesOf(t *testing.T, repo *processrepo.TaskStatusRepository, taskID 
string) []model.TaskStatusType {
+       t.Helper()
+       rows, err := repo.FindByTaskID(context.Background(), taskID)
+       if err != nil {
+               t.Fatalf("find statuses: %v", err)
+       }
+       out := make([]model.TaskStatusType, 0, len(rows))
+       for _, r := range rows {
+               out = append(out, *r.Status)
+       }
+       return out
+}
+
+func TestTrackRecordsExecutingThenCompleted(t *testing.T) {
+       tracker, repo, gdb := newTracker(t)
+       proc := &model.Process{}
+       if err := gdb.Create(proc).Error; err != nil {
+               t.Fatalf("create process: %v", err)
+       }
+
+       want := &execution.Context{SomeData: "carried"}
+       got, err := tracker.Track(context.Background(), proc.ID, "task-1", 
model.TaskTypeDataStaging,
+               func() (*execution.Context, error) { return want, nil })
+       if err != nil {
+               t.Fatalf("track: %v", err)
+       }
+       if got != want {
+               t.Errorf("Track returned %v, want the run's own context", got)
+       }
+
+       statuses := statusesOf(t, repo, "task-1")
+       if len(statuses) != 2 || statuses[0] != model.TaskStatusTypeExecuting 
|| statuses[1] != model.TaskStatusTypeCompleted {
+               t.Errorf("statuses = %v, want [EXECUTING COMPLETED]", statuses)
+       }
+}
+
+func TestTrackRecordsFailureWithItsError(t *testing.T) {
+       tracker, repo, gdb := newTracker(t)
+       proc := &model.Process{}
+       if err := gdb.Create(proc).Error; err != nil {
+               t.Fatalf("create process: %v", err)
+       }
+
+       boom := errors.New("scp refused")
+       _, err := tracker.Track(context.Background(), proc.ID, "task-2", 
model.TaskTypeJobSubmission,
+               func() (*execution.Context, error) { return nil, boom })
+       if !errors.Is(err, boom) {
+               t.Fatalf("Track error = %v, want the run's own error", err)
+       }
+
+       rows, err := repo.FindByTaskID(context.Background(), "task-2")
+       if err != nil {
+               t.Fatalf("find statuses: %v", err)
+       }
+       if len(rows) != 2 || *rows[1].Status != model.TaskStatusTypeFailed {
+               t.Fatalf("statuses = %v, want EXECUTING then FAILED", 
statusesOf(t, repo, "task-2"))
+       }
+       if rows[1].Log == nil || *rows[1].Log != boom.Error() {
+               t.Errorf("FAILED log = %v, want %q", rows[1].Log, boom.Error())
+       }
+       if rows[1].TaskType != model.TaskTypeJobSubmission {
+               t.Errorf("TaskType = %q, want %q", rows[1].TaskType, 
model.TaskTypeJobSubmission)
+       }
+}
+
+// A status that cannot be written must not fail the task it describes.
+func TestTrackSurvivesUnwritableStatus(t *testing.T) {
+       tracker, repo, _ := newTracker(t)
+
+       // No such process, so the foreign key rejects every status row.
+       _, err := tracker.Track(context.Background(), "missing-process", 
"task-3", model.TaskTypeJobMonitoring,
+               func() (*execution.Context, error) { return 
&execution.Context{}, nil })
+       if err != nil {
+               t.Fatalf("Track error = %v, want the run's success to stand", 
err)
+       }
+       if statuses := statusesOf(t, repo, "task-3"); len(statuses) != 0 {
+               t.Errorf("statuses = %v, want none written", statuses)
+       }
+}
+
+// Deleting a task takes its history with it, standing in for the foreign key 
task_id
+// cannot carry.
+func TestDeletingTaskRemovesItsStatuses(t *testing.T) {
+       tracker, repo, gdb := newTracker(t)
+       proc := &model.Process{}
+       if err := gdb.Create(proc).Error; err != nil {
+               t.Fatalf("create process: %v", err)
+       }
+       task := &model.DataStagingTask{ProcessID: &proc.ID}
+       if err := gdb.Create(task).Error; err != nil {
+               t.Fatalf("create task: %v", err)
+       }
+       tracker.Record(context.Background(), proc.ID, task.ID, 
model.TaskTypeDataStaging, model.TaskStatusTypeCreated, nil)
+
+       if err := 
processrepo.NewDataStagingTaskRepository(gdb).Delete(context.Background(), 
task); err != nil {
+               t.Fatalf("delete task: %v", err)
+       }
+       if statuses := statusesOf(t, repo, task.ID); len(statuses) != 0 {
+               t.Errorf("statuses = %v, want none after the task was deleted", 
statuses)
+       }
+}
diff --git a/internal/orchestration/tasks/batch/batch.go 
b/internal/orchestration/tasks/batch/batch.go
index d28278d724..4c89a4ddd6 100644
--- a/internal/orchestration/tasks/batch/batch.go
+++ b/internal/orchestration/tasks/batch/batch.go
@@ -50,6 +50,7 @@ type Tasks struct {
        templates           *applicationrepo.TemplateRepository
        batchStatus         *processrepo.BatchJobStatusRepository
        sshContext          *ssh.GlobalSSHContext
+       tracker             *execution.TaskTracker
 }
 
 // New returns the batch tasks over the given repositories.
@@ -60,6 +61,7 @@ func New(processes *processrepo.ProcessRepository,
        templates *applicationrepo.TemplateRepository,
        batchStatus *processrepo.BatchJobStatusRepository,
        sshContext *ssh.GlobalSSHContext,
+       tracker *execution.TaskTracker,
 ) *Tasks {
        return &Tasks{
                processes:           processes,
@@ -69,6 +71,7 @@ func New(processes *processrepo.ProcessRepository,
                templates:           templates,
                batchStatus:         batchStatus,
                sshContext:          sshContext,
+               tracker:             tracker,
        }
 }
 
@@ -79,7 +82,15 @@ type SubmitBatchJobParameters struct {
        Environment    map[string]string
 }
 
+// SubmitBatchJob builds the process's submission script, uploads it and 
submits it,
+// recording the task's status as it goes.
 func (a *Tasks) SubmitBatchJob(ctx context.Context, executionContext 
*execution.Context, processID string, taskID string) (*execution.Context, 
error) {
+       return a.tracker.Track(ctx, processID, taskID, 
model.TaskTypeJobSubmission, func() (*execution.Context, error) {
+               return a.submitBatchJob(ctx, executionContext, processID, 
taskID)
+       })
+}
+
+func (a *Tasks) submitBatchJob(ctx context.Context, executionContext 
*execution.Context, processID string, taskID string) (*execution.Context, 
error) {
        slog.Info("Starting to submit batch job", "taskId", taskID, 
"processId", processID)
 
        process, err := execution.FindBatchProcess(ctx, a.processes, processID)
diff --git a/internal/orchestration/tasks/data/data.go 
b/internal/orchestration/tasks/data/data.go
index 50bb0238ef..60e0d652bd 100644
--- a/internal/orchestration/tasks/data/data.go
+++ b/internal/orchestration/tasks/data/data.go
@@ -33,6 +33,7 @@ import (
        computerepo "github.com/apache/airavata/api/compute/repository"
        datamodel "github.com/apache/airavata/api/data/model"
        datastorerepo "github.com/apache/airavata/api/data/repository"
+       model "github.com/apache/airavata/api/process/model"
        processrepo "github.com/apache/airavata/api/process/repository"
        "github.com/apache/airavata/internal/orchestration/execution"
        ssh "github.com/apache/airavata/internal/ssh"
@@ -46,6 +47,7 @@ type Tasks struct {
        scpStorages         *datastorerepo.SCPDataStorageRepository
        slurmClusterConfigs *computerepo.SlurmClusterConfigRepository
        sshContext          *ssh.GlobalSSHContext
+       tracker             *execution.TaskTracker
 }
 
 // New returns the data staging tasks over the given repositories.
@@ -54,6 +56,7 @@ func New(processes *processrepo.ProcessRepository,
        scpStorages *datastorerepo.SCPDataStorageRepository,
        slurmClusterConfigs *computerepo.SlurmClusterConfigRepository,
        sshContext *ssh.GlobalSSHContext,
+       tracker *execution.TaskTracker,
 ) *Tasks {
        return &Tasks{
                processes:           processes,
@@ -61,10 +64,19 @@ func New(processes *processrepo.ProcessRepository,
                scpStorages:         scpStorages,
                slurmClusterConfigs: slurmClusterConfigs,
                sshContext:          sshContext,
+               tracker:             tracker,
        }
 }
 
+// CopyData stages one file between the task's two storages, recording the 
task's status
+// as it goes.
 func (a *Tasks) CopyData(ctx context.Context, executionContext 
*execution.Context, processId string, dataStagingTaskId string) 
(*execution.Context, error) {
+       return a.tracker.Track(ctx, processId, dataStagingTaskId, 
model.TaskTypeDataStaging, func() (*execution.Context, error) {
+               return a.copyData(ctx, executionContext, processId, 
dataStagingTaskId)
+       })
+}
+
+func (a *Tasks) copyData(ctx context.Context, executionContext 
*execution.Context, processId string, dataStagingTaskId string) 
(*execution.Context, error) {
 
        process, err := execution.FindBatchProcess(ctx, a.processes, processId)
        if err != nil {
diff --git a/internal/orchestration/tasks/monitoring/monitoring.go 
b/internal/orchestration/tasks/monitoring/monitoring.go
index ef3d212c08..fee98e51e5 100644
--- a/internal/orchestration/tasks/monitoring/monitoring.go
+++ b/internal/orchestration/tasks/monitoring/monitoring.go
@@ -26,6 +26,7 @@ import (
        "context"
        "log/slog"
 
+       model "github.com/apache/airavata/api/process/model"
        processrepo "github.com/apache/airavata/api/process/repository"
        "github.com/apache/airavata/internal/orchestration/execution"
 )
@@ -35,14 +36,24 @@ import (
 type Tasks struct {
        processes          *processrepo.ProcessRepository
        jobMonitoringTasks *processrepo.JobMonitoringTaskRepository
+       tracker            *execution.TaskTracker
 }
 
 // New returns the monitoring tasks over the given repositories.
-func New(processes *processrepo.ProcessRepository, jobMonitoringTasks 
*processrepo.JobMonitoringTaskRepository) *Tasks {
-       return &Tasks{processes: processes, jobMonitoringTasks: 
jobMonitoringTasks}
+func New(processes *processrepo.ProcessRepository, jobMonitoringTasks 
*processrepo.JobMonitoringTaskRepository,
+       tracker *execution.TaskTracker) *Tasks {
+       return &Tasks{processes: processes, jobMonitoringTasks: 
jobMonitoringTasks, tracker: tracker}
 }
 
+// MonitorBatchJob checks the outcome of a finished batch job, recording the 
task's
+// status as it goes.
 func (a *Tasks) MonitorBatchJob(ctx context.Context, executionContext 
*execution.Context, processID string, taskID string) (*execution.Context, 
error) {
+       return a.tracker.Track(ctx, processID, taskID, 
model.TaskTypeJobMonitoring, func() (*execution.Context, error) {
+               return a.monitorBatchJob(ctx, executionContext, processID, 
taskID)
+       })
+}
+
+func (a *Tasks) monitorBatchJob(ctx context.Context, executionContext 
*execution.Context, processID string, taskID string) (*execution.Context, 
error) {
        slog.Info("Starting to monitor batch job ", "taskId", taskID, 
"processId", processID)
        process, err := execution.FindBatchProcess(ctx, a.processes, processID)
        if err != nil {

Reply via email to