FailRun marks one starting or running task run as failed and reconciles task state.
( ctx context.Context, runID string, failure RunFailure, actor ActorContext, )
| 2152 | |
| 2153 | // FailRun marks one starting or running task run as failed and reconciles task state. |
| 2154 | func (m *Service) FailRun( |
| 2155 | ctx context.Context, |
| 2156 | runID string, |
| 2157 | failure RunFailure, |
| 2158 | actor ActorContext, |
| 2159 | ) (*Run, error) { |
| 2160 | if err := requireWriteAuthority(actor); err != nil { |
| 2161 | return nil, err |
| 2162 | } |
| 2163 | |
| 2164 | normalizedFailure, err := normalizeRunFailure(failure) |
| 2165 | if err != nil { |
| 2166 | return nil, err |
| 2167 | } |
| 2168 | |
| 2169 | run, taskRecord, err := m.loadRunWithTask(ctx, runID) |
| 2170 | if err != nil { |
| 2171 | return nil, err |
| 2172 | } |
| 2173 | if strings.TrimSpace(run.ClaimTokenHash) != "" { |
| 2174 | return nil, fmt.Errorf("%w: task run %q requires token-fenced failure", ErrInvalidClaimToken, run.ID) |
| 2175 | } |
| 2176 | return m.failRunRecord(ctx, taskRecord, run, normalizedFailure, actor) |
| 2177 | } |
| 2178 | |
| 2179 | // CancelRun cancels one non-terminal task run under manager authority. |
| 2180 | func (m *Service) CancelRun( |
nothing calls this directly
no test coverage detected