mirror of
https://github.com/hatchet-dev/hatchet.git
synced 2025-12-30 05:09:44 -06:00
This PR adds support for retrying failed step runs against the engine and SDKs. This was tested up to 30 retries per step run, with both failure and success at the 30th step run. Each SDK now has a `retries` configurable param for steps when declaring a workflow.
177 lines
6.1 KiB
Protocol Buffer
177 lines
6.1 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
option go_package = "github.com/hatchet-dev/hatchet/internal/services/admin/contracts";
|
|
|
|
import "google/protobuf/timestamp.proto";
|
|
import "google/protobuf/wrappers.proto"; // For optional fields
|
|
|
|
// WorkflowService represents a set of RPCs for managing workflows.
|
|
service WorkflowService {
|
|
rpc ListWorkflows(ListWorkflowsRequest) returns (ListWorkflowsResponse);
|
|
rpc PutWorkflow(PutWorkflowRequest) returns (WorkflowVersion);
|
|
rpc ScheduleWorkflow(ScheduleWorkflowRequest) returns (WorkflowVersion);
|
|
rpc TriggerWorkflow(TriggerWorkflowRequest) returns (TriggerWorkflowResponse);
|
|
rpc GetWorkflowByName(GetWorkflowByNameRequest) returns (Workflow);
|
|
rpc ListWorkflowsForEvent(ListWorkflowsForEventRequest) returns (ListWorkflowsResponse);
|
|
rpc DeleteWorkflow(DeleteWorkflowRequest) returns (Workflow);
|
|
}
|
|
|
|
message PutWorkflowRequest {
|
|
CreateWorkflowVersionOpts opts = 1;
|
|
}
|
|
|
|
// CreateWorkflowVersionOpts represents options to create a workflow version.
|
|
message CreateWorkflowVersionOpts {
|
|
string name = 1; // (required) the workflow name
|
|
string description = 2; // (optional) the workflow description
|
|
string version = 3; // (required) the workflow version
|
|
repeated string event_triggers = 4; // (optional) event triggers for the workflow
|
|
repeated string cron_triggers = 5; // (optional) cron triggers for the workflow
|
|
repeated google.protobuf.Timestamp scheduled_triggers = 6; // (optional) scheduled triggers for the workflow
|
|
repeated CreateWorkflowJobOpts jobs = 7; // (required) the workflow jobs
|
|
WorkflowConcurrencyOpts concurrency = 8; // (optional) the workflow concurrency options
|
|
}
|
|
|
|
enum ConcurrencyLimitStrategy {
|
|
CANCEL_IN_PROGRESS = 0;
|
|
DROP_NEWEST = 1;
|
|
QUEUE_NEWEST = 2;
|
|
}
|
|
|
|
message WorkflowConcurrencyOpts {
|
|
string action = 1; // (required) the action id for getting the concurrency group
|
|
int32 max_runs = 2; // (optional) the maximum number of concurrent workflow runs, default 1
|
|
ConcurrencyLimitStrategy limit_strategy = 3; // (optional) the strategy to use when the concurrency limit is reached, default CANCEL_IN_PROGRESS
|
|
}
|
|
|
|
// CreateWorkflowJobOpts represents options to create a workflow job.
|
|
message CreateWorkflowJobOpts {
|
|
string name = 1; // (required) the job name
|
|
string description = 2; // (optional) the job description
|
|
string timeout = 3; // (optional) the job timeout
|
|
repeated CreateWorkflowStepOpts steps = 4; // (required) the job steps
|
|
}
|
|
|
|
// CreateWorkflowStepOpts represents options to create a workflow step.
|
|
message CreateWorkflowStepOpts {
|
|
string readable_id = 1; // (required) the step name
|
|
string action = 2; // (required) the step action id
|
|
string timeout = 3; // (optional) the step timeout
|
|
string inputs = 4; // (optional) the step inputs, assuming string representation of JSON
|
|
repeated string parents = 5; // (optional) the step parents. if none are passed in, this is a root step
|
|
string user_data = 6; // (optional) the custom step user data, assuming string representation of JSON
|
|
int32 retries = 7; // (optional) the number of retries for the step, default 0
|
|
}
|
|
|
|
// ListWorkflowsRequest is the request for ListWorkflows.
|
|
message ListWorkflowsRequest {}
|
|
|
|
message ScheduleWorkflowRequest {
|
|
string workflow_id = 1;
|
|
repeated google.protobuf.Timestamp schedules = 2;
|
|
|
|
// (optional) the input data for the workflow
|
|
string input = 3;
|
|
}
|
|
|
|
// ListWorkflowsResponse is the response for ListWorkflows.
|
|
message ListWorkflowsResponse {
|
|
repeated Workflow workflows = 1;
|
|
}
|
|
|
|
// ListWorkflowsForEventRequest is the request for ListWorkflowsForEvent.
|
|
message ListWorkflowsForEventRequest {
|
|
string event_key = 1;
|
|
}
|
|
|
|
// Workflow represents the Workflow model.
|
|
message Workflow {
|
|
string id = 1;
|
|
google.protobuf.Timestamp created_at = 2;
|
|
google.protobuf.Timestamp updated_at = 3;
|
|
string tenant_id = 5;
|
|
string name = 6;
|
|
google.protobuf.StringValue description = 7; // Optional
|
|
repeated WorkflowVersion versions = 8;
|
|
}
|
|
|
|
// WorkflowVersion represents the WorkflowVersion model.
|
|
message WorkflowVersion {
|
|
string id = 1;
|
|
google.protobuf.Timestamp created_at = 2;
|
|
google.protobuf.Timestamp updated_at = 3;
|
|
string version = 5;
|
|
int32 order = 6;
|
|
string workflow_id = 7;
|
|
WorkflowTriggers triggers = 8;
|
|
repeated Job jobs = 9;
|
|
}
|
|
|
|
// WorkflowTriggers represents the WorkflowTriggers model.
|
|
message WorkflowTriggers {
|
|
string id = 1;
|
|
google.protobuf.Timestamp created_at = 2;
|
|
google.protobuf.Timestamp updated_at = 3;
|
|
string workflow_version_id = 5;
|
|
string tenant_id = 6;
|
|
repeated WorkflowTriggerEventRef events = 7;
|
|
repeated WorkflowTriggerCronRef crons = 8;
|
|
}
|
|
|
|
// WorkflowTriggerEventRef represents the WorkflowTriggerEventRef model.
|
|
message WorkflowTriggerEventRef {
|
|
string parent_id = 1;
|
|
string event_key = 2;
|
|
}
|
|
|
|
// WorkflowTriggerCronRef represents the WorkflowTriggerCronRef model.
|
|
message WorkflowTriggerCronRef {
|
|
string parent_id = 1;
|
|
string cron = 2;
|
|
}
|
|
|
|
// Job represents the Job model.
|
|
message Job {
|
|
string id = 1;
|
|
google.protobuf.Timestamp created_at = 2;
|
|
google.protobuf.Timestamp updated_at = 3;
|
|
string tenant_id = 5;
|
|
string workflow_version_id = 6;
|
|
string name = 7;
|
|
google.protobuf.StringValue description = 8; // Optional
|
|
repeated Step steps = 9;
|
|
google.protobuf.StringValue timeout = 10; // Optional
|
|
}
|
|
|
|
// Step represents the Step model.
|
|
message Step {
|
|
string id = 1;
|
|
google.protobuf.Timestamp created_at = 2;
|
|
google.protobuf.Timestamp updated_at = 3;
|
|
google.protobuf.StringValue readable_id = 5; // Optional
|
|
string tenant_id = 6;
|
|
string job_id = 7;
|
|
string action = 8;
|
|
google.protobuf.StringValue timeout = 9; // Optional
|
|
repeated string parents = 10;
|
|
repeated string children = 11;
|
|
}
|
|
|
|
message DeleteWorkflowRequest {
|
|
string workflow_id = 1;
|
|
}
|
|
|
|
message GetWorkflowByNameRequest {
|
|
string name = 1;
|
|
}
|
|
|
|
message TriggerWorkflowRequest {
|
|
string name = 1;
|
|
|
|
// (optional) the input data for the workflow
|
|
string input = 2;
|
|
}
|
|
|
|
message TriggerWorkflowResponse {
|
|
string workflow_run_id = 1;
|
|
} |