feat(staterpc,daemon): park classification on the wire and at the park sites

Domain fields ParkClass/RemediationRounds landed in fe2a8e6d; this is
the wire and daemon half. Task gains park_class (32) and
remediation_rounds (33) and maps both directions; the classified park
write crosses the wire as ParkTask on a narrow TaskParker contract
(TaskLifecycle stays under the 8-method cap), with conformance
coverage local + grpc including the stale-guard sentinel and
needs_human normalization. Every daemon park site now states its
class: terminal for a repo that left config and a retired identity,
transient for the environmental parks (worktree, storage, grants,
taskrun), and identityMayAct returns the class beside its reason.
This commit is contained in:
sam committed 2026-09-23 13:18:08 +10:00
1 parent 914adb2343
commit 689833a01d
10 files changed
+833 -598

No files matched your search

File diff suppressed because it is too large. Load diff
@@ -37,6 +37,7 @@ const (
StateStoreService_Transition_FullMethodName = "/state.v1.StateStoreService/Transition"
StateStoreService_Update_FullMethodName = "/state.v1.StateStoreService/Update"
StateStoreService_Requeue_FullMethodName = "/state.v1.StateStoreService/Requeue"
StateStoreService_ParkTask_FullMethodName = "/state.v1.StateStoreService/ParkTask"
StateStoreService_RecoverStale_FullMethodName = "/state.v1.StateStoreService/RecoverStale"
StateStoreService_ArchiveTask_FullMethodName = "/state.v1.StateStoreService/ArchiveTask"
StateStoreService_RetryTask_FullMethodName = "/state.v1.StateStoreService/RetryTask"
@@ -123,6 +124,7 @@ type StateStoreServiceClient interface {
Transition(ctx context.Context, in *TransitionRequest, opts ...grpc.CallOption) (*TransitionResponse, error)
Update(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*UpdateResponse, error)
Requeue(ctx context.Context, in *RequeueRequest, opts ...grpc.CallOption) (*RequeueResponse, error)
ParkTask(ctx context.Context, in *ParkTaskRequest, opts ...grpc.CallOption) (*ParkTaskResponse, error)
RecoverStale(ctx context.Context, in *RecoverStaleRequest, opts ...grpc.CallOption) (*RecoverStaleResponse, error)
// Archive / Retry
ArchiveTask(ctx context.Context, in *ArchiveTaskRequest, opts ...grpc.CallOption) (*ArchiveTaskResponse, error)
@@ -408,6 +410,16 @@ func (c *stateStoreServiceClient) Requeue(ctx context.Context, in *RequeueReques
return out, nil
}
func (c *stateStoreServiceClient) ParkTask(ctx context.Context, in *ParkTaskRequest, opts ...grpc.CallOption) (*ParkTaskResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ParkTaskResponse)
err := c.cc.Invoke(ctx, StateStoreService_ParkTask_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *stateStoreServiceClient) RecoverStale(ctx context.Context, in *RecoverStaleRequest, opts ...grpc.CallOption) (*RecoverStaleResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(RecoverStaleResponse)
@@ -953,6 +965,7 @@ type StateStoreServiceServer interface {
Transition(context.Context, *TransitionRequest) (*TransitionResponse, error)
Update(context.Context, *UpdateRequest) (*UpdateResponse, error)
Requeue(context.Context, *RequeueRequest) (*RequeueResponse, error)
ParkTask(context.Context, *ParkTaskRequest) (*ParkTaskResponse, error)
RecoverStale(context.Context, *RecoverStaleRequest) (*RecoverStaleResponse, error)
// Archive / Retry
ArchiveTask(context.Context, *ArchiveTaskRequest) (*ArchiveTaskResponse, error)
@@ -1112,6 +1125,9 @@ func (UnimplementedStateStoreServiceServer) Update(context.Context, *UpdateReque
func (UnimplementedStateStoreServiceServer) Requeue(context.Context, *RequeueRequest) (*RequeueResponse, error) {
return nil, status.Error(codes.Unimplemented, "method Requeue not implemented")
}
func (UnimplementedStateStoreServiceServer) ParkTask(context.Context, *ParkTaskRequest) (*ParkTaskResponse, error) {
return nil, status.Error(codes.Unimplemented, "method ParkTask not implemented")
}
func (UnimplementedStateStoreServiceServer) RecoverStale(context.Context, *RecoverStaleRequest) (*RecoverStaleResponse, error) {
return nil, status.Error(codes.Unimplemented, "method RecoverStale not implemented")
}
@@ -1601,6 +1617,24 @@ func _StateStoreService_Requeue_Handler(srv interface{}, ctx context.Context, de
return interceptor(ctx, in, info, handler)
}
func _StateStoreService_ParkTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ParkTaskRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(StateStoreServiceServer).ParkTask(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: StateStoreService_ParkTask_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(StateStoreServiceServer).ParkTask(ctx, req.(*ParkTaskRequest))
}
return interceptor(ctx, in, info, handler)
}
func _StateStoreService_RecoverStale_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RecoverStaleRequest)
if err := dec(in); err != nil {
@@ -2523,6 +2557,10 @@ var StateStoreService_ServiceDesc = grpc.ServiceDesc{
MethodName: "Requeue",
Handler: _StateStoreService_Requeue_Handler,
},
{
MethodName: "ParkTask",
Handler: _StateStoreService_ParkTask_Handler,
},
{
MethodName: "RecoverStale",
Handler: _StateStoreService_RecoverStale_Handler,
+56 -48
View File
@@ -35,6 +35,7 @@ import (
"github.com/samcharles93/archie-core/internal/plugin"
"github.com/samcharles93/archie-core/internal/storage"
"github.com/samcharles93/archie-core/internal/taskrun"
"github.com/samcharles93/archie-core/internal/taskstate"
"github.com/samcharles93/archie-core/internal/tools"
"github.com/samcharles93/archie-core/internal/worktree"
)
@@ -1046,7 +1047,7 @@ func (d *Daemon) processNATSTask(ctx context.Context, msg eventbus.Message) {
return
}
if ok, reason := d.identityMayAct(ctx, tm.Identity); !ok {
if ok, reason, _ := d.identityMayAct(ctx, tm.Identity); !ok {
d.Log.Error("nats intake rejected: "+reason, "subject", msg.Subject())
if err := msg.Ack(); err != nil {
d.Log.Warn("ack failed", "err", err)
@@ -1193,36 +1194,11 @@ func (d *Daemon) process(ctx context.Context, task *workflow.Task) {
trees := d.treesFor(task)
repo, ok := d.repoFor(task)
if !ok {
d.parkRunningTask(ctx, task.ID, "repo no longer in config")
d.parkRunningTask(ctx, task.ID, "repo no longer in config", taskstate.ParkTerminal)
return
}
if d.ContainerPool == nil {
const reason = "managed agent container pool is unavailable; refusing to run this task on the host"
d.Log.Error("task parked: managed worker unavailable", "task", task.ID,
"hint", "enable containers and make the archie-agent image available, then retry the task")
if err := d.Store.Transition(ctx, task.ID, workflow.StatusRunning, workflow.StatusParked, reason); err != nil {
d.Log.Warn("managed worker park transition failed", "task", task.ID, "err", err)
return
}
d.recordPark(ctx, task.ID, reason)
d.emit(events.Event{
Kind: events.KindParked, TaskID: task.ID, Attempt: task.Attempt,
Repo: repo.FullName(), Issue: task.IssueNumber, Detail: reason,
})
return
}
if d.Tasks == nil {
const reason = "agent task transport is unavailable; refusing to run this task on the host"
d.Log.Error("task parked: agent task transport unavailable", "task", task.ID)
if err := d.Store.Transition(ctx, task.ID, workflow.StatusRunning, workflow.StatusParked, reason); err != nil {
d.Log.Warn("agent task transport park transition failed", "task", task.ID, "err", err)
return
}
d.recordPark(ctx, task.ID, reason)
d.emit(events.Event{
Kind: events.KindParked, TaskID: task.ID, Attempt: task.Attempt,
Repo: repo.FullName(), Issue: task.IssueNumber, Detail: reason,
})
if d.ContainerPool == nil || d.Tasks == nil {
d.parkCapabilityUnavailable(ctx, task, repo)
return
}
@@ -1242,7 +1218,7 @@ func (d *Daemon) process(ctx context.Context, task *workflow.Task) {
_, branch, err = trees.Prepare(ctx, task.Owner, task.Repo, repo.BaseBranch(), task.IssueNumber, task.Title, task.Body, task.Labels)
if err != nil {
d.Log.Error("worktree prepare failed", "err", err)
d.parkRunningTask(ctx, task.ID, "worktree prepare failed: "+err.Error())
d.parkRunningTask(ctx, task.ID, "worktree prepare failed: "+err.Error(), taskstate.ParkTransient)
return
}
task.Branch = branch
@@ -1336,7 +1312,7 @@ func (d *Daemon) acquireTaskContainer(
) (*container.Container, func(), bool) {
park := func(reason string, err error) {
d.Log.Error(reason, "err", err)
d.parkRunningTask(ctx, task.ID, reason+": "+err.Error())
d.parkRunningTask(ctx, task.ID, reason+": "+err.Error(), taskstate.ParkTransient)
}
// Write task.json -- the container's boot-time brief.
@@ -1354,7 +1330,7 @@ func (d *Daemon) acquireTaskContainer(
// normal operation, Storage is always set when ContainerPool is set.
if d.Storage == nil {
d.Log.Error("storage backend is nil -- cannot acquire container")
d.parkRunningTask(ctx, task.ID, "storage backend not configured")
d.parkRunningTask(ctx, task.ID, "storage backend not configured", taskstate.ParkTransient)
return nil, nil, false
}
@@ -1407,9 +1383,38 @@ func (d *Daemon) acquireTaskContainer(
return ctr, revokeStateStoreGrant, true
}
// parkCapabilityUnavailable parks a task whose daemon-side capability is
// missing (container pool or task transport): both are environmental, so
// the park class is transient and the KindParked event carries the class
// for the dashboard. The reason distinguishes the two in logs and events.
func (d *Daemon) parkCapabilityUnavailable(ctx context.Context, task *workflow.Task, repo config.Repo) {
var reason string
if d.ContainerPool == nil {
reason = "managed agent container pool is unavailable; refusing to run this task on the host"
d.Log.Error("task parked: managed worker unavailable", "task", task.ID,
"hint", "enable containers and make the archie-agent image available, then retry the task")
} else {
reason = "agent task transport is unavailable; refusing to run this task on the host"
d.Log.Error("task parked: agent task transport unavailable", "task", task.ID)
}
if err := d.Store.ParkTask(ctx, task.ID, workflow.StatusRunning, reason, taskstate.ParkTransient); err != nil {
d.Log.Warn("capability park transition failed", "task", task.ID, "err", err)
return
}
d.recordPark(ctx, task.ID, reason)
d.emit(events.Event{
Kind: events.KindParked, TaskID: task.ID, Attempt: task.Attempt,
Repo: repo.FullName(), Issue: task.IssueNumber, Detail: reason,
Data: map[string]any{"park_class": taskstate.ParkTransient},
})
}
// parkRunningTask transitions a task from running to parked using a context
// detached from caller cancellation, with a bounded timeout.
//
// The park carries the caller's taskstate.ParkClass: every call site states
// what kind of intervention its park needs, and the store normalizes the
// class, so an unclassified caller cannot silently mislabel a park.
// When a task fails or is cancelled (e.g. via /stop or dashboard Stop), ctx is
// already cancelled. Writing terminal state using the cancelled ctx fails
// immediately in SQLite transactions and silently leaves the task row 'running'
@@ -1420,14 +1425,14 @@ func (d *Daemon) acquireTaskContainer(
// The transition remains guarded from StatusRunning: if the worker already
// recorded a terminal state over storerpc, storecontract.ErrStaleTransition is returned
// and ignored. Unexpected store errors are logged as warnings.
func (d *Daemon) parkRunningTask(ctx context.Context, taskID int64, reason string) {
func (d *Daemon) parkRunningTask(ctx context.Context, taskID int64, reason string, class taskstate.ParkClass) {
if d.Store == nil {
return
}
writeCtx, cancel := context.WithTimeout(context.WithoutCancel(ctx), 10*time.Second)
defer cancel()
if err := d.Store.Transition(writeCtx, taskID, workflow.StatusRunning, workflow.StatusParked, reason); err != nil {
if err := d.Store.ParkTask(writeCtx, taskID, workflow.StatusRunning, reason, class); err != nil {
if !errors.Is(err, storecontract.ErrStaleTransition) {
d.Log.Warn("terminal park transition failed", "task", taskID, "reason", reason, "err", err)
}
@@ -1474,13 +1479,13 @@ func (d *Daemon) runViaAgent(ctx context.Context, task *workflow.Task, repo conf
if d.WorktreeGrants == nil {
const reason = "worktree publication grants are unavailable"
d.Log.Error(reason, "task", task.ID)
d.parkRunningTask(ctx, task.ID, reason)
d.parkRunningTask(ctx, task.ID, reason, taskstate.ParkTransient)
return
}
grant, revoke, err := d.WorktreeGrants.Issue(task)
if err != nil {
d.Log.Error("worktree publication grant failed", "task", task.ID, "err", err)
d.parkRunningTask(ctx, task.ID, "worktree publication grant failed: "+err.Error())
d.parkRunningTask(ctx, task.ID, "worktree publication grant failed: "+err.Error(), taskstate.ParkTransient)
return
}
defer revoke()
@@ -1489,7 +1494,7 @@ func (d *Daemon) runViaAgent(ctx context.Context, task *workflow.Task, repo conf
d.captureAttemptConfig(ctx, task, taskCfg)
if err := d.pinWorkflowDefinition(ctx, task); err != nil {
d.Log.Error("pin workflow definition failed", "task", task.ID, "err", err)
d.parkRunningTask(ctx, task.ID, "pin workflow definition: "+err.Error())
d.parkRunningTask(ctx, task.ID, "pin workflow definition: "+err.Error(), taskstate.ParkTransient)
return
}
req := taskrun.Request{
@@ -1506,26 +1511,26 @@ func (d *Daemon) runViaAgent(ctx context.Context, task *workflow.Task, repo conf
data, err := json.Marshal(req)
if err != nil {
d.Log.Error("taskrun encode failed", "task", task.ID, "err", err)
d.parkRunningTask(ctx, task.ID, "taskrun encode failed: "+err.Error())
d.parkRunningTask(ctx, task.ID, "taskrun encode failed: "+err.Error(), taskstate.ParkTransient)
return
}
reply, err := d.requestTaskRun(ctx, task.ID, data)
if err != nil {
d.Log.Error("taskrun request failed", "task", task.ID, "err", err)
d.parkRunningTask(ctx, task.ID, "taskrun request failed: "+err.Error())
d.parkRunningTask(ctx, task.ID, "taskrun request failed: "+err.Error(), taskstate.ParkTransient)
return
}
var resp taskrun.Response
if err := json.Unmarshal(reply, &resp); err != nil {
d.Log.Error("taskrun decode response failed", "task", task.ID, "err", err)
d.parkRunningTask(ctx, task.ID, "taskrun decode response failed: "+err.Error())
d.parkRunningTask(ctx, task.ID, "taskrun decode response failed: "+err.Error(), taskstate.ParkTransient)
return
}
if resp.Error != "" {
d.Log.Error("taskrun run failed", "task", task.ID, "err", resp.Error)
d.parkRunningTask(ctx, task.ID, "taskrun run failed: "+resp.Error)
d.parkRunningTask(ctx, task.ID, "taskrun run failed: "+resp.Error, taskstate.ParkTransient)
return
}
@@ -1835,6 +1840,9 @@ func (d *Daemon) identityFor(task *workflow.Task) *IdentityRunner {
}
// identityMayAct reports whether the identity a task carries may be acted on.
// A denial also carries the park class the task would need: a name that no
// longer resolves is fixable by re-adding the identity (transient), while a
// retired or deactivated identity is a deliberate operator state (terminal).
// An empty identity is the single-identity root and always may act. A
// non-empty identity must resolve to a configured runner and pass the
// lifecycle check; otherwise the returned reason says why it may not. This is
@@ -1842,29 +1850,29 @@ func (d *Daemon) identityFor(task *workflow.Task) *IdentityRunner {
// credential-side behaviour: a task naming an identity archie no longer knows
// -- renamed, retired, or deleted in the control plane -- must park, never
// fall back to the root forge's credential.
func (d *Daemon) identityMayAct(ctx context.Context, name string) (bool, string) {
func (d *Daemon) identityMayAct(ctx context.Context, name string) (bool, string, taskstate.ParkClass) {
if name == "" {
return true, ""
return true, "", ""
}
runner := d.identityFor(&workflow.Task{Identity: name})
if runner == nil {
return false, "identity " + name + " no longer resolves"
return false, "identity " + name + " no longer resolves", taskstate.ParkTransient
}
if !d.identityActive(ctx, runner.ID) {
return false, "identity " + runner.Name + " may not act"
return false, "identity " + runner.Name + " may not act", taskstate.ParkTerminal
}
return true, ""
return true, "", ""
}
// parkIfIdentityUnresolvable parks task when its non-empty identity cannot be
// acted on, reporting whether it did. An empty identity is the root
// single-identity path and never parks here.
func (d *Daemon) parkIfIdentityUnresolvable(ctx context.Context, task *workflow.Task) bool {
ok, reason := d.identityMayAct(ctx, task.Identity)
ok, reason, class := d.identityMayAct(ctx, task.Identity)
if ok {
return false
}
d.parkRunningTask(ctx, task.ID, reason)
d.parkRunningTask(ctx, task.ID, reason, class)
return true
}
+3 -2
View File
@@ -32,6 +32,7 @@ import (
"github.com/samcharles93/archie-core/internal/storage"
"github.com/samcharles93/archie-core/internal/store"
"github.com/samcharles93/archie-core/internal/taskrun"
"github.com/samcharles93/archie-core/internal/taskstate"
"github.com/samcharles93/archie-core/internal/worktree"
)
@@ -120,7 +121,7 @@ func TestParkRunningTaskRecordsItsReasonInTheTasksOwnLog(t *testing.T) {
defer closeLog()
const reason = "worktree prepare failed: checkout branch fix/42-x: reference not found"
d.parkRunningTask(ctx, task.ID, reason)
d.parkRunningTask(ctx, task.ID, reason, taskstate.ParkTransient)
page, err := d.TaskLogs.TaskLog(ctx, task.ID, task.Attempt, logging.Query{})
if err != nil {
@@ -166,7 +167,7 @@ func TestParkDoesNotRecordAParkThatLosesTheRace(t *testing.T) {
closeLog := d.openTaskLog(task)
defer closeLog()
d.parkRunningTask(ctx, task.ID, "worktree prepare failed: simulated")
d.parkRunningTask(ctx, task.ID, "worktree prepare failed: simulated", taskstate.ParkTransient)
page, err := d.TaskLogs.TaskLog(ctx, task.ID, task.Attempt, logging.Query{})
if err != nil {
+2 -1
View File
@@ -25,6 +25,7 @@ import (
"github.com/samcharles93/archie-core/internal/storage"
"github.com/samcharles93/archie-core/internal/store"
"github.com/samcharles93/archie-core/internal/taskrun"
"github.com/samcharles93/archie-core/internal/taskstate"
"github.com/samcharles93/archie-core/internal/worktree"
)
@@ -445,7 +446,7 @@ func TestParkRunningTaskGuardedAndLogging(t *testing.T) {
_ = s.Close()
}
d.parkRunningTask(callCtx, task.ID, "simulated park reason")
d.parkRunningTask(callCtx, task.ID, "simulated park reason", taskstate.ParkTransient)
logOutput := buf.String()
if tt.wantWarning {
@@ -32,6 +32,7 @@ import (
// Consumers depend on TaskStore, never on a concrete type.
type TaskStore interface {
TaskLifecycle
TaskParker
TaskEvents
TaskQueries
TaskArchiver
@@ -54,6 +55,16 @@ type TaskLifecycle interface {
RecoverStale(ctx context.Context) (int64, error)
}
// TaskParker is the classified park write, kept off TaskLifecycle so that
// interface stays under the repo's 8-method cap. It mirrors Transition with
// a park class attached (taskstate.ParkClass); the class is normalized
// store-side, so an empty or unknown value becomes needs_human rather than
// an error -- a park that predates classification must not fail because its
// caller did not know the vocabulary.
type TaskParker interface {
ParkTask(ctx context.Context, taskID int64, from, detail, class string) error
}
// TaskArchiver removes one terminal task's local record with an optimistic
// status guard. It is separate from the already broad lifecycle contract so
// consumers that only run tasks do not acquire an operator-only capability.
@@ -111,6 +111,11 @@ func (c *Client) Requeue(ctx context.Context, taskID int64, fromStatus, wf strin
return unmapError(err)
}
func (c *Client) ParkTask(ctx context.Context, taskID int64, from, detail, class string) error {
_, err := c.client.ParkTask(ctx, &pb.ParkTaskRequest{TaskId: taskID, From: from, Detail: detail, Class: class})
return unmapError(err)
}
func (c *Client) RecoverStale(ctx context.Context) (int64, error) {
r, err := c.client.RecoverStale(ctx, &pb.RecoverStaleRequest{})
if err != nil {
@@ -291,6 +291,46 @@ func TestStateStoreConformance(t *testing.T) {
if _, err := c.RecoverStale(ctx); err != nil {
t.Fatalf("RecoverStale: %v", err)
}
// Classified park: the guarded transition carries the park class,
// and both guards are the wire contract (the stale sentinel must
// survive the hop for the daemon's park-with-retry loop to detect
// a concurrent terminal write).
if err := c.Transition(ctx, claimed.ID, "queued", "running", "claimed"); err != nil {
t.Fatalf("re-claim for ParkTask: %v", err)
}
if err := c.ParkTask(ctx, claimed.ID, "running", "container pool unavailable", "transient"); err != nil {
t.Fatalf("ParkTask: %v", err)
}
parked, err := c.TaskByID(ctx, claimed.ID)
if err != nil || parked == nil {
t.Fatalf("TaskByID after ParkTask: %+v %v", parked, err)
}
if parked.Status != "parked" || parked.ParkClass != "transient" || parked.ParkReason != "container pool unavailable" {
t.Fatalf("ParkTask row = status:%q class:%q reason:%q", parked.Status, parked.ParkClass, parked.ParkReason)
}
if err := c.ParkTask(ctx, claimed.ID, "running", "late park", "transient"); !errors.Is(err, store.ErrStaleTransition) {
t.Fatalf("ParkTask stale = %v, want ErrStaleTransition", err)
}
// An unclassified park normalizes to needs_human store-side rather
// than failing: a caller that predates the class vocabulary must
// not be unable to park.
if err := c.Requeue(ctx, claimed.ID, "parked", ""); err != nil {
t.Fatalf("Requeue after park: %v", err)
}
if err := c.Transition(ctx, claimed.ID, "queued", "running", "claimed"); err != nil {
t.Fatalf("re-claim 2: %v", err)
}
if err := c.ParkTask(ctx, claimed.ID, "running", "unclassified park", ""); err != nil {
t.Fatalf("ParkTask unclassified: %v", err)
}
parked2, err := c.TaskByID(ctx, claimed.ID)
if err != nil || parked2 == nil {
t.Fatalf("TaskByID after unclassified park: %+v %v", parked2, err)
}
if parked2.ParkClass != "needs_human" {
t.Fatalf("unclassified park class = %q, want needs_human", parked2.ParkClass)
}
byClaim, err := c.ClaimByIssue(ctx, "acme", "widget", 999999)
if err != nil || byClaim != nil {
t.Fatalf("ClaimByIssue missing: %+v %v", byClaim, err)
@@ -177,6 +177,13 @@ func (s *server) Requeue(ctx context.Context, r *pb.RequeueRequest) (*pb.Requeue
return &pb.RequeueResponse{}, nil
}
func (s *server) ParkTask(ctx context.Context, r *pb.ParkTaskRequest) (*pb.ParkTaskResponse, error) {
if err := s.deps.Tasks.ParkTask(ctx, r.TaskId, r.From, r.Detail, r.Class); err != nil {
return nil, s.logErr("ParkTask", err)
}
return &pb.ParkTaskResponse{}, nil
}
func (s *server) RecoverStale(ctx context.Context, _ *pb.RecoverStaleRequest) (*pb.RecoverStaleResponse, error) {
n, err := s.deps.Tasks.RecoverStale(ctx)
if err != nil {
+9
View File
@@ -36,6 +36,7 @@ service StateStoreService {
rpc Transition(TransitionRequest) returns (TransitionResponse);
rpc Update(UpdateRequest) returns (UpdateResponse);
rpc Requeue(RequeueRequest) returns (RequeueResponse);
rpc ParkTask(ParkTaskRequest) returns (ParkTaskResponse);
rpc RecoverStale(RecoverStaleRequest) returns (RecoverStaleResponse);
// Archive / Retry
@@ -430,6 +431,14 @@ message RequeueRequest {
}
message RequeueResponse {}
message ParkTaskRequest {
int64 task_id = 1;
string from = 2;
string detail = 3;
string class = 4;
}
message ParkTaskResponse {}
message RecoverStaleRequest {}
message RecoverStaleResponse { int64 count = 1; }