Skip to content

Commit e1e1c03

Browse files
committed
api for automatic timeskipping
1 parent 1168863 commit e1e1c03

6 files changed

Lines changed: 127 additions & 2 deletions

File tree

openapi/openapiv2.json

Lines changed: 42 additions & 2 deletions
Large diffs are not rendered by default.

openapi/openapiv3.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10157,6 +10157,7 @@ components:
1015710157
- EVENT_TYPE_NEXUS_OPERATION_CANCEL_REQUEST_FAILED
1015810158
- EVENT_TYPE_WORKFLOW_EXECUTION_PAUSED
1015910159
- EVENT_TYPE_WORKFLOW_EXECUTION_UNPAUSED
10160+
- EVENT_TYPE_WORKFLOW_EXECUTION_TIME_SKIPPED
1016010161
type: string
1016110162
format: enum
1016210163
version:
@@ -10315,6 +10316,8 @@ components:
1031510316
$ref: '#/components/schemas/WorkflowExecutionPausedEventAttributes'
1031610317
workflowExecutionUnpausedEventAttributes:
1031710318
$ref: '#/components/schemas/WorkflowExecutionUnpausedEventAttributes'
10319+
workflowExecutionTimeSkippedEventAttributes:
10320+
$ref: '#/components/schemas/WorkflowExecutionTimeSkippedEventAttributes'
1031810321
description: |-
1031910322
History events are the method by which Temporal SDKs advance (or recreate) workflow state.
1032010323
See the `EventType` enum for more info about what each event is for.
@@ -11067,6 +11070,8 @@ components:
1106711070
Calls are retried internally by the server.
1106811071
(-- api-linter: core::0140::prepositions=disabled
1106911072
aip.dev/not-precedent: "to" is used to indicate interval. --)
11073+
(-- api-linter: core::0142::time-field-names=disabled
11074+
aip.dev/not-precedent: "timeout" is an acceptable suffix for duration fields in this API. --)
1107011075
nexusHeader:
1107111076
type: object
1107211077
additionalProperties:
@@ -12258,6 +12263,7 @@ components:
1225812263
- EVENT_TYPE_NEXUS_OPERATION_CANCEL_REQUEST_FAILED
1225912264
- EVENT_TYPE_WORKFLOW_EXECUTION_PAUSED
1226012265
- EVENT_TYPE_WORKFLOW_EXECUTION_UNPAUSED
12266+
- EVENT_TYPE_WORKFLOW_EXECUTION_TIME_SKIPPED
1226112267
type: string
1226212268
description: The event type of the history event generated by the request.
1226312269
format: enum
@@ -13571,6 +13577,10 @@ components:
1357113577
allOf:
1357213578
- $ref: '#/components/schemas/Priority'
1357313579
description: Priority metadata
13580+
timeSkippingConfig:
13581+
allOf:
13582+
- $ref: '#/components/schemas/TimeSkippingConfig'
13583+
description: Time skipping configuration. If not set, automatic time-skipping is disabled.
1357413584
SignalWithStartWorkflowExecutionResponse:
1357513585
type: object
1357613586
properties:
@@ -14033,6 +14043,10 @@ components:
1403314043
allOf:
1403414044
- $ref: '#/components/schemas/WorkerDeploymentOptions'
1403514045
description: Deployment Options of the worker who will process the eager task. Passed when `request_eager_execution=true`.
14046+
timeSkippingConfig:
14047+
allOf:
14048+
- $ref: '#/components/schemas/TimeSkippingConfig'
14049+
description: Automatic time-skipping configuration. If not set, automatic time-skipping is disabled.
1403614050
StartWorkflowExecutionResponse:
1403714051
type: object
1403814052
properties:
@@ -14436,6 +14450,13 @@ components:
1443614450
TerminatedFailureInfo:
1443714451
type: object
1443814452
properties: {}
14453+
TimeSkippingConfig:
14454+
type: object
14455+
properties:
14456+
enabled:
14457+
type: boolean
14458+
description: "If set, enables automatic time-skipping for this workflow execution.\n It can also be disabled by setting this field to false.\n Special attention for transitively related workflows:\n - By default, Child workflows and Continue-As-New workflows will \n inherit the enabled config but only at the time they are started.\n - But if the enabled config is flipped after a child/continue-as-new workflow is started, \n the propagation won't happen. It not recommended flip the parent's enabled config\n when there are in-flight child/continue-as-new workflows."
14459+
description: "Configuration for automatic time skipping on a workflow execution.\n Once enabled, time automatically advances when there is no in-flight \n activities, child workflows, or Nexus operations."
1443914460
TimeoutFailureInfo:
1444014461
type: object
1444114462
properties:
@@ -15859,6 +15880,7 @@ components:
1585915880
- EVENT_TYPE_NEXUS_OPERATION_CANCEL_REQUEST_FAILED
1586015881
- EVENT_TYPE_WORKFLOW_EXECUTION_PAUSED
1586115882
- EVENT_TYPE_WORKFLOW_EXECUTION_UNPAUSED
15883+
- EVENT_TYPE_WORKFLOW_EXECUTION_TIME_SKIPPED
1586215884
type: string
1586315885
format: enum
1586415886
description: EventReference is a direct reference to a history event through the event ID.
@@ -15929,6 +15951,7 @@ components:
1592915951
- EVENT_TYPE_NEXUS_OPERATION_CANCEL_REQUEST_FAILED
1593015952
- EVENT_TYPE_WORKFLOW_EXECUTION_PAUSED
1593115953
- EVENT_TYPE_WORKFLOW_EXECUTION_UNPAUSED
15954+
- EVENT_TYPE_WORKFLOW_EXECUTION_TIME_SKIPPED
1593215955
type: string
1593315956
format: enum
1593415957
description: RequestIdReference is a indirect reference to a history event through the request ID.
@@ -16278,6 +16301,10 @@ components:
1627816301
allOf:
1627916302
- $ref: '#/components/schemas/Priority'
1628016303
description: If set, overrides the workflow's priority sent by the SDK.
16304+
timeSkippingConfig:
16305+
allOf:
16306+
- $ref: '#/components/schemas/TimeSkippingConfig'
16307+
description: "Time-skipping configuration for this workflow execution.\n If not set, the time-skipping conf will not get updated upon request, \n i.e. the existing time-skipping conf will be preserved."
1628116308
WorkflowExecutionOptionsUpdatedEventAttributes:
1628216309
type: object
1628316310
properties:
@@ -16309,6 +16336,10 @@ components:
1630916336
description: |-
1631016337
Priority override upserted in this event. Represents the full priority; not just partial fields.
1631116338
Ignored if nil.
16339+
timeSkippingConfig:
16340+
allOf:
16341+
- $ref: '#/components/schemas/TimeSkippingConfig'
16342+
description: "Time skipping configuration upserted in this event. \n It means the time-skipping config is changed, and the full latest config is upserted."
1631216343
WorkflowExecutionPauseInfo:
1631316344
type: object
1631416345
properties:
@@ -16614,6 +16645,18 @@ components:
1661416645
identity:
1661516646
type: string
1661616647
description: id of the client who requested termination
16648+
WorkflowExecutionTimeSkippedEventAttributes:
16649+
type: object
16650+
properties:
16651+
toTime:
16652+
type: string
16653+
description: |-
16654+
(-- api-linter: core::0140::prepositions=disabled
16655+
aip.dev/not-precedent: "to" is used to indicate target time point. --)
16656+
format: date-time
16657+
description: |-
16658+
Attributes for an event marking that a duration was skipped for a workflow execution,
16659+
either via manual time-skipping api call or automatic time-skipping.
1661716660
WorkflowExecutionTimedOutEventAttributes:
1661816661
type: object
1661916662
properties:

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 some duration 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,9 @@ 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+
// It means the time-skipping config is changed, and the full latest config is upserted.
878+
temporal.api.workflow.v1.TimeSkippingConfig time_skipping_config = 7;
876879
}
877880

878881
// Not used anywhere. Use case is replaced by WorkflowExecutionOptionsUpdatedEventAttributes
@@ -965,6 +968,14 @@ message WorkflowExecutionUnpausedEventAttributes {
965968
string request_id = 3;
966969
}
967970

971+
// Attributes for an event marking that a duration was skipped for a workflow execution,
972+
// either via manual time-skipping api call or automatic time-skipping.
973+
message WorkflowExecutionTimeSkippedEventAttributes {
974+
// (-- api-linter: core::0140::prepositions=disabled
975+
// aip.dev/not-precedent: "to" is used to indicate target time point. --)
976+
google.protobuf.Timestamp to_time = 1;
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: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,28 @@ 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 configuration for this workflow execution.
571+
// If not set, the time-skipping conf will not get updated upon request,
572+
// i.e. the existing time-skipping conf will be preserved.
573+
TimeSkippingConfig time_skipping_config = 3;
574+
}
575+
576+
// Configuration for automatic time skipping on a workflow execution.
577+
// Once enabled, time automatically advances when there is no in-flight
578+
// activities, child workflows, or Nexus operations.
579+
message TimeSkippingConfig {
580+
581+
// If set, enables automatic time-skipping for this workflow execution.
582+
// It can also be disabled by setting this field to false.
583+
// Special attention for transitively related workflows:
584+
// - By default, Child workflows and Continue-As-New workflows will
585+
// inherit the enabled config but only at the time they are started.
586+
// - But if the enabled config is flipped after a child/continue-as-new workflow is started,
587+
// the propagation won't happen. It not recommended flip the parent's enabled config
588+
// when there are in-flight child/continue-as-new workflows.
589+
bool enabled = 1;
590+
569591
}
570592

571593
// 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+
// Automatic time-skipping configuration. If not set, automatic time-skipping is disabled.
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 not set, automatic time-skipping is disabled.
842+
temporal.api.workflow.v1.TimeSkippingConfig time_skipping_config = 27;
839843
}
840844

841845
message SignalWithStartWorkflowExecutionResponse {

0 commit comments

Comments
 (0)