Skip to content

Commit 2232a25

Browse files
bergundyfretz12dandavison
authored
[Standalone Activity] More cleanup (#675)
**What changed?** - Removed all references to `ActivityOptions` - Add request_id to `TerminateActivityExecution` - Add `close_time` to `ActivityInfo` --------- Co-authored-by: Fred Tzeng <41805201+fretz12@users.noreply.github.com> Co-authored-by: Dan Davison <dandavison7@gmail.com>
1 parent 727283a commit 2232a25

File tree

4 files changed

+141
-30
lines changed

4 files changed

+141
-30
lines changed

openapi/openapiv2.json

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9764,13 +9764,17 @@
97649764
"type": "string",
97659765
"description": "Activity run ID, targets the latest run if run_id is empty."
97669766
},
9767-
"reason": {
9768-
"type": "string",
9769-
"description": "Reason for requesting the termination, recorded in in the activity's result failure outcome."
9770-
},
97719767
"identity": {
97729768
"type": "string",
97739769
"description": "The identity of the worker/client."
9770+
},
9771+
"requestId": {
9772+
"type": "string",
9773+
"description": "Used to de-dupe termination requests."
9774+
},
9775+
"reason": {
9776+
"type": "string",
9777+
"description": "Reason for requesting the termination, recorded in in the activity's result failure outcome."
97749778
}
97759779
}
97769780
},
@@ -10350,6 +10354,29 @@
1035010354
"$ref": "#/definitions/v1PendingActivityState",
1035110355
"description": "More detailed breakdown of ACTIVITY_EXECUTION_STATUS_RUNNING."
1035210356
},
10357+
"taskQueue": {
10358+
"$ref": "#/definitions/v1TaskQueue"
10359+
},
10360+
"scheduleToCloseTimeout": {
10361+
"type": "string",
10362+
"description": "Indicates how long the caller is willing to wait for an activity completion. Limits how long\nretries will be attempted.\n"
10363+
},
10364+
"scheduleToStartTimeout": {
10365+
"type": "string",
10366+
"description": "Limits time an activity task can stay in a task queue before a worker picks it up. This\ntimeout is always non retryable, as all a retry would achieve is to put it back into the same\nqueue. Defaults to `schedule_to_close_timeout`.\n"
10367+
},
10368+
"startToCloseTimeout": {
10369+
"type": "string",
10370+
"description": "Maximum time a single activity attempt is allowed to execute after being picked up by a worker. This\ntimeout is always retryable.\n"
10371+
},
10372+
"heartbeatTimeout": {
10373+
"type": "string",
10374+
"description": "Maximum permitted time between successful worker heartbeats."
10375+
},
10376+
"retryPolicy": {
10377+
"$ref": "#/definitions/v1RetryPolicy",
10378+
"description": "The retry policy for the activity. Will never exceed `schedule_to_close_timeout`."
10379+
},
1035310380
"heartbeatDetails": {
1035410381
"$ref": "#/definitions/v1Payloads",
1035510382
"description": "Details provided in the last recorded activity heartbeat."
@@ -10383,6 +10410,11 @@
1038310410
"format": "date-time",
1038410411
"description": "Scheduled time + schedule to close timeout."
1038510412
},
10413+
"closeTime": {
10414+
"type": "string",
10415+
"format": "date-time",
10416+
"description": "Time when the activity transitioned to a closed state."
10417+
},
1038610418
"lastFailure": {
1038710419
"$ref": "#/definitions/apifailurev1Failure",
1038810420
"description": "Failure details from the last failed attempt."

openapi/openapiv3.yaml

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7256,6 +7256,44 @@ components:
72567256
type: string
72577257
description: More detailed breakdown of ACTIVITY_EXECUTION_STATUS_RUNNING.
72587258
format: enum
7259+
taskQueue:
7260+
$ref: '#/components/schemas/TaskQueue'
7261+
scheduleToCloseTimeout:
7262+
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
7263+
type: string
7264+
description: |-
7265+
Indicates how long the caller is willing to wait for an activity completion. Limits how long
7266+
retries will be attempted.
7267+
7268+
(-- api-linter: core::0140::prepositions=disabled
7269+
aip.dev/not-precedent: "to" is used to indicate interval. --)
7270+
scheduleToStartTimeout:
7271+
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
7272+
type: string
7273+
description: |-
7274+
Limits time an activity task can stay in a task queue before a worker picks it up. This
7275+
timeout is always non retryable, as all a retry would achieve is to put it back into the same
7276+
queue. Defaults to `schedule_to_close_timeout`.
7277+
7278+
(-- api-linter: core::0140::prepositions=disabled
7279+
aip.dev/not-precedent: "to" is used to indicate interval. --)
7280+
startToCloseTimeout:
7281+
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
7282+
type: string
7283+
description: |-
7284+
Maximum time a single activity attempt is allowed to execute after being picked up by a worker. This
7285+
timeout is always retryable.
7286+
7287+
(-- api-linter: core::0140::prepositions=disabled
7288+
aip.dev/not-precedent: "to" is used to indicate interval. --)
7289+
heartbeatTimeout:
7290+
pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$
7291+
type: string
7292+
description: Maximum permitted time between successful worker heartbeats.
7293+
retryPolicy:
7294+
allOf:
7295+
- $ref: '#/components/schemas/RetryPolicy'
7296+
description: The retry policy for the activity. Will never exceed `schedule_to_close_timeout`.
72597297
heartbeatDetails:
72607298
allOf:
72617299
- $ref: '#/components/schemas/Payloads'
@@ -7286,6 +7324,10 @@ components:
72867324
type: string
72877325
description: Scheduled time + schedule to close timeout.
72887326
format: date-time
7327+
closeTime:
7328+
type: string
7329+
description: Time when the activity transitioned to a closed state.
7330+
format: date-time
72897331
lastFailure:
72907332
allOf:
72917333
- $ref: '#/components/schemas/Failure'
@@ -13748,12 +13790,15 @@ components:
1374813790
runId:
1374913791
type: string
1375013792
description: Activity run ID, targets the latest run if run_id is empty.
13751-
reason:
13752-
type: string
13753-
description: Reason for requesting the termination, recorded in in the activity's result failure outcome.
1375413793
identity:
1375513794
type: string
1375613795
description: The identity of the worker/client.
13796+
requestId:
13797+
type: string
13798+
description: Used to de-dupe termination requests.
13799+
reason:
13800+
type: string
13801+
description: Reason for requesting the termination, recorded in in the activity's result failure outcome.
1375713802
TerminateActivityExecutionResponse:
1375813803
type: object
1375913804
properties: {}

temporal/api/activity/v1/message.proto

Lines changed: 52 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -66,60 +66,92 @@ message ActivityExecutionInfo {
6666
temporal.api.enums.v1.ActivityExecutionStatus status = 4;
6767
// More detailed breakdown of ACTIVITY_EXECUTION_STATUS_RUNNING.
6868
temporal.api.enums.v1.PendingActivityState run_state = 5;
69+
70+
temporal.api.taskqueue.v1.TaskQueue task_queue = 6;
71+
72+
// Indicates how long the caller is willing to wait for an activity completion. Limits how long
73+
// retries will be attempted.
74+
//
75+
// (-- api-linter: core::0140::prepositions=disabled
76+
// aip.dev/not-precedent: "to" is used to indicate interval. --)
77+
google.protobuf.Duration schedule_to_close_timeout = 7;
78+
// Limits time an activity task can stay in a task queue before a worker picks it up. This
79+
// timeout is always non retryable, as all a retry would achieve is to put it back into the same
80+
// queue. Defaults to `schedule_to_close_timeout`.
81+
//
82+
// (-- api-linter: core::0140::prepositions=disabled
83+
// aip.dev/not-precedent: "to" is used to indicate interval. --)
84+
google.protobuf.Duration schedule_to_start_timeout = 8;
85+
// Maximum time a single activity attempt is allowed to execute after being picked up by a worker. This
86+
// timeout is always retryable.
87+
//
88+
// (-- api-linter: core::0140::prepositions=disabled
89+
// aip.dev/not-precedent: "to" is used to indicate interval. --)
90+
google.protobuf.Duration start_to_close_timeout = 9;
91+
92+
// Maximum permitted time between successful worker heartbeats.
93+
google.protobuf.Duration heartbeat_timeout = 10;
94+
95+
// The retry policy for the activity. Will never exceed `schedule_to_close_timeout`.
96+
temporal.api.common.v1.RetryPolicy retry_policy = 11;
97+
6998
// Details provided in the last recorded activity heartbeat.
70-
temporal.api.common.v1.Payloads heartbeat_details = 6;
99+
temporal.api.common.v1.Payloads heartbeat_details = 12;
71100
// Time the last heartbeat was recorded.
72-
google.protobuf.Timestamp last_heartbeat_time = 7;
101+
google.protobuf.Timestamp last_heartbeat_time = 13;
73102
// Time the last attempt was started.
74-
google.protobuf.Timestamp last_started_time = 8;
103+
google.protobuf.Timestamp last_started_time = 14;
75104
// The attempt this activity is currently on.
76105
// Incremented each time a new attempt is started.
77106
// TODO(dandavison): Confirm if this is on scheduled or started.
78-
int32 attempt = 9;
79-
int32 maximum_attempts = 10;
107+
int32 attempt = 15;
108+
int32 maximum_attempts = 16;
80109
// Time the activity was originally scheduled via a StartActivityExecution request.
81-
google.protobuf.Timestamp scheduled_time = 11;
110+
google.protobuf.Timestamp scheduled_time = 17;
82111
// Scheduled time + schedule to close timeout.
83-
google.protobuf.Timestamp expiration_time = 12;
112+
google.protobuf.Timestamp expiration_time = 18;
113+
// Time when the activity transitioned to a closed state.
114+
google.protobuf.Timestamp close_time = 19;
115+
84116
// Failure details from the last failed attempt.
85-
temporal.api.failure.v1.Failure last_failure = 13;
86-
string last_worker_identity = 14;
117+
temporal.api.failure.v1.Failure last_failure = 20;
118+
string last_worker_identity = 21;
87119

88120
// Time from the last attempt failure to the next activity retry.
89121
// If the activity is currently running, this represents the next retry interval in case the attempt fails.
90122
// If activity is currently backing off between attempt, this represents the current retry interval.
91123
// If there is no next retry allowed, this field will be null.
92124
// This interval is typically calculated from the specified retry policy, but may be modified if an activity fails
93125
// with a retryable application failure specifying a retry delay.
94-
google.protobuf.Duration current_retry_interval = 15;
126+
google.protobuf.Duration current_retry_interval = 22;
95127

96128
// The time when the last activity attempt completed. If activity has not been completed yet, it will be null.
97-
google.protobuf.Timestamp last_attempt_complete_time = 16;
129+
google.protobuf.Timestamp last_attempt_complete_time = 23;
98130

99131
// The time when the next activity attempt will be scheduled.
100132
// If activity is currently scheduled or started, this field will be null.
101-
google.protobuf.Timestamp next_attempt_schedule_time = 17;
133+
google.protobuf.Timestamp next_attempt_schedule_time = 24;
102134

103135
// The Worker Deployment Version this activity was dispatched to most recently.
104136
// If nil, the activity has not yet been dispatched or was last dispatched to an unversioned worker.
105-
temporal.api.deployment.v1.WorkerDeploymentVersion last_deployment_version = 18;
137+
temporal.api.deployment.v1.WorkerDeploymentVersion last_deployment_version = 25;
106138

107139
// Priority metadata.
108-
temporal.api.common.v1.Priority priority = 19;
140+
temporal.api.common.v1.Priority priority = 26;
109141

110142
// Current activity options. May be different from the one used to start the activity.
111-
temporal.api.activity.v1.ActivityOptions activity_options = 20;
143+
temporal.api.activity.v1.ActivityOptions activity_options = 27;
112144

113145
// Incremented each time the activity's state is mutated in persistence.
114-
int64 state_transition_count = 21;
146+
int64 state_transition_count = 28;
115147

116-
temporal.api.common.v1.SearchAttributes search_attributes = 22;
117-
temporal.api.common.v1.Header header = 23;
148+
temporal.api.common.v1.SearchAttributes search_attributes = 29;
149+
temporal.api.common.v1.Header header = 30;
118150
// Metadata for use by user interfaces to display the fixed as-of-start summary and details of the activity.
119-
temporal.api.sdk.v1.UserMetadata user_metadata = 24;
151+
temporal.api.sdk.v1.UserMetadata user_metadata = 31;
120152

121153
// Set if activity cancelation was requested.
122-
string canceled_reason = 25;
154+
string canceled_reason = 32;
123155
}
124156

125157
// Limited activity information returned in the list response.

temporal/api/workflowservice/v1/request_response.proto

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2844,10 +2844,12 @@ message TerminateActivityExecutionRequest {
28442844
string activity_id = 2;
28452845
// Activity run ID, targets the latest run if run_id is empty.
28462846
string run_id = 3;
2847-
// Reason for requesting the termination, recorded in in the activity's result failure outcome.
2848-
string reason = 4;
28492847
// The identity of the worker/client.
2850-
string identity = 5;
2848+
string identity = 4;
2849+
// Used to de-dupe termination requests.
2850+
string request_id = 5;
2851+
// Reason for requesting the termination, recorded in in the activity's result failure outcome.
2852+
string reason = 6;
28512853
}
28522854

28532855
message TerminateActivityExecutionResponse {

0 commit comments

Comments
 (0)