Skip to content

Commit beeb06d

Browse files
committed
feat: add start_activity action to ScheduleAction and completion_callbacks to StartActivityExecutionRequest
Add ScheduleActivityAction message and start_activity variant to ScheduleAction oneof. Add activity result fields to ScheduleActionResult, activity_type to ScheduleListInfo, running_activities and ScheduleActivityExecution to ScheduleInfo. Add completion_callbacks field to StartActivityExecutionRequest for scheduler lifecycle tracking.
1 parent 1168863 commit beeb06d

2 files changed

Lines changed: 79 additions & 0 deletions

File tree

temporal/api/schedule/v1/message.proto

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import "google/protobuf/timestamp.proto";
2020
import "temporal/api/common/v1/message.proto";
2121
import "temporal/api/enums/v1/schedule.proto";
2222
import "temporal/api/enums/v1/workflow.proto";
23+
import "temporal/api/sdk/v1/user_metadata.proto";
24+
import "temporal/api/taskqueue/v1/message.proto";
2325
import "temporal/api/workflow/v1/message.proto";
2426

2527
// CalendarSpec describes an event specification relative to the calendar,
@@ -229,6 +231,54 @@ message SchedulePolicies {
229231
bool keep_original_workflow_id = 4;
230232
}
231233

234+
// ScheduleActivityAction describes a standalone activity to start on each schedule trigger.
235+
message ScheduleActivityAction {
236+
// The activity ID. May have a timestamp appended for uniqueness.
237+
string activity_id = 1;
238+
239+
// The type of the activity to execute.
240+
temporal.api.common.v1.ActivityType activity_type = 2;
241+
242+
// Task queue to schedule the activity on.
243+
temporal.api.taskqueue.v1.TaskQueue task_queue = 3;
244+
245+
// Serialized arguments to the activity.
246+
temporal.api.common.v1.Payloads input = 4;
247+
248+
// Timeout from schedule to close of the activity.
249+
// (-- api-linter: core::0140::prepositions=disabled
250+
// aip.dev/not-precedent: standard name of field --)
251+
google.protobuf.Duration schedule_to_close_timeout = 5;
252+
253+
// Timeout from schedule to start of the activity.
254+
// (-- api-linter: core::0140::prepositions=disabled
255+
// aip.dev/not-precedent: standard name of field --)
256+
google.protobuf.Duration schedule_to_start_timeout = 6;
257+
258+
// Timeout from start to close of the activity.
259+
// (-- api-linter: core::0140::prepositions=disabled
260+
// aip.dev/not-precedent: standard name of field --)
261+
google.protobuf.Duration start_to_close_timeout = 7;
262+
263+
// Heartbeat timeout.
264+
google.protobuf.Duration heartbeat_timeout = 8;
265+
266+
// Retry policy for the activity.
267+
temporal.api.common.v1.RetryPolicy retry_policy = 9;
268+
269+
// Request header for context propagation.
270+
temporal.api.common.v1.Header header = 10;
271+
272+
// Search attributes for the activity.
273+
temporal.api.common.v1.SearchAttributes search_attributes = 11;
274+
275+
// Metadata for display purposes.
276+
temporal.api.sdk.v1.UserMetadata user_metadata = 12;
277+
278+
// Priority metadata.
279+
temporal.api.common.v1.Priority priority = 13;
280+
}
281+
232282
message ScheduleAction {
233283
oneof action {
234284
// All fields of NewWorkflowExecutionInfo are valid except for:
@@ -237,6 +287,11 @@ message ScheduleAction {
237287
// The workflow id of the started workflow may not match this exactly,
238288
// it may have a timestamp appended for uniqueness.
239289
temporal.api.workflow.v1.NewWorkflowExecutionInfo start_workflow = 1;
290+
291+
// Start a standalone activity execution.
292+
// The activity id of the started activity may not match this exactly,
293+
// it may have a timestamp appended for uniqueness.
294+
ScheduleActivityAction start_activity = 2;
240295
}
241296
}
242297

@@ -253,6 +308,13 @@ message ScheduleActionResult {
253308
// If the action was start_workflow, this field will reflect an
254309
// eventually-consistent view of the started workflow's status.
255310
temporal.api.enums.v1.WorkflowExecutionStatus start_workflow_status = 12;
311+
312+
// If action was start_activity:
313+
string start_activity_result_activity_id = 21;
314+
string start_activity_result_run_id = 22;
315+
// Uses WorkflowExecutionStatus (not ActivityExecutionStatus) because the
316+
// status values are semantically identical and keeps completion handling uniform.
317+
temporal.api.enums.v1.WorkflowExecutionStatus start_activity_status = 23;
256318
}
257319

258320
message ScheduleState {
@@ -349,6 +411,16 @@ message ScheduleInfo {
349411

350412
// Deprecated.
351413
string invalid_schedule_error = 8 [deprecated = true];
414+
415+
// Currently-running activities started by this schedule (when action is start_activity).
416+
// Only populated for activity schedule actions.
417+
repeated ScheduleActivityExecution running_activities = 12;
418+
}
419+
420+
// Identifies a running activity started by a schedule.
421+
message ScheduleActivityExecution {
422+
string activity_id = 1;
423+
string run_id = 2;
352424
}
353425

354426
message Schedule {
@@ -370,6 +442,9 @@ message ScheduleListInfo {
370442
// well with JSON. If action is start_workflow, this is set:
371443
temporal.api.common.v1.WorkflowType workflow_type = 2;
372444

445+
// Set if the schedule action is start_activity.
446+
temporal.api.common.v1.ActivityType activity_type = 10;
447+
373448
// From state:
374449
string notes = 3;
375450
bool paused = 4;

temporal/api/workflowservice/v1/request_response.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2811,6 +2811,10 @@ message StartActivityExecutionRequest {
28112811
temporal.api.sdk.v1.UserMetadata user_metadata = 17;
28122812
// Priority metadata.
28132813
temporal.api.common.v1.Priority priority = 18;
2814+
2815+
// Callbacks to invoke on activity completion.
2816+
// Used internally by the scheduler to track activity lifecycle.
2817+
repeated temporal.api.common.v1.Callback completion_callbacks = 19;
28142818
}
28152819

28162820
message StartActivityExecutionResponse {

0 commit comments

Comments
 (0)