DImuthuUpe commented on code in PR #755:
URL: https://github.com/apache/airavata/pull/755#discussion_r4544188508


##########
internal/orchestration/execution/tracker.go:
##########
@@ -22,22 +22,50 @@ package execution
 
 import (
        "context"
+       "errors"
        "log/slog"
        "time"
 
+       "github.com/cschleiden/go-workflows/workflow"
+
        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
+       statuses  *processrepo.TaskStatusRepository
+       processes *processrepo.ProcessRepository
 }
 
 // NewTaskTracker returns a tracker writing to statuses.
-func NewTaskTracker(statuses *processrepo.TaskStatusRepository) *TaskTracker {
-       return &TaskTracker{statuses: statuses}
+func NewTaskTracker(statuses *processrepo.TaskStatusRepository, processes 
*processrepo.ProcessRepository) *TaskTracker {
+       return &TaskTracker{statuses: statuses, processes: processes}
+}
+
+var ErrStopped = errors.New("the process is stopped")
+
+// UntilStopped returns ctx cancelled once the process is stopped, so that 
work a task
+// has in flight ends with it.
+func (t *TaskTracker) UntilStopped(ctx context.Context, processID string) 
(context.Context, context.CancelFunc) {

Review Comment:
   This is an expensive implementation. When a stop command arrived, we should 
fetch all workflow ids for the process and directly call the workflow cancel 
command



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to