diff --git a/.gitignore b/.gitignore index 8655883e5..efbf7b661 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,6 @@ /.gen /.vscode /.stamp -*~ \ No newline at end of file +*~ +*.swp +*.swo diff --git a/Makefile b/Makefile index 3338826fb..9099fa43f 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ STAMPDIR := .stamp COLOR := "\e[1;36m%s\e[0m\n" PROTO_ROOT := . -PROTO_FILES = $(shell find temporal -name "*.proto") +PROTO_FILES = $(shell find temporal -name "*.proto" -not -name "*.swp") PROTO_DIRS = $(sort $(dir $(PROTO_FILES))) PROTO_OUT := .gen PROTO_IMPORTS = \ diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 4e83aaf24..78a670fa8 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -2247,6 +2247,60 @@ ] } }, + "/api/v1/namespaces/{namespace}/worker-deployment-versions/{deploymentVersion.deploymentName}/{deploymentVersion.buildId}/update-compute-config": { + "post": { + "summary": "Updates the compute configuration for an existing Worker Deployment\nVersion.", + "description": "Experimental. This API might significantly change or be removed in a\nfuture release.", + "operationId": "UpdateWorkerDeploymentVersionComputeConfig2", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1UpdateWorkerDeploymentVersionComputeConfigResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "namespace", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "deploymentVersion.deploymentName", + "description": "Identifies the Worker Deployment this Version is part of.", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "deploymentVersion.buildId", + "description": "A unique identifier for this Version within the Deployment it is a part of.\nNot necessarily unique within the namespace.\nThe combination of `deployment_name` and `build_id` uniquely identifies this\nVersion within the namespace, because Deployment names are unique within a namespace.", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/WorkflowServiceUpdateWorkerDeploymentVersionComputeConfigBody" + } + } + ], + "tags": [ + "WorkflowService" + ] + } + }, "/api/v1/namespaces/{namespace}/worker-deployment-versions/{deploymentVersion.deploymentName}/{deploymentVersion.buildId}/update-metadata": { "post": { "summary": "Updates the user-given metadata attached to a Worker Deployment Version.\nExperimental. This API might significantly change or be removed in a future release.", @@ -2422,6 +2476,51 @@ "tags": [ "WorkflowService" ] + }, + "post": { + "summary": "Creates a new Worker Deployment.", + "description": "Experimental. This API might significantly change or be removed in a\nfuture release.", + "operationId": "CreateWorkerDeployment2", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1CreateWorkerDeploymentResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "namespace", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "deploymentName", + "description": "The name of the Worker Deployment to create. If a Worker Deployment with\nthis name already exists, an error will be returned.", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/WorkflowServiceCreateWorkerDeploymentBody" + } + } + ], + "tags": [ + "WorkflowService" + ] } }, "/api/v1/namespaces/{namespace}/worker-deployments/{deploymentName}/set-current-version": { @@ -2559,6 +2658,53 @@ ] } }, + "/api/v1/namespaces/{namespace}/worker-deployments/{deploymentName}/update-compute-config": { + "post": { + "summary": "Updates the compute configuration for an existing Worker Deployment.", + "description": "Experimental. This API might significantly change or be removed in a\nfuture release.", + "operationId": "UpdateWorkerDeploymentComputeConfig2", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1UpdateWorkerDeploymentComputeConfigResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "namespace", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "deploymentName", + "description": "The name of the Worker Deployment to target. If a Worker Deployment with\nthis name does not exist, one is created.", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/WorkflowServiceUpdateWorkerDeploymentComputeConfigBody" + } + } + ], + "tags": [ + "WorkflowService" + ] + } + }, "/api/v1/namespaces/{namespace}/worker-task-reachability": { "get": { "summary": "Deprecated. Use `DescribeTaskQueue`.", @@ -6411,6 +6557,60 @@ ] } }, + "/namespaces/{namespace}/worker-deployment-versions/{deploymentVersion.deploymentName}/{deploymentVersion.buildId}/update-compute-config": { + "post": { + "summary": "Updates the compute configuration for an existing Worker Deployment\nVersion.", + "description": "Experimental. This API might significantly change or be removed in a\nfuture release.", + "operationId": "UpdateWorkerDeploymentVersionComputeConfig", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1UpdateWorkerDeploymentVersionComputeConfigResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "namespace", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "deploymentVersion.deploymentName", + "description": "Identifies the Worker Deployment this Version is part of.", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "deploymentVersion.buildId", + "description": "A unique identifier for this Version within the Deployment it is a part of.\nNot necessarily unique within the namespace.\nThe combination of `deployment_name` and `build_id` uniquely identifies this\nVersion within the namespace, because Deployment names are unique within a namespace.", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/WorkflowServiceUpdateWorkerDeploymentVersionComputeConfigBody" + } + } + ], + "tags": [ + "WorkflowService" + ] + } + }, "/namespaces/{namespace}/worker-deployment-versions/{deploymentVersion.deploymentName}/{deploymentVersion.buildId}/update-metadata": { "post": { "summary": "Updates the user-given metadata attached to a Worker Deployment Version.\nExperimental. This API might significantly change or be removed in a future release.", @@ -6586,6 +6786,51 @@ "tags": [ "WorkflowService" ] + }, + "post": { + "summary": "Creates a new Worker Deployment.", + "description": "Experimental. This API might significantly change or be removed in a\nfuture release.", + "operationId": "CreateWorkerDeployment", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1CreateWorkerDeploymentResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "namespace", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "deploymentName", + "description": "The name of the Worker Deployment to create. If a Worker Deployment with\nthis name already exists, an error will be returned.", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/WorkflowServiceCreateWorkerDeploymentBody" + } + } + ], + "tags": [ + "WorkflowService" + ] } }, "/namespaces/{namespace}/worker-deployments/{deploymentName}/set-current-version": { @@ -6723,6 +6968,53 @@ ] } }, + "/namespaces/{namespace}/worker-deployments/{deploymentName}/update-compute-config": { + "post": { + "summary": "Updates the compute configuration for an existing Worker Deployment.", + "description": "Experimental. This API might significantly change or be removed in a\nfuture release.", + "operationId": "UpdateWorkerDeploymentComputeConfig", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1UpdateWorkerDeploymentComputeConfigResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "namespace", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "deploymentName", + "description": "The name of the Worker Deployment to target. If a Worker Deployment with\nthis name does not exist, one is created.", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/WorkflowServiceUpdateWorkerDeploymentComputeConfigBody" + } + } + ], + "tags": [ + "WorkflowService" + ] + } + }, "/namespaces/{namespace}/worker-task-reachability": { "get": { "summary": "Deprecated. Use `DescribeTaskQueue`.", @@ -8590,6 +8882,36 @@ } } }, + "WorkflowServiceCreateWorkerDeploymentBody": { + "type": "object", + "properties": { + "workerVersioningMode": { + "$ref": "#/definitions/v1WorkerVersioningMode", + "description": "Optional. Indicates the Worker Deployment should use a particular\nversioning strategy.\n\nIf empty, defaults to UNVERSIONED." + }, + "taskQueues": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/v1TaskQueue" + }, + "description": "Optional. Indicates the task queues that are associated with the Worker\nDeployment. These task queues are used as the default task queues to\nassociate to new Worker Deployment Versions created for this Worker\nDeployment." + }, + "computeConfig": { + "$ref": "#/definitions/v1Config", + "description": "Optional. Contains the new worker compute configuration for the Worker\nDeployment. Used as the default compute configuration for new Worker\nDeployment Versions created for this Worker Deployment." + }, + "identity": { + "type": "string", + "description": "Optional. The identity of the client who initiated this request." + }, + "requestId": { + "type": "string", + "description": "A unique identifier for this create request for idempotence. Typically UUIDv4." + } + }, + "description": "Creates a new WorkerDeployment." + }, "WorkflowServiceCreateWorkflowRuleBody": { "type": "object", "properties": { @@ -9910,6 +10232,48 @@ } } }, + "WorkflowServiceUpdateWorkerDeploymentComputeConfigBody": { + "type": "object", + "properties": { + "computeConfig": { + "$ref": "#/definitions/v1Config", + "description": "Contains the new worker compute configuration for the\nWorkerDeployment." + }, + "conflictToken": { + "type": "string", + "format": "byte", + "description": "Optional. This can be the value of conflict_token from a Describe or\nanother UpdateWorkerDeploymentComputeProvider API call.\n\nPassing a non-nil conflict token will cause this request to fail if the\nWorkerDeployment's configuration has been modified between the API call\nthat generated the token and this one." + }, + "identity": { + "type": "string", + "description": "Optional. The identity of the client who initiated this request." + } + }, + "description": "Updates the compute configuration for an existing WorkerDeployment." + }, + "WorkflowServiceUpdateWorkerDeploymentVersionComputeConfigBody": { + "type": "object", + "properties": { + "deploymentVersion": { + "type": "object", + "description": "A Worker Deployment Version (Version, for short) represents a\nversion of workers within a Worker Deployment. (see documentation of WorkerDeploymentVersionInfo)\nVersion records are created in Temporal server automatically when their\nfirst poller arrives to the server.\nExperimental. Worker Deployment Versions are experimental and might significantly change in the future." + }, + "computeConfig": { + "$ref": "#/definitions/v1Config", + "description": "Contains the new worker compute configuration for the\nWorkerDeploymentVersion." + }, + "conflictToken": { + "type": "string", + "format": "byte", + "description": "Optional. This can be the value of conflict_token from a Describe or\nanother UpdateWorkerDeploymentVersionComputeProvider API call.\n\nPassing a non-nil conflict token will cause this request to fail if the\nWorkerDeploymentVersion's configuration has been modified between the\nAPI call that generated the token and this one." + }, + "identity": { + "type": "string", + "description": "Optional. The identity of the client who initiated this request." + } + }, + "description": "Updates the compute configuration for an existing WorkerDeploymentVersion." + }, "WorkflowServiceUpdateWorkerDeploymentVersionMetadataBody": { "type": "object", "properties": { @@ -11339,6 +11703,20 @@ }, "description": "Used by the worker versioning APIs, represents an unordered set of one or more versions which are\nconsidered to be compatible with each other. Currently the versions are always worker build IDs." }, + "v1Config": { + "type": "object", + "properties": { + "provider": { + "$ref": "#/definitions/v1Provider", + "description": "Stores instructions for a worker control plane controller how to respond\nto worker lifeycle events." + }, + "scaler": { + "$ref": "#/definitions/v1Scaler", + "description": "Informs a worker lifecycle controller *when* and *how often* to perform\ncertain worker lifecycle actions like starting a serverless worker." + } + }, + "description": "Config stores configuration that helps a worker control plane controller\nunderstand *when* and *how* to respond to worker lifecycle events." + }, "v1ConfigMetadata": { "type": "object", "properties": { @@ -11472,6 +11850,16 @@ } } }, + "v1CreateWorkerDeploymentResponse": { + "type": "object", + "properties": { + "conflictToken": { + "type": "string", + "format": "byte", + "description": "This value is returned so that it can be optionally passed to APIs that\nwrite to the WorkerDeployment state to ensure that the state did not\nchange between this API call and a future write." + } + } + }, "v1CreateWorkflowRuleResponse": { "type": "object", "properties": { @@ -14053,6 +14441,24 @@ }, "description": "Priority contains metadata that controls relative ordering of task processing\nwhen tasks are backed up in a queue. Initially, Priority will be used in\nmatching (workflow and activity) task queues. Later it may be used in history\ntask queues and in rate limiting decisions.\n\nPriority is attached to workflows and activities. By default, activities\ninherit Priority from the workflow that created them, but may override fields\nwhen an activity is started or modified.\n\nDespite being named \"Priority\", this message also contains fields that\ncontrol \"fairness\" mechanisms.\n\nFor all fields, the field not present or equal to zero/empty string means to\ninherit the value from the calling workflow, or if there is no calling\nworkflow, then use the default value.\n\nFor all fields other than fairness_key, the zero value isn't meaningful so\nthere's no confusion between inherit/default and a meaningful value. For\nfairness_key, the empty string will be interpreted as \"inherit\". This means\nthat if a workflow has a non-empty fairness key, you can't override the\nfairness key of its activity to the empty string.\n\nThe overall semantics of Priority are:\n1. First, consider \"priority\": higher priority (lower number) goes first.\n2. Then, consider fairness: try to dispatch tasks for different fairness keys\n in proportion to their weight.\n\nApplications may use any subset of mechanisms that are useful to them and\nleave the other fields to use default values.\n\nNot all queues in the system may support the \"full\" semantics of all priority\nfields. (Currently only support in matching task queues is planned.)" }, + "v1Provider": { + "type": "object", + "properties": { + "type": { + "type": "string", + "description": "Type of the compute provider. This string is implementation-specific and\ncan be used by implementations to understand how to interpret the\ncontents of the provider_details field." + }, + "detailObject": { + "$ref": "#/definitions/protobufAny", + "title": "will be an unencrypted, unencoded object of provider-specific\ninformation" + }, + "detailPayload": { + "$ref": "#/definitions/v1Payload", + "description": "will be an encrypted, encoded bytestring containing\nprovider-specific information. The implementation must understand\nhow to decrypt the payload." + } + }, + "description": "Provider stores information used by a worker control plane controller\nto respond to worker lifecycle events. For example, when a Task is received\non a TaskQueue that has no active pollers in the last five minutes, a\nserverless worker lifecycle controller might need to invoke an AWS Lambda\nFunction that itself ends up calling the SDK's worker.New() function." + }, "v1QueryRejectCondition": { "type": "string", "enum": [ @@ -14645,6 +15051,22 @@ "default": "ROUTING_CONFIG_UPDATE_STATE_UNSPECIFIED", "description": "Indicates whether a change to the Routing Config has been\npropagated to all relevant Task Queues and their partitions.\n\n - ROUTING_CONFIG_UPDATE_STATE_IN_PROGRESS: Update to the RoutingConfig is currently in progress.\n - ROUTING_CONFIG_UPDATE_STATE_COMPLETED: Update to the RoutingConfig has completed successfully." }, + "v1Scaler": { + "type": "object", + "properties": { + "minInstances": { + "type": "integer", + "format": "int32", + "description": "The lower limit for the number of Workers (in the WorkerDeployment) to\nwhich the Scaler can scale down." + }, + "maxInstances": { + "type": "integer", + "format": "int32", + "description": "The upper limit for the number of Workers (in the WorkerDeployment) to\nwhich the Scaler can scale up. Must be greater than or equal to\nminReplicas." + } + }, + "description": "Scaler instructs the Temporal Service when to scale up or down the number of\nWorkers that comprise a WorkerDeployment." + }, "v1Schedule": { "type": "object", "properties": { @@ -16020,6 +16442,26 @@ } } }, + "v1UpdateWorkerDeploymentComputeConfigResponse": { + "type": "object", + "properties": { + "conflictToken": { + "type": "string", + "format": "byte", + "description": "This value is returned so that it can be optionally passed to APIs that\nwrite to the WorkerDeployment state to ensure that the state did not\nchange between this API call and a future write." + } + } + }, + "v1UpdateWorkerDeploymentVersionComputeConfigResponse": { + "type": "object", + "properties": { + "conflictToken": { + "type": "string", + "format": "byte", + "description": "This value is returned so that it can be optionally passed to APIs that\nwrite to the WorkerDeploymentVersion state to ensure that the state did\nnot change between this API call and a future write." + } + } + }, "v1UpdateWorkerDeploymentVersionMetadataResponse": { "type": "object", "properties": { @@ -16280,6 +16722,10 @@ "routingConfigUpdateState": { "$ref": "#/definitions/v1RoutingConfigUpdateState", "description": "Indicates whether the routing_config has been fully propagated to all\nrelevant task queues and their partitions." + }, + "computeConfig": { + "$ref": "#/definitions/v1Config", + "description": "Contains information used by worker control plane controllers to handle\nscale events." } }, "description": "A Worker Deployment (Deployment, for short) represents all workers serving \na shared set of Task Queues. Typically, a Deployment represents one service or \napplication.\nA Deployment contains multiple Deployment Versions, each representing a different \nversion of workers. (see documentation of WorkerDeploymentVersionInfo)\nDeployment records are created in Temporal server automatically when their\nfirst poller arrives to the server.\nExperimental. Worker Deployments are experimental and might significantly change in the future." @@ -16388,6 +16834,10 @@ "metadata": { "$ref": "#/definitions/v1VersionMetadata", "description": "Arbitrary user-provided metadata attached to this version." + }, + "computeConfig": { + "$ref": "#/definitions/v1Config", + "description": "Contains information used by worker control plane controllers to handle\nscale events." } }, "description": "A Worker Deployment Version (Version, for short) represents all workers of the same \ncode and config within a Deployment. Workers of the same Version are expected to \nbehave exactly the same so when executions move between them there are no \nnon-determinism issues.\nWorker Deployment Versions are created in Temporal server automatically when \ntheir first poller arrives to the server.\nExperimental. Worker Deployments are experimental and might significantly change in the future." diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index 84115cc6b..e574ecede 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -2037,6 +2037,52 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' + ? /api/v1/namespaces/{namespace}/worker-deployment-versions/{deployment_version.deployment_name}/{deployment_version.build_id}/update-compute-config + : post: + tags: + - WorkflowService + description: |- + Updates the compute configuration for an existing Worker Deployment + Version. + + Experimental. This API might significantly change or be removed in a + future release. + operationId: UpdateWorkerDeploymentVersionComputeConfig + parameters: + - name: namespace + in: path + required: true + schema: + type: string + - name: deployment_version.deployment_name + in: path + required: true + schema: + type: string + - name: deployment_version.build_id + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateWorkerDeploymentVersionComputeConfigRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateWorkerDeploymentVersionComputeConfigResponse' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' ? /api/v1/namespaces/{namespace}/worker-deployment-versions/{deployment_version.deployment_name}/{deployment_version.build_id}/update-metadata : post: tags: @@ -2149,6 +2195,48 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' + post: + tags: + - WorkflowService + description: |- + Creates a new Worker Deployment. + + Experimental. This API might significantly change or be removed in a + future release. + operationId: CreateWorkerDeployment + parameters: + - name: namespace + in: path + required: true + schema: + type: string + - name: deploymentName + in: path + description: |- + The name of the Worker Deployment to create. If a Worker Deployment with + this name already exists, an error will be returned. + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateWorkerDeploymentRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/CreateWorkerDeploymentResponse' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' delete: tags: - WorkflowService @@ -2302,6 +2390,49 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' + /api/v1/namespaces/{namespace}/worker-deployments/{deploymentName}/update-compute-config: + post: + tags: + - WorkflowService + description: |- + Updates the compute configuration for an existing Worker Deployment. + + Experimental. This API might significantly change or be removed in a + future release. + operationId: UpdateWorkerDeploymentComputeConfig + parameters: + - name: namespace + in: path + required: true + schema: + type: string + - name: deploymentName + in: path + description: |- + The name of the Worker Deployment to target. If a Worker Deployment with + this name does not exist, one is created. + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateWorkerDeploymentComputeConfigRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateWorkerDeploymentComputeConfigResponse' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' /api/v1/namespaces/{namespace}/worker-task-reachability: get: tags: @@ -5773,6 +5904,52 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' + ? /namespaces/{namespace}/worker-deployment-versions/{deployment_version.deployment_name}/{deployment_version.build_id}/update-compute-config + : post: + tags: + - WorkflowService + description: |- + Updates the compute configuration for an existing Worker Deployment + Version. + + Experimental. This API might significantly change or be removed in a + future release. + operationId: UpdateWorkerDeploymentVersionComputeConfig + parameters: + - name: namespace + in: path + required: true + schema: + type: string + - name: deployment_version.deployment_name + in: path + required: true + schema: + type: string + - name: deployment_version.build_id + in: path + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateWorkerDeploymentVersionComputeConfigRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateWorkerDeploymentVersionComputeConfigResponse' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' ? /namespaces/{namespace}/worker-deployment-versions/{deployment_version.deployment_name}/{deployment_version.build_id}/update-metadata : post: tags: @@ -5885,6 +6062,48 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' + post: + tags: + - WorkflowService + description: |- + Creates a new Worker Deployment. + + Experimental. This API might significantly change or be removed in a + future release. + operationId: CreateWorkerDeployment + parameters: + - name: namespace + in: path + required: true + schema: + type: string + - name: deploymentName + in: path + description: |- + The name of the Worker Deployment to create. If a Worker Deployment with + this name already exists, an error will be returned. + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/CreateWorkerDeploymentRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/CreateWorkerDeploymentResponse' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' delete: tags: - WorkflowService @@ -6038,6 +6257,49 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' + /namespaces/{namespace}/worker-deployments/{deploymentName}/update-compute-config: + post: + tags: + - WorkflowService + description: |- + Updates the compute configuration for an existing Worker Deployment. + + Experimental. This API might significantly change or be removed in a + future release. + operationId: UpdateWorkerDeploymentComputeConfig + parameters: + - name: namespace + in: path + required: true + schema: + type: string + - name: deploymentName + in: path + description: |- + The name of the Worker Deployment to target. If a Worker Deployment with + this name does not exist, one is created. + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateWorkerDeploymentComputeConfigRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/UpdateWorkerDeploymentComputeConfigResponse' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' /namespaces/{namespace}/worker-task-reachability: get: tags: @@ -8526,6 +8788,24 @@ components: description: |- Used by the worker versioning APIs, represents an unordered set of one or more versions which are considered to be compatible with each other. Currently the versions are always worker build IDs. + Config: + type: object + properties: + provider: + allOf: + - $ref: '#/components/schemas/Provider' + description: |- + Stores instructions for a worker control plane controller how to respond + to worker lifeycle events. + scaler: + allOf: + - $ref: '#/components/schemas/Scaler' + description: |- + Informs a worker lifecycle controller *when* and *how often* to perform + certain worker lifecycle actions like starting a serverless worker. + description: |- + Config stores configuration that helps a worker control plane controller + understand *when* and *how* to respond to worker lifecycle events. ConfigMetadata: type: object properties: @@ -8647,6 +8927,61 @@ components: conflictToken: type: string format: bytes + CreateWorkerDeploymentRequest: + type: object + properties: + namespace: + type: string + deploymentName: + type: string + description: |- + The name of the Worker Deployment to create. If a Worker Deployment with + this name already exists, an error will be returned. + workerVersioningMode: + enum: + - WORKER_VERSIONING_MODE_UNSPECIFIED + - WORKER_VERSIONING_MODE_UNVERSIONED + - WORKER_VERSIONING_MODE_VERSIONED + type: string + description: |- + Optional. Indicates the Worker Deployment should use a particular + versioning strategy. + + If empty, defaults to UNVERSIONED. + format: enum + taskQueues: + type: array + items: + $ref: '#/components/schemas/TaskQueue' + description: |- + Optional. Indicates the task queues that are associated with the Worker + Deployment. These task queues are used as the default task queues to + associate to new Worker Deployment Versions created for this Worker + Deployment. + computeConfig: + allOf: + - $ref: '#/components/schemas/Config' + description: |- + Optional. Contains the new worker compute configuration for the Worker + Deployment. Used as the default compute configuration for new Worker + Deployment Versions created for this Worker Deployment. + identity: + type: string + description: Optional. The identity of the client who initiated this request. + requestId: + type: string + description: A unique identifier for this create request for idempotence. Typically UUIDv4. + description: Creates a new WorkerDeployment. + CreateWorkerDeploymentResponse: + type: object + properties: + conflictToken: + type: string + description: |- + This value is returned so that it can be optionally passed to APIs that + write to the WorkerDeployment state to ensure that the state did not + change between this API call and a future write. + format: bytes CreateWorkflowRuleRequest: type: object properties: @@ -11311,6 +11646,37 @@ components: Not all queues in the system may support the "full" semantics of all priority fields. (Currently only support in matching task queues is planned.) + Provider: + type: object + properties: + type: + type: string + description: |- + Type of the compute provider. This string is implementation-specific and + can be used by implementations to understand how to interpret the + contents of the provider_details field. + detailObject: + allOf: + - $ref: '#/components/schemas/GoogleProtobufAny' + description: |- + will be an unencrypted, unencoded object of provider-specific + information + (-- api-linter: core::0146::any=disabled + aip.dev/not-precedent: This needs to be extensible to + externally-written compute providers --) + detailPayload: + allOf: + - $ref: '#/components/schemas/Payload' + description: |- + will be an encrypted, encoded bytestring containing + provider-specific information. The implementation must understand + how to decrypt the payload. + description: |- + Provider stores information used by a worker control plane controller + to respond to worker lifecycle events. For example, when a Task is received + on a TaskQueue that has no active pollers in the last five minutes, a + serverless worker lifecycle controller might need to invoke an AWS Lambda + Function that itself ends up calling the SDK's worker.New() function. QueryRejected: type: object properties: @@ -12243,6 +12609,25 @@ components: revisionNumber: type: string description: "Monotonically increasing value which is incremented on every mutation \n to any field of this message to achieve eventual consistency between task queues and their partitions." + Scaler: + type: object + properties: + minInstances: + type: integer + description: |- + The lower limit for the number of Workers (in the WorkerDeployment) to + which the Scaler can scale down. + format: int32 + maxInstances: + type: integer + description: |- + The upper limit for the number of Workers (in the WorkerDeployment) to + which the Scaler can scale up. Must be greater than or equal to + minReplicas. + format: int32 + description: |- + Scaler instructs the Temporal Service when to scale up or down the number of + Workers that comprise a WorkerDeployment. Schedule: type: object properties: @@ -14342,6 +14727,83 @@ components: allOf: - $ref: '#/components/schemas/WorkerConfig' description: The worker configuration. Will be returned if the command was sent to a single worker. + UpdateWorkerDeploymentComputeConfigRequest: + type: object + properties: + namespace: + type: string + deploymentName: + type: string + description: |- + The name of the Worker Deployment to target. If a Worker Deployment with + this name does not exist, one is created. + computeConfig: + allOf: + - $ref: '#/components/schemas/Config' + description: |- + Contains the new worker compute configuration for the + WorkerDeployment. + conflictToken: + type: string + description: |- + Optional. This can be the value of conflict_token from a Describe or + another UpdateWorkerDeploymentComputeProvider API call. + + Passing a non-nil conflict token will cause this request to fail if the + WorkerDeployment's configuration has been modified between the API call + that generated the token and this one. + format: bytes + identity: + type: string + description: Optional. The identity of the client who initiated this request. + description: Updates the compute configuration for an existing WorkerDeployment. + UpdateWorkerDeploymentComputeConfigResponse: + type: object + properties: + conflictToken: + type: string + description: |- + This value is returned so that it can be optionally passed to APIs that + write to the WorkerDeployment state to ensure that the state did not + change between this API call and a future write. + format: bytes + UpdateWorkerDeploymentVersionComputeConfigRequest: + type: object + properties: + namespace: + type: string + deploymentVersion: + $ref: '#/components/schemas/WorkerDeploymentVersion' + computeConfig: + allOf: + - $ref: '#/components/schemas/Config' + description: |- + Contains the new worker compute configuration for the + WorkerDeploymentVersion. + conflictToken: + type: string + description: |- + Optional. This can be the value of conflict_token from a Describe or + another UpdateWorkerDeploymentVersionComputeProvider API call. + + Passing a non-nil conflict token will cause this request to fail if the + WorkerDeploymentVersion's configuration has been modified between the + API call that generated the token and this one. + format: bytes + identity: + type: string + description: Optional. The identity of the client who initiated this request. + description: Updates the compute configuration for an existing WorkerDeploymentVersion. + UpdateWorkerDeploymentVersionComputeConfigResponse: + type: object + properties: + conflictToken: + type: string + description: |- + This value is returned so that it can be optionally passed to APIs that + write to the WorkerDeploymentVersion state to ensure that the state did + not change between this API call and a future write. + format: bytes UpdateWorkerDeploymentVersionMetadataRequest: type: object properties: @@ -14718,6 +15180,12 @@ components: Indicates whether the routing_config has been fully propagated to all relevant task queues and their partitions. format: enum + computeConfig: + allOf: + - $ref: '#/components/schemas/Config' + description: |- + Contains information used by worker control plane controllers to handle + scale events. description: "A Worker Deployment (Deployment, for short) represents all workers serving \n a shared set of Task Queues. Typically, a Deployment represents one service or \n application.\n A Deployment contains multiple Deployment Versions, each representing a different \n version of workers. (see documentation of WorkerDeploymentVersionInfo)\n Deployment records are created in Temporal server automatically when their\n first poller arrives to the server.\n Experimental. Worker Deployments are experimental and might significantly change in the future." WorkerDeploymentInfo_WorkerDeploymentVersionSummary: type: object @@ -14929,6 +15397,12 @@ components: allOf: - $ref: '#/components/schemas/VersionMetadata' description: Arbitrary user-provided metadata attached to this version. + computeConfig: + allOf: + - $ref: '#/components/schemas/Config' + description: |- + Contains information used by worker control plane controllers to handle + scale events. description: "A Worker Deployment Version (Version, for short) represents all workers of the same \n code and config within a Deployment. Workers of the same Version are expected to \n behave exactly the same so when executions move between them there are no \n non-determinism issues.\n Worker Deployment Versions are created in Temporal server automatically when \n their first poller arrives to the server.\n Experimental. Worker Deployments are experimental and might significantly change in the future." WorkerDeploymentVersionInfo_VersionTaskQueueInfo: type: object diff --git a/temporal/api/compute/v1/config.proto b/temporal/api/compute/v1/config.proto new file mode 100644 index 000000000..ad4e9b3a3 --- /dev/null +++ b/temporal/api/compute/v1/config.proto @@ -0,0 +1,24 @@ +syntax = "proto3"; + +package temporal.api.compute.v1; + +option go_package = "go.temporal.io/api/compute/v1;compute"; +option java_package = "io.temporal.api.compute.v1"; +option java_multiple_files = true; +option java_outer_classname = "ConfigProto"; +option ruby_package = "Temporalio::Api::Compute::V1"; +option csharp_namespace = "Temporalio.Api.Compute.V1"; + +import "temporal/api/compute/v1/provider.proto"; +import "temporal/api/compute/v1/scaler.proto"; + +// Config stores configuration that helps a worker control plane controller +// understand *when* and *how* to respond to worker lifecycle events. +message Config { + // Stores instructions for a worker control plane controller how to respond + // to worker lifeycle events. + temporal.api.compute.v1.Provider provider = 1; + // Informs a worker lifecycle controller *when* and *how often* to perform + // certain worker lifecycle actions like starting a serverless worker. + temporal.api.compute.v1.Scaler scaler = 2; +} diff --git a/temporal/api/compute/v1/provider.proto b/temporal/api/compute/v1/provider.proto new file mode 100644 index 000000000..3646d08d1 --- /dev/null +++ b/temporal/api/compute/v1/provider.proto @@ -0,0 +1,56 @@ +syntax = "proto3"; + +package temporal.api.compute.v1; + +option go_package = "go.temporal.io/api/compute/v1;compute"; +option java_package = "io.temporal.api.compute.v1"; +option java_multiple_files = true; +option java_outer_classname = "ProviderProto"; +option ruby_package = "Temporalio::Api::Compute::V1"; +option csharp_namespace = "Temporalio.Api.Compute.V1"; + +import "google/protobuf/any.proto"; +import "temporal/api/common/v1/message.proto"; + +// Provider stores information used by a worker control plane controller +// to respond to worker lifecycle events. For example, when a Task is received +// on a TaskQueue that has no active pollers in the last five minutes, a +// serverless worker lifecycle controller might need to invoke an AWS Lambda +// Function that itself ends up calling the SDK's worker.New() function. +message Provider { + // Type of the compute provider. This string is implementation-specific and + // can be used by implementations to understand how to interpret the + // contents of the provider_details field. + string type = 1; + // Contains provider-specific instructions and configuration. + oneof detail { + // will be an unencrypted, unencoded object of provider-specific + // information + // (-- api-linter: core::0146::any=disabled + // aip.dev/not-precedent: This needs to be extensible to + // externally-written compute providers --) + google.protobuf.Any detail_object = 2; + // will be an encrypted, encoded bytestring containing + // provider-specific information. The implementation must understand + // how to decrypt the payload. + temporal.api.common.v1.Payload detail_payload = 3; + } +} + +// ProviderDetailAWSLambda stores configuration information for Workers +// that use the AWS Lambda serverless compute platform. +// +// Workers that use AWS Lambda have their lifecycle managed by the Temporal +// Server. When a WorkerDeployment has its compute_config.provider set to use +// the AWS Lambda compute provider, the Temporal Server will invoke an AWS +// Lambda Function via its ARN. This will start the Worker that is housed +// within that AWS Lambda Function and the Worker will begin listening to Tasks +// on the WorkerDeployment's configured TaskQueue. +message ProviderDetailAWSLambda { + // A Qualified or Unqualified Lambda Function ARN of the AWS Lambda + // Function to be invoked. + string invoke_arn = 1; + // Optional AWS IAM Role ARN that will need to be assumed by the Temporal + // Server to invoke the Lambda Function. + string iam_role = 10; +} diff --git a/temporal/api/compute/v1/scaler.proto b/temporal/api/compute/v1/scaler.proto new file mode 100644 index 000000000..c995921b1 --- /dev/null +++ b/temporal/api/compute/v1/scaler.proto @@ -0,0 +1,22 @@ +syntax = "proto3"; + +package temporal.api.compute.v1; + +option go_package = "go.temporal.io/api/compute/v1;compute"; +option java_package = "io.temporal.api.compute.v1"; +option java_multiple_files = true; +option java_outer_classname = "ScalerProto"; +option ruby_package = "Temporalio::Api::Compute::V1"; +option csharp_namespace = "Temporalio.Api.Compute.V1"; + +// Scaler instructs the Temporal Service when to scale up or down the number of +// Workers that comprise a WorkerDeployment. +message Scaler { + // The lower limit for the number of Workers (in the WorkerDeployment) to + // which the Scaler can scale down. + int32 min_instances = 1; + // The upper limit for the number of Workers (in the WorkerDeployment) to + // which the Scaler can scale up. Must be greater than or equal to + // minReplicas. + int32 max_instances = 2; +} diff --git a/temporal/api/deployment/v1/message.proto b/temporal/api/deployment/v1/message.proto index b4b7883dd..0a7c431b9 100644 --- a/temporal/api/deployment/v1/message.proto +++ b/temporal/api/deployment/v1/message.proto @@ -14,6 +14,7 @@ import "google/protobuf/timestamp.proto"; import "temporal/api/enums/v1/deployment.proto"; import "temporal/api/enums/v1/task_queue.proto"; import "temporal/api/common/v1/message.proto"; +import "temporal/api/compute/v1/config.proto"; // Worker Deployment options set in SDK that need to be sent to server in every poll. // Experimental. Worker Deployments are experimental and might significantly change in the future. @@ -158,6 +159,10 @@ message WorkerDeploymentVersionInfo { // Arbitrary user-provided metadata attached to this version. VersionMetadata metadata = 10; + + // Contains information used by worker control plane controllers to handle + // scale events. + temporal.api.compute.v1.Config compute_config = 20; } // Information about workflow drainage to help the user determine when it is safe @@ -211,6 +216,10 @@ message WorkerDeploymentInfo { // relevant task queues and their partitions. temporal.api.enums.v1.RoutingConfigUpdateState routing_config_update_state = 7; + // Contains information used by worker control plane controllers to handle + // scale events. + temporal.api.compute.v1.Config compute_config = 20; + message WorkerDeploymentVersionSummary { // Deprecated. Use `deployment_version`. string version = 1 [deprecated = true]; @@ -311,4 +320,4 @@ message InheritedAutoUpgradeInfo { temporal.api.deployment.v1.WorkerDeploymentVersion source_deployment_version = 1; // The revision number of the source deployment version of the parent/previous workflow. int64 source_deployment_revision_number = 2; -} \ No newline at end of file +} diff --git a/temporal/api/workflowservice/v1/request_response.proto b/temporal/api/workflowservice/v1/request_response.proto index 1e5ce9a4d..f7bf1a2c9 100644 --- a/temporal/api/workflowservice/v1/request_response.proto +++ b/temporal/api/workflowservice/v1/request_response.proto @@ -25,6 +25,7 @@ import "temporal/api/common/v1/message.proto"; import "temporal/api/history/v1/message.proto"; import "temporal/api/workflow/v1/message.proto"; import "temporal/api/command/v1/message.proto"; +import "temporal/api/compute/v1/config.proto"; import "temporal/api/deployment/v1/message.proto"; import "temporal/api/failure/v1/message.proto"; import "temporal/api/filter/v1/message.proto"; @@ -2283,6 +2284,99 @@ message SetWorkerDeploymentRampingVersionResponse { float previous_percentage = 3 [deprecated = true]; } +// Creates a new WorkerDeployment. +message CreateWorkerDeploymentRequest { + string namespace = 1; + // The name of the Worker Deployment to create. If a Worker Deployment with + // this name already exists, an error will be returned. + string deployment_name = 2; + + // Optional. Indicates the Worker Deployment should use a particular + // versioning strategy. + // + // If empty, defaults to UNVERSIONED. + temporal.api.enums.v1.WorkerVersioningMode worker_versioning_mode = 3; + + // Optional. Indicates the task queues that are associated with the Worker + // Deployment. These task queues are used as the default task queues to + // associate to new Worker Deployment Versions created for this Worker + // Deployment. + repeated temporal.api.taskqueue.v1.TaskQueue task_queues = 4; + + // Optional. Contains the new worker compute configuration for the Worker + // Deployment. Used as the default compute configuration for new Worker + // Deployment Versions created for this Worker Deployment. + temporal.api.compute.v1.Config compute_config = 6; + + // Optional. The identity of the client who initiated this request. + string identity = 15; + // A unique identifier for this create request for idempotence. Typically UUIDv4. + string request_id = 16; +} + +message CreateWorkerDeploymentResponse { + // This value is returned so that it can be optionally passed to APIs that + // write to the WorkerDeployment state to ensure that the state did not + // change between this API call and a future write. + bytes conflict_token = 1; +} + +// Updates the compute configuration for an existing WorkerDeployment. +message UpdateWorkerDeploymentComputeConfigRequest { + string namespace = 1; + // The name of the Worker Deployment to target. If a Worker Deployment with + // this name does not exist, one is created. + string deployment_name = 2; + + // Contains the new worker compute configuration for the + // WorkerDeployment. + temporal.api.compute.v1.Config compute_config = 6; + + // Optional. This can be the value of conflict_token from a Describe or + // another UpdateWorkerDeploymentComputeProvider API call. + // + // Passing a non-nil conflict token will cause this request to fail if the + // WorkerDeployment's configuration has been modified between the API call + // that generated the token and this one. + bytes conflict_token = 14; + // Optional. The identity of the client who initiated this request. + string identity = 15; +} + +message UpdateWorkerDeploymentComputeConfigResponse { + // This value is returned so that it can be optionally passed to APIs that + // write to the WorkerDeployment state to ensure that the state did not + // change between this API call and a future write. + bytes conflict_token = 1; +} + +// Updates the compute configuration for an existing WorkerDeploymentVersion. +message UpdateWorkerDeploymentVersionComputeConfigRequest { + string namespace = 1; + temporal.api.deployment.v1.WorkerDeploymentVersion deployment_version = 5; + + // Contains the new worker compute configuration for the + // WorkerDeploymentVersion. + temporal.api.compute.v1.Config compute_config = 6; + + // Optional. This can be the value of conflict_token from a Describe or + // another UpdateWorkerDeploymentVersionComputeProvider API call. + // + // Passing a non-nil conflict token will cause this request to fail if the + // WorkerDeploymentVersion's configuration has been modified between the + // API call that generated the token and this one. + bytes conflict_token = 14; + // Optional. The identity of the client who initiated this request. + string identity = 15; +} + +message UpdateWorkerDeploymentVersionComputeConfigResponse { + // This value is returned so that it can be optionally passed to APIs that + // write to the WorkerDeploymentVersion state to ensure that the state did + // not change between this API call and a future write. + bytes conflict_token = 1; +} + message ListWorkerDeploymentsRequest { string namespace = 1; int32 page_size = 2; diff --git a/temporal/api/workflowservice/v1/service.proto b/temporal/api/workflowservice/v1/service.proto index 119b71155..638aee690 100644 --- a/temporal/api/workflowservice/v1/service.proto +++ b/temporal/api/workflowservice/v1/service.proto @@ -919,6 +919,52 @@ service WorkflowService { }; } + // Creates a new Worker Deployment. + // + // Experimental. This API might significantly change or be removed in a + // future release. + rpc CreateWorkerDeployment (CreateWorkerDeploymentRequest) returns (CreateWorkerDeploymentResponse) { + option (google.api.http) = { + post: "/namespaces/{namespace}/worker-deployments/{deployment_name}" + body: "*" + additional_bindings { + post: "/api/v1/namespaces/{namespace}/worker-deployments/{deployment_name}" + body: "*" + } + }; + } + + // Updates the compute configuration for an existing Worker Deployment. + // + // Experimental. This API might significantly change or be removed in a + // future release. + rpc UpdateWorkerDeploymentComputeConfig (UpdateWorkerDeploymentComputeConfigRequest) returns (UpdateWorkerDeploymentComputeConfigResponse) { + option (google.api.http) = { + post: "/namespaces/{namespace}/worker-deployments/{deployment_name}/update-compute-config" + body: "*" + additional_bindings { + post: "/api/v1/namespaces/{namespace}/worker-deployments/{deployment_name}/update-compute-config" + body: "*" + } + }; + } + + // Updates the compute configuration for an existing Worker Deployment + // Version. + // + // Experimental. This API might significantly change or be removed in a + // future release. + rpc UpdateWorkerDeploymentVersionComputeConfig (UpdateWorkerDeploymentVersionComputeConfigRequest) returns (UpdateWorkerDeploymentVersionComputeConfigResponse) { + option (google.api.http) = { + post: "/namespaces/{namespace}/worker-deployment-versions/{deployment_version.deployment_name}/{deployment_version.build_id}/update-compute-config" + body: "*" + additional_bindings { + post: "/api/v1/namespaces/{namespace}/worker-deployment-versions/{deployment_version.deployment_name}/{deployment_version.build_id}/update-compute-config" + body: "*" + } + }; + } + // Updates the user-given metadata attached to a Worker Deployment Version. // Experimental. This API might significantly change or be removed in a future release. rpc UpdateWorkerDeploymentVersionMetadata (UpdateWorkerDeploymentVersionMetadataRequest) returns (UpdateWorkerDeploymentVersionMetadataResponse) {