Skip to content

Commit 4a1ab98

Browse files
Add ShutdownWorker internal API (#443)
* Add ShutdownWorker internal API. This API will allow workers to signal shutdown/restart, which Matching can use to unload the shutdown worker's sticky task queue. This will effectively remove the latency incurred from tasks being pushed to a sticky worker after that worker has already been shutdown.
1 parent d761393 commit 4a1ab98

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

openapi/openapiv2.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10091,6 +10091,9 @@
1009110091
],
1009210092
"default": "SEVERITY_UNSPECIFIED"
1009310093
},
10094+
"v1ShutdownWorkerResponse": {
10095+
"type": "object"
10096+
},
1009410097
"v1SignalExternalWorkflowExecutionCommandAttributes": {
1009510098
"type": "object",
1009610099
"properties": {

temporal/api/workflowservice/v1/request_response.proto

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -871,6 +871,16 @@ message ResetStickyTaskQueueRequest {
871871
message ResetStickyTaskQueueResponse {
872872
}
873873

874+
message ShutdownWorkerRequest {
875+
string namespace = 1;
876+
string sticky_task_queue = 2;
877+
string identity = 3;
878+
string reason = 4;
879+
}
880+
881+
message ShutdownWorkerResponse {
882+
}
883+
874884
message QueryWorkflowRequest {
875885
string namespace = 1;
876886
temporal.api.common.v1.WorkflowExecution execution = 2;

temporal/api/workflowservice/v1/service.proto

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,11 +521,31 @@ service WorkflowService {
521521
// 1. StickyTaskQueue
522522
// 2. StickyScheduleToStartTimeout
523523
//
524+
// When possible, ShutdownWorker should be preferred over
525+
// ResetStickyTaskQueue (particularly when a worker is shutting down or
526+
// cycling).
527+
//
524528
// (-- api-linter: core::0127::http-annotation=disabled
525529
// aip.dev/not-precedent: We do not expose worker API to HTTP. --)
526530
rpc ResetStickyTaskQueue (ResetStickyTaskQueueRequest) returns (ResetStickyTaskQueueResponse) {
527531
}
528532

533+
// ShutdownWorker is used to indicate that the given sticky task
534+
// queue is no longer being polled by its worker. Following the completion of
535+
// ShutdownWorker, newly-added workflow tasks will instead be placed
536+
// in the normal task queue, eligible for any worker to pick up.
537+
//
538+
// ShutdownWorker should be called by workers while shutting down,
539+
// after they've shut down their pollers. If another sticky poll
540+
// request is issued, the sticky task queue will be revived.
541+
//
542+
// As of Temporal Server v1.25.0, ShutdownWorker hasn't yet been implemented.
543+
//
544+
// (-- api-linter: core::0127::http-annotation=disabled
545+
// aip.dev/not-precedent: We do not expose worker API to HTTP. --)
546+
rpc ShutdownWorker (ShutdownWorkerRequest) returns (ShutdownWorkerResponse) {
547+
}
548+
529549
// QueryWorkflow requests a query be executed for a specified workflow execution.
530550
rpc QueryWorkflow (QueryWorkflowRequest) returns (QueryWorkflowResponse) {
531551
option (google.api.http) = {

0 commit comments

Comments
 (0)