Skip to content

Commit 3c8d6cb

Browse files
bergundyfretz12dandavison
committed
[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 <[email protected]> Co-authored-by: Dan Davison <[email protected]>
1 parent 1b96ac0 commit 3c8d6cb

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
@@ -9775,13 +9775,17 @@
97759775
"type": "string",
97769776
"description": "Activity run ID, targets the latest run if run_id is empty."
97779777
},
9778-
"reason": {
9779-
"type": "string",
9780-
"description": "Reason for requesting the termination, recorded in in the activity's result failure outcome."
9781-
},
97829778
"identity": {
97839779
"type": "string",
97849780
"description": "The identity of the worker/client."
9781+
},
9782+
"requestId": {
9783+
"type": "string",
9784+
"description": "Used to de-dupe termination requests."
9785+
},
9786+
"reason": {
9787+
"type": "string",
9788+
"description": "Reason for requesting the termination, recorded in in the activity's result failure outcome."
97859789
}
97869790
}
97879791
},
@@ -10361,6 +10365,29 @@
1036110365
"$ref": "#/definitions/v1PendingActivityState",
1036210366
"description": "More detailed breakdown of ACTIVITY_EXECUTION_STATUS_RUNNING."
1036310367
},
10368+
"taskQueue": {
10369+
"$ref": "#/definitions/v1TaskQueue"
10370+
},
10371+
"scheduleToCloseTimeout": {
10372+
"type": "string",
10373+
"description": "Indicates how long the caller is willing to wait for an activity completion. Limits how long\nretries will be attempted.\n"
10374+
},
10375+
"scheduleToStartTimeout": {
10376+
"type": "string",
10377+
"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"
10378+
},
10379+
"startToCloseTimeout": {
10380+
"type": "string",
10381+
"description": "Maximum time a single activity attempt is allowed to execute after being picked up by a worker. This\ntimeout is always retryable.\n"
10382+
},
10383+
"heartbeatTimeout": {
10384+
"type": "string",
10385+
"description": "Maximum permitted time between successful worker heartbeats."
10386+
},
10387+
"retryPolicy": {
10388+
"$ref": "#/definitions/v1RetryPolicy",
10389+
"description": "The retry policy for the activity. Will never exceed `schedule_to_close_timeout`."
10390+
},
1036410391
"heartbeatDetails": {
1036510392
"$ref": "#/definitions/v1Payloads",
1036610393
"description": "Details provided in the last recorded activity heartbeat."
@@ -10394,6 +10421,11 @@
1039410421
"format": "date-time",
1039510422
"description": "Scheduled time + schedule to close timeout."
1039610423
},
10424+
"closeTime": {
10425+
"type": "string",
10426+
"format": "date-time",
10427+
"description": "Time when the activity transitioned to a closed state."
10428+
},
1039710429
"lastFailure": {
1039810430
"$ref": "#/definitions/apifailurev1Failure",
1039910431
"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'
@@ -13758,12 +13800,15 @@ components:
1375813800
runId:
1375913801
type: string
1376013802
description: Activity run ID, targets the latest run if run_id is empty.
13761-
reason:
13762-
type: string
13763-
description: Reason for requesting the termination, recorded in in the activity's result failure outcome.
1376413803
identity:
1376513804
type: string
1376613805
description: The identity of the worker/client.
13806+
requestId:
13807+
type: string
13808+
description: Used to de-dupe termination requests.
13809+
reason:
13810+
type: string
13811+
description: Reason for requesting the termination, recorded in in the activity's result failure outcome.
1376713812
TerminateActivityExecutionResponse:
1376813813
type: object
1376913814
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)