feat(workflow): record each failed attempt of a retried step
This commit is contained in:
1 parent
2998a2ed13
commit
e084c55fcc
6 files changed
+25
-8
No files matched your search
@@ -12,6 +12,7 @@ import (
|
||||
"github.com/samcharles93/archie-core/internal/domain/agentrun"
|
||||
"github.com/samcharles93/archie-core/internal/domain/stableid"
|
||||
"github.com/samcharles93/archie-core/internal/domain/workflow/task"
|
||||
"github.com/samcharles93/archie-core/internal/events"
|
||||
"github.com/samcharles93/archie-core/internal/taskstate"
|
||||
)
|
||||
|
||||
@@ -231,6 +232,11 @@ func runAttempts(ctx context.Context, tc *TaskContext, name string, attempts int
|
||||
return err
|
||||
}
|
||||
tc.Log.Warn("step failed; retrying", "step", name, "attempt", attempt, "of", attempts, "err", err)
|
||||
if emitErr := tc.EmitDurable(ctx, events.KindStepRetried, name,
|
||||
fmt.Sprintf("attempt %d of %d failed: %v", attempt, attempts, err),
|
||||
map[string]any{"attempt": attempt, "of": attempts, "error": err.Error()}); emitErr != nil {
|
||||
tc.Log.Warn("step retry not recorded", "step", name, "err", emitErr)
|
||||
}
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return err
|
||||
|
||||
@@ -49,13 +49,16 @@ const (
|
||||
// KindTaskRetried records what the retry was escaping from. RetryTask
|
||||
// clears stage and park_reason in the same statement that increments the
|
||||
// count, so this event is the only place that context survives.
|
||||
KindTaskRetried = "task_retried" // data: retry_count, previous_stage, previous_reason
|
||||
KindTaskCancelled = "task_cancelled"
|
||||
KindTaskStopped = "task_stopped"
|
||||
KindTaskAbandoned = "task_abandoned"
|
||||
KindTaskRetried = "task_retried" // data: retry_count, previous_stage, previous_reason
|
||||
KindTaskCancelled = "task_cancelled"
|
||||
KindTaskStopped = "task_stopped"
|
||||
KindTaskAbandoned = "task_abandoned"
|
||||
// KindStepRetried records one failed attempt of a step that is retried.
|
||||
// data: attempt, of, error.
|
||||
KindStepRetried = "step_retried"
|
||||
// KindTaskWithdrawn records work declined because its issue was closed,
|
||||
// unlabelled or unassigned. data: reason.
|
||||
KindTaskWithdrawn = "task_withdrawn"
|
||||
KindTaskWithdrawn = "task_withdrawn"
|
||||
KindTaskArchiveRequested = "task_archive_requested"
|
||||
KindWorkRequestSubmitted = "work_request_submitted"
|
||||
KindLog = "log" // data: level, msg
|
||||
|
||||
Reference in new issue
Block a user