Skip to content

Commit 3bb8805

Browse files
committed
POC automatic timeskipping
1 parent 1168863 commit 3bb8805

File tree

4 files changed

+34
-0
lines changed

4 files changed

+34
-0
lines changed

temporal/api/enums/v1/event_type.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,4 +173,6 @@ enum EventType {
173173
EVENT_TYPE_WORKFLOW_EXECUTION_PAUSED = 58;
174174
// An event that indicates that the previously paused workflow execution has been unpaused.
175175
EVENT_TYPE_WORKFLOW_EXECUTION_UNPAUSED = 59;
176+
// An event that indicates that a time point was skipped for this workflow execution.
177+
EVENT_TYPE_WORKFLOW_EXECUTION_TIME_SKIPPED = 60;
176178
}

temporal/api/history/v1/message.proto

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -873,6 +873,8 @@ message WorkflowExecutionOptionsUpdatedEventAttributes {
873873
// Priority override upserted in this event. Represents the full priority; not just partial fields.
874874
// Ignored if nil.
875875
temporal.api.common.v1.Priority priority = 6;
876+
// Time skipping configuration upserted in this event.
877+
temporal.api.workflow.v1.TimeSkippingConfig time_skipping_config = 7;
876878
}
877879

878880
// Not used anywhere. Use case is replaced by WorkflowExecutionOptionsUpdatedEventAttributes
@@ -965,6 +967,15 @@ message WorkflowExecutionUnpausedEventAttributes {
965967
string request_id = 3;
966968
}
967969

970+
// Attributes for an event marking that a duration was skipped for a workflow execution,
971+
// either via explicit api call or automatic time skipping.
972+
message WorkflowExecutionTimeSkippedEventAttributes {
973+
// (-- api-linter: core::0140::prepositions=disabled
974+
// aip.dev/not-precedent: "to" is used to indicate target time point. --)
975+
google.protobuf.Timestamp to_time = 1;
976+
google.protobuf.Duration skipped_duration = 2;
977+
}
978+
968979
// Event marking that an operation was scheduled by a workflow via the ScheduleNexusOperation command.
969980
message NexusOperationScheduledEventAttributes {
970981
// Endpoint name, must exist in the endpoint registry.
@@ -982,6 +993,8 @@ message NexusOperationScheduledEventAttributes {
982993
// Calls are retried internally by the server.
983994
// (-- api-linter: core::0140::prepositions=disabled
984995
// aip.dev/not-precedent: "to" is used to indicate interval. --)
996+
// (-- api-linter: core::0142::time-field-names=disabled
997+
// aip.dev/not-precedent: "timeout" is an acceptable suffix for duration fields in this API. --)
985998
google.protobuf.Duration schedule_to_close_timeout = 5;
986999
// Header to attach to the Nexus request. Note these headers are not the same as Temporal headers on internal
9871000
// activities and child workflows, these are transmitted to Nexus operations that may be external and are not
@@ -1199,6 +1212,7 @@ message HistoryEvent {
11991212
NexusOperationCancelRequestFailedEventAttributes nexus_operation_cancel_request_failed_event_attributes = 62;
12001213
WorkflowExecutionPausedEventAttributes workflow_execution_paused_event_attributes = 63;
12011214
WorkflowExecutionUnpausedEventAttributes workflow_execution_unpaused_event_attributes = 64;
1215+
WorkflowExecutionTimeSkippedEventAttributes workflow_execution_time_skipped_event_attributes = 65;
12021216
}
12031217
}
12041218

temporal/api/workflow/v1/message.proto

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,20 @@ message WorkflowExecutionOptions {
566566

567567
// If set, overrides the workflow's priority sent by the SDK.
568568
temporal.api.common.v1.Priority priority = 2;
569+
570+
// Time skipping opt-in configuration for this workflow execution.
571+
TimeSkippingConfig time_skipping_config = 3;
572+
}
573+
574+
// Configuration for automatic time skipping on a workflow execution.
575+
// Once enabled, time automatically advances when there is no in-flight
576+
// activity, child workflow, or Nexus operation.
577+
// Fine-grained control for time skipping is to be added later.
578+
message TimeSkippingConfig {
579+
580+
// If set, enables automatic time skipping for this workflow execution.
581+
// Can be disabled by setting this field to false.
582+
bool enabled = 1;
569583
}
570584

571585
// Used to override the versioning behavior (and pinned deployment version, if applicable) of a

temporal/api/workflowservice/v1/request_response.proto

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ message StartWorkflowExecutionRequest {
197197
temporal.api.common.v1.Priority priority = 27;
198198
// Deployment Options of the worker who will process the eager task. Passed when `request_eager_execution=true`.
199199
temporal.api.deployment.v1.WorkerDeploymentOptions eager_worker_deployment_options = 28;
200+
// Time skipping configuration. If set, enables time skipping for this workflow from the start.
201+
temporal.api.workflow.v1.TimeSkippingConfig time_skipping_config = 29;
200202
}
201203

202204
message StartWorkflowExecutionResponse {
@@ -836,6 +838,8 @@ message SignalWithStartWorkflowExecutionRequest {
836838
temporal.api.workflow.v1.VersioningOverride versioning_override = 25;
837839
// Priority metadata
838840
temporal.api.common.v1.Priority priority = 26;
841+
// Time skipping configuration. If set, enables time skipping for this workflow from the start.
842+
temporal.api.workflow.v1.TimeSkippingConfig time_skipping_config = 27;
839843
}
840844

841845
message SignalWithStartWorkflowExecutionResponse {

0 commit comments

Comments
 (0)