Skip to content

Commit 0ba4284

Browse files
authored
Add worker commands initial API (#612)
<!-- Describe what has changed in this PR --> **What changed?** Add new API for worker commands, and first few commands - Get/Set Config. Also add rudimentary config. <!-- Tell your future self why have you made these changes --> Part of worker commands work. We should be able to send commands to the workers/receive response. <!-- Are there any breaking changes on binary or code level? --> **Breaking changes** Yep. <!-- If this breaks the Server, please provide the Server PR to merge right after this PR was merged. --> [Server PR.](temporalio/temporal#8055)
1 parent 57803a3 commit 0ba4284

File tree

6 files changed

+644
-1
lines changed

6 files changed

+644
-1
lines changed

openapi/openapiv2.json

Lines changed: 274 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2296,6 +2296,46 @@
22962296
]
22972297
}
22982298
},
2299+
"/api/v1/namespaces/{namespace}/workers/fetch-config": {
2300+
"post": {
2301+
"summary": "FetchWorkerConfig returns the worker configuration for a specific worker.",
2302+
"operationId": "FetchWorkerConfig2",
2303+
"responses": {
2304+
"200": {
2305+
"description": "A successful response.",
2306+
"schema": {
2307+
"$ref": "#/definitions/v1FetchWorkerConfigResponse"
2308+
}
2309+
},
2310+
"default": {
2311+
"description": "An unexpected error response.",
2312+
"schema": {
2313+
"$ref": "#/definitions/rpcStatus"
2314+
}
2315+
}
2316+
},
2317+
"parameters": [
2318+
{
2319+
"name": "namespace",
2320+
"description": "Namespace this worker belongs to.",
2321+
"in": "path",
2322+
"required": true,
2323+
"type": "string"
2324+
},
2325+
{
2326+
"name": "body",
2327+
"in": "body",
2328+
"required": true,
2329+
"schema": {
2330+
"$ref": "#/definitions/WorkflowServiceFetchWorkerConfigBody"
2331+
}
2332+
}
2333+
],
2334+
"tags": [
2335+
"WorkflowService"
2336+
]
2337+
}
2338+
},
22992339
"/api/v1/namespaces/{namespace}/workers/heartbeat": {
23002340
"post": {
23012341
"summary": "WorkerHeartbeat receive heartbeat request from the worker.",
@@ -2336,6 +2376,46 @@
23362376
]
23372377
}
23382378
},
2379+
"/api/v1/namespaces/{namespace}/workers/update-config": {
2380+
"post": {
2381+
"summary": "UpdateWorkerConfig updates the worker configuration of one or more workers.\nCan be used to partially update the worker configuration.\nCan be used to update the configuration of multiple workers.",
2382+
"operationId": "UpdateWorkerConfig2",
2383+
"responses": {
2384+
"200": {
2385+
"description": "A successful response.",
2386+
"schema": {
2387+
"$ref": "#/definitions/v1UpdateWorkerConfigResponse"
2388+
}
2389+
},
2390+
"default": {
2391+
"description": "An unexpected error response.",
2392+
"schema": {
2393+
"$ref": "#/definitions/rpcStatus"
2394+
}
2395+
}
2396+
},
2397+
"parameters": [
2398+
{
2399+
"name": "namespace",
2400+
"description": "Namespace this worker belongs to.",
2401+
"in": "path",
2402+
"required": true,
2403+
"type": "string"
2404+
},
2405+
{
2406+
"name": "body",
2407+
"in": "body",
2408+
"required": true,
2409+
"schema": {
2410+
"$ref": "#/definitions/WorkflowServiceUpdateWorkerConfigBody"
2411+
}
2412+
}
2413+
],
2414+
"tags": [
2415+
"WorkflowService"
2416+
]
2417+
}
2418+
},
23392419
"/api/v1/namespaces/{namespace}/workflow-count": {
23402420
"get": {
23412421
"summary": "CountWorkflowExecutions is a visibility API to count of workflow executions in a specific namespace.",
@@ -5957,6 +6037,46 @@
59576037
]
59586038
}
59596039
},
6040+
"/namespaces/{namespace}/workers/fetch-config": {
6041+
"post": {
6042+
"summary": "FetchWorkerConfig returns the worker configuration for a specific worker.",
6043+
"operationId": "FetchWorkerConfig",
6044+
"responses": {
6045+
"200": {
6046+
"description": "A successful response.",
6047+
"schema": {
6048+
"$ref": "#/definitions/v1FetchWorkerConfigResponse"
6049+
}
6050+
},
6051+
"default": {
6052+
"description": "An unexpected error response.",
6053+
"schema": {
6054+
"$ref": "#/definitions/rpcStatus"
6055+
}
6056+
}
6057+
},
6058+
"parameters": [
6059+
{
6060+
"name": "namespace",
6061+
"description": "Namespace this worker belongs to.",
6062+
"in": "path",
6063+
"required": true,
6064+
"type": "string"
6065+
},
6066+
{
6067+
"name": "body",
6068+
"in": "body",
6069+
"required": true,
6070+
"schema": {
6071+
"$ref": "#/definitions/WorkflowServiceFetchWorkerConfigBody"
6072+
}
6073+
}
6074+
],
6075+
"tags": [
6076+
"WorkflowService"
6077+
]
6078+
}
6079+
},
59606080
"/namespaces/{namespace}/workers/heartbeat": {
59616081
"post": {
59626082
"summary": "WorkerHeartbeat receive heartbeat request from the worker.",
@@ -5997,6 +6117,46 @@
59976117
]
59986118
}
59996119
},
6120+
"/namespaces/{namespace}/workers/update-config": {
6121+
"post": {
6122+
"summary": "UpdateWorkerConfig updates the worker configuration of one or more workers.\nCan be used to partially update the worker configuration.\nCan be used to update the configuration of multiple workers.",
6123+
"operationId": "UpdateWorkerConfig",
6124+
"responses": {
6125+
"200": {
6126+
"description": "A successful response.",
6127+
"schema": {
6128+
"$ref": "#/definitions/v1UpdateWorkerConfigResponse"
6129+
}
6130+
},
6131+
"default": {
6132+
"description": "An unexpected error response.",
6133+
"schema": {
6134+
"$ref": "#/definitions/rpcStatus"
6135+
}
6136+
}
6137+
},
6138+
"parameters": [
6139+
{
6140+
"name": "namespace",
6141+
"description": "Namespace this worker belongs to.",
6142+
"in": "path",
6143+
"required": true,
6144+
"type": "string"
6145+
},
6146+
{
6147+
"name": "body",
6148+
"in": "body",
6149+
"required": true,
6150+
"schema": {
6151+
"$ref": "#/definitions/WorkflowServiceUpdateWorkerConfigBody"
6152+
}
6153+
}
6154+
],
6155+
"tags": [
6156+
"WorkflowService"
6157+
]
6158+
}
6159+
},
60006160
"/namespaces/{namespace}/workflow-count": {
60016161
"get": {
60026162
"summary": "CountWorkflowExecutions is a visibility API to count of workflow executions in a specific namespace.",
@@ -7446,6 +7606,35 @@
74467606
"default": "PINNED_OVERRIDE_BEHAVIOR_UNSPECIFIED",
74477607
"description": "Used to specify different sub-types of Pinned override that we plan to add in the future.\n\n - PINNED_OVERRIDE_BEHAVIOR_UNSPECIFIED: Unspecified.\n - PINNED_OVERRIDE_BEHAVIOR_PINNED: Override workflow behavior to be Pinned."
74487608
},
7609+
"WorkerConfigAutoscalingPollerBehavior": {
7610+
"type": "object",
7611+
"properties": {
7612+
"minPollers": {
7613+
"type": "integer",
7614+
"format": "int32",
7615+
"description": "At least this many poll calls will always be attempted (assuming slots are available).\nCannot be zero."
7616+
},
7617+
"maxPollers": {
7618+
"type": "integer",
7619+
"format": "int32",
7620+
"description": "At most this many poll calls will ever be open at once. Must be >= `minimum`."
7621+
},
7622+
"initialPollers": {
7623+
"type": "integer",
7624+
"format": "int32",
7625+
"description": "This many polls will be attempted initially before scaling kicks in. Must be between\n `minimum` and `maximum`."
7626+
}
7627+
}
7628+
},
7629+
"WorkerConfigSimplePollerBehavior": {
7630+
"type": "object",
7631+
"properties": {
7632+
"maxPollers": {
7633+
"type": "integer",
7634+
"format": "int32"
7635+
}
7636+
}
7637+
},
74497638
"WorkerDeploymentInfoWorkerDeploymentVersionSummary": {
74507639
"type": "object",
74517640
"properties": {
@@ -7615,6 +7804,23 @@
76157804
}
76167805
}
76177806
},
7807+
"WorkflowServiceFetchWorkerConfigBody": {
7808+
"type": "object",
7809+
"properties": {
7810+
"identity": {
7811+
"type": "string",
7812+
"description": "The identity of the client who initiated this request."
7813+
},
7814+
"reason": {
7815+
"type": "string",
7816+
"description": "Reason for sending worker command, can be used for audit purpose."
7817+
},
7818+
"selector": {
7819+
"$ref": "#/definitions/v1WorkerSelector",
7820+
"description": "Defines which workers should receive this command.\nonly single worker is supported at this time."
7821+
}
7822+
}
7823+
},
76187824
"WorkflowServicePatchScheduleBody": {
76197825
"type": "object",
76207826
"properties": {
@@ -8652,6 +8858,31 @@
86528858
}
86538859
}
86548860
},
8861+
"WorkflowServiceUpdateWorkerConfigBody": {
8862+
"type": "object",
8863+
"properties": {
8864+
"identity": {
8865+
"type": "string",
8866+
"description": "The identity of the client who initiated this request."
8867+
},
8868+
"reason": {
8869+
"type": "string",
8870+
"description": "Reason for sending worker command, can be used for audit purpose."
8871+
},
8872+
"workerConfig": {
8873+
"$ref": "#/definitions/v1WorkerConfig",
8874+
"description": "Partial updates are accepted and controlled by update_mask.\nThe worker configuration to set."
8875+
},
8876+
"updateMask": {
8877+
"type": "string",
8878+
"title": "Controls which fields from `worker_config` will be applied"
8879+
},
8880+
"selector": {
8881+
"$ref": "#/definitions/v1WorkerSelector",
8882+
"description": "Defines which workers should receive this command."
8883+
}
8884+
}
8885+
},
86558886
"WorkflowServiceUpdateWorkerDeploymentVersionMetadataBody": {
86568887
"type": "object",
86578888
"properties": {
@@ -10913,6 +11144,15 @@
1091311144
},
1091411145
"title": "Represents a historical replication status of a Namespace"
1091511146
},
11147+
"v1FetchWorkerConfigResponse": {
11148+
"type": "object",
11149+
"properties": {
11150+
"workerConfig": {
11151+
"$ref": "#/definitions/v1WorkerConfig",
11152+
"description": "The worker configuration."
11153+
}
11154+
}
11155+
},
1091611156
"v1GetClusterInfoResponse": {
1091711157
"type": "object",
1091811158
"properties": {
@@ -15242,6 +15482,15 @@
1524215482
"type": "object",
1524315483
"title": "[cleanup-wv-pre-release]"
1524415484
},
15485+
"v1UpdateWorkerConfigResponse": {
15486+
"type": "object",
15487+
"properties": {
15488+
"workerConfig": {
15489+
"$ref": "#/definitions/v1WorkerConfig",
15490+
"description": "The worker configuration. Will be returned if the command was sent to a single worker."
15491+
}
15492+
}
15493+
},
1524515494
"v1UpdateWorkerDeploymentVersionMetadataResponse": {
1524615495
"type": "object",
1524715496
"properties": {
@@ -15487,6 +15736,21 @@
1548715736
},
1548815737
"description": "Specifies client's intent to wait for Update results."
1548915738
},
15739+
"v1WorkerConfig": {
15740+
"type": "object",
15741+
"properties": {
15742+
"workflowCacheSize": {
15743+
"type": "integer",
15744+
"format": "int32"
15745+
},
15746+
"simplePollerBehavior": {
15747+
"$ref": "#/definitions/WorkerConfigSimplePollerBehavior"
15748+
},
15749+
"autoscalingPollerBehavior": {
15750+
"$ref": "#/definitions/WorkerConfigAutoscalingPollerBehavior"
15751+
}
15752+
}
15753+
},
1549015754
"v1WorkerDeploymentInfo": {
1549115755
"type": "object",
1549215756
"properties": {
@@ -15774,6 +16038,16 @@
1577416038
}
1577516039
}
1577616040
},
16041+
"v1WorkerSelector": {
16042+
"type": "object",
16043+
"properties": {
16044+
"workerInstanceKey": {
16045+
"type": "string",
16046+
"description": "Worker instance key to which the command should be sent."
16047+
}
16048+
},
16049+
"description": "This is used to send commands to a specific worker or a group of workers.\nRight now, it is used to send commands to a specific worker instance.\nWill be extended to be able to send command to multiple workers."
16050+
},
1577716051
"v1WorkerSlotsInfo": {
1577816052
"type": "object",
1577916053
"properties": {

0 commit comments

Comments
 (0)