Skip to content

Commit

Permalink
Merge pull request dapr#8222 from JoshVanL/scheduler-api-failure-policy
Browse files Browse the repository at this point in the history
Scheduler: Expose FailurePolicy on internal API
  • Loading branch information
JoshVanL authored Oct 30, 2024
2 parents e286015 + c6f04f0 commit 284211f
Show file tree
Hide file tree
Showing 13 changed files with 1,371 additions and 203 deletions.
33 changes: 33 additions & 0 deletions dapr/proto/scheduler/v1/failurepolicy.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
syntax = "proto3";

package dapr.proto.scheduler.v1;

import "google/protobuf/duration.proto";

option go_package = "github.com/dapr/dapr/pkg/proto/scheduler/v1;scheduler";

// FailurePolicy defines the policy to apply when a job fails to trigger.
message FailurePolicy {
// policy is the policy to apply when a job fails to trigger.
oneof policy {
FailurePolicyDrop drop = 1;
FailurePolicyConstant constant = 2;
}
}

// FailurePolicyDrop is a policy which drops the job tick when the job fails to
// trigger.
message FailurePolicyDrop {}

// FailurePolicyConstant is a policy which retries the job at a consistent
// interval when the job fails to trigger.
message FailurePolicyConstant {
// interval is the constant delay to wait before retrying the job.
google.protobuf.Duration interval = 1;

// max_retries is the optional maximum number of retries to attempt before
// giving up.
// If unset, the Job will be retried indefinitely.
optional uint32 max_retries = 2;
}

8 changes: 8 additions & 0 deletions dapr/proto/scheduler/v1/scheduler.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ syntax = "proto3";

package dapr.proto.scheduler.v1;

import "dapr/proto/scheduler/v1/failurepolicy.proto";
import "google/protobuf/any.proto";

option go_package = "github.com/dapr/dapr/pkg/proto/scheduler/v1;scheduler";
Expand Down Expand Up @@ -35,6 +36,13 @@ message Job {

// Job data.
google.protobuf.Any data = 5;


// failure_policy is the optional policy to apply when a job fails to
// trigger.
// By default, the failure policy is FailurePolicyConstant with a 1s interval
// and 3 maximum retries.
optional FailurePolicy failure_policy = 6;
}

// TargetJob is the message used by the daprd sidecar to schedule a job
Expand Down
341 changes: 341 additions & 0 deletions pkg/proto/scheduler/v1/failurepolicy.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 284211f

Please sign in to comment.