diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 91a2bf812..d1705904d 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -416,7 +416,7 @@ }, "/api/v1/namespaces/{namespace}/activities/cancel-by-id": { "post": { - "summary": "See `RecordActivityTaskCanceled`. This version allows clients to record failures by\nnamespace/workflow id/activity id instead of task token.", + "summary": "See `RespondActivityTaskCanceled`. This version allows clients to record failures by\nnamespace/workflow id/activity id instead of task token.", "operationId": "RespondActivityTaskCanceledById2", "responses": { "200": { @@ -496,7 +496,7 @@ }, "/api/v1/namespaces/{namespace}/activities/complete-by-id": { "post": { - "summary": "See `RecordActivityTaskCompleted`. This version allows clients to record completions by\nnamespace/workflow id/activity id instead of task token.", + "summary": "See `RespondActivityTaskCompleted`. This version allows clients to record completions by\nnamespace/workflow id/activity id instead of task token.", "operationId": "RespondActivityTaskCompletedById2", "responses": { "200": { @@ -859,13 +859,13 @@ }, "/api/v1/namespaces/{namespace}/activities/{activityId}": { "get": { - "summary": "PollActivityExecution returns the status and/or outcome of an activity execution.\nSupported use cases include\n- Get current activity info without waiting\n- Wait for next state change and return activity info\n- Wait for completion and return outcome", - "operationId": "PollActivityExecution2", + "summary": "DescribeActivityExecution returns information about an activity execution.\nSupported use cases include:\n- Get current activity info without waiting\n- Long-poll for next state change and return new activity info\nResponse can optionally include activity input or outcome (if the activity has completed).", + "operationId": "DescribeActivityExecution2", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/v1PollActivityExecutionResponse" + "$ref": "#/definitions/v1DescribeActivityExecutionResponse" } }, "default": { @@ -895,13 +895,6 @@ "required": false, "type": "string" }, - { - "name": "includeInfo", - "description": "Include the info field from the response.", - "in": "query", - "required": false, - "type": "boolean" - }, { "name": "includeInput", "description": "Include the input field in the response.", @@ -911,14 +904,14 @@ }, { "name": "includeOutcome", - "description": "Include the outcome field in the response.", + "description": "Include the outcome (result/failure) in the response if the activity has completed.", "in": "query", "required": false, "type": "boolean" }, { - "name": "waitAnyStateChange.longPollToken", - "description": "Token from a previous PollActivityExecutionResponse used to inform the server of the\nlast state seen by the caller. If present, run_id must also be present.", + "name": "longPollToken", + "description": "Token from a previous DescribeActivityExecutionResponse. If present, long-poll until activity\nstate changes from the state encoded in this token. If absent, return current state immediately.\nIf present, run_id must also be present.\nNote that activity state may change multiple times between requests, therefore it is not\nguaranteed that a client making a sequence of long-poll requests will see a complete\nsequence of state changes.", "in": "query", "required": false, "type": "string", @@ -1020,6 +1013,50 @@ ] } }, + "/api/v1/namespaces/{namespace}/activities/{activityId}/outcome": { + "get": { + "summary": "GetActivityExecutionOutcome long-polls for an activity execution to complete and returns\nthe outcome (result or failure).", + "operationId": "GetActivityExecutionOutcome2", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1GetActivityExecutionOutcomeResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "namespace", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "activityId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "runId", + "description": "Activity run ID. If empty the request targets the latest run.", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "WorkflowService" + ] + } + }, "/api/v1/namespaces/{namespace}/activities/{activityId}/terminate": { "post": { "summary": "TerminateActivityExecution terminates an existing activity execution immediately.", @@ -4994,7 +5031,7 @@ }, "/namespaces/{namespace}/activities/cancel-by-id": { "post": { - "summary": "See `RecordActivityTaskCanceled`. This version allows clients to record failures by\nnamespace/workflow id/activity id instead of task token.", + "summary": "See `RespondActivityTaskCanceled`. This version allows clients to record failures by\nnamespace/workflow id/activity id instead of task token.", "operationId": "RespondActivityTaskCanceledById", "responses": { "200": { @@ -5074,7 +5111,7 @@ }, "/namespaces/{namespace}/activities/complete-by-id": { "post": { - "summary": "See `RecordActivityTaskCompleted`. This version allows clients to record completions by\nnamespace/workflow id/activity id instead of task token.", + "summary": "See `RespondActivityTaskCompleted`. This version allows clients to record completions by\nnamespace/workflow id/activity id instead of task token.", "operationId": "RespondActivityTaskCompletedById", "responses": { "200": { @@ -5437,13 +5474,13 @@ }, "/namespaces/{namespace}/activities/{activityId}": { "get": { - "summary": "PollActivityExecution returns the status and/or outcome of an activity execution.\nSupported use cases include\n- Get current activity info without waiting\n- Wait for next state change and return activity info\n- Wait for completion and return outcome", - "operationId": "PollActivityExecution", + "summary": "DescribeActivityExecution returns information about an activity execution.\nSupported use cases include:\n- Get current activity info without waiting\n- Long-poll for next state change and return new activity info\nResponse can optionally include activity input or outcome (if the activity has completed).", + "operationId": "DescribeActivityExecution", "responses": { "200": { "description": "A successful response.", "schema": { - "$ref": "#/definitions/v1PollActivityExecutionResponse" + "$ref": "#/definitions/v1DescribeActivityExecutionResponse" } }, "default": { @@ -5473,13 +5510,6 @@ "required": false, "type": "string" }, - { - "name": "includeInfo", - "description": "Include the info field from the response.", - "in": "query", - "required": false, - "type": "boolean" - }, { "name": "includeInput", "description": "Include the input field in the response.", @@ -5489,14 +5519,14 @@ }, { "name": "includeOutcome", - "description": "Include the outcome field in the response.", + "description": "Include the outcome (result/failure) in the response if the activity has completed.", "in": "query", "required": false, "type": "boolean" }, { - "name": "waitAnyStateChange.longPollToken", - "description": "Token from a previous PollActivityExecutionResponse used to inform the server of the\nlast state seen by the caller. If present, run_id must also be present.", + "name": "longPollToken", + "description": "Token from a previous DescribeActivityExecutionResponse. If present, long-poll until activity\nstate changes from the state encoded in this token. If absent, return current state immediately.\nIf present, run_id must also be present.\nNote that activity state may change multiple times between requests, therefore it is not\nguaranteed that a client making a sequence of long-poll requests will see a complete\nsequence of state changes.", "in": "query", "required": false, "type": "string", @@ -5598,6 +5628,50 @@ ] } }, + "/namespaces/{namespace}/activities/{activityId}/outcome": { + "get": { + "summary": "GetActivityExecutionOutcome long-polls for an activity execution to complete and returns\nthe outcome (result or failure).", + "operationId": "GetActivityExecutionOutcome", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1GetActivityExecutionOutcomeResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "namespace", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "activityId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "runId", + "description": "Activity run ID. If empty the request targets the latest run.", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "WorkflowService" + ] + } + }, "/namespaces/{namespace}/activities/{activityId}/terminate": { "post": { "summary": "TerminateActivityExecution terminates an existing activity execution immediately.", @@ -8891,19 +8965,6 @@ } } }, - "PollActivityExecutionRequestCompletionWaitOptions": { - "type": "object" - }, - "PollActivityExecutionRequestStateChangeWaitOptions": { - "type": "object", - "properties": { - "longPollToken": { - "type": "string", - "format": "byte", - "description": "Token from a previous PollActivityExecutionResponse used to inform the server of the\nlast state seen by the caller. If present, run_id must also be present." - } - } - }, "PostResetOperationSignalWorkflow": { "type": "object", "properties": { @@ -10127,8 +10188,29 @@ "activityType": { "$ref": "#/definitions/v1ActivityType" }, - "options": { - "$ref": "#/definitions/v1ActivityOptions" + "taskQueue": { + "$ref": "#/definitions/v1TaskQueue", + "description": "Task queue to schedule this activity on." + }, + "scheduleToCloseTimeout": { + "type": "string", + "description": "Indicates how long the caller is willing to wait for an activity completion. Limits how long\nretries will be attempted. Either this or `start_to_close_timeout` must be specified.\n" + }, + "scheduleToStartTimeout": { + "type": "string", + "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` if not specified.\n" + }, + "startToCloseTimeout": { + "type": "string", + "description": "Maximum time an activity is allowed to execute after being picked up by a worker. This\ntimeout is always retryable. Either this or `schedule_to_close_timeout` must be\nspecified.\n" + }, + "heartbeatTimeout": { + "type": "string", + "description": "Maximum permitted time between successful worker heartbeats." + }, + "retryPolicy": { + "$ref": "#/definitions/v1RetryPolicy", + "description": "The retry policy for the activity. Will never exceed `schedule_to_close_timeout`." }, "input": { "$ref": "#/definitions/v1Payloads", @@ -10535,17 +10617,28 @@ "type": "boolean", "description": "Update all pending workflow activities.\nOnly available if workflow_id is provided.\nMutually exclusive with activity_id and workflow_activity_type.\n\nNote: Experimental - the behavior of updating all activities may change or be removed in a future release." }, - "activityOptions": { - "$ref": "#/definitions/v1ActivityOptions", - "description": "Activity options. Partial updates are accepted and controlled by update_mask\nMutually exclusive with restore_original." - }, - "updateMask": { - "type": "string", - "title": "Controls which fields from `activity_options` will be applied" - }, "restoreOriginal": { "type": "boolean", - "description": "If set, the activity options will be restored to the defaults.\nDefault options are then options activity was originally created with.\nFor workflow activities the original options are restored from first ActivityTaskScheduled event.\nMutually exclusive with activity_options." + "description": "If set, the activity options will be restored to the options the activity was originally\ncreated with. For workflow activities the original options are restored from first\nActivityTaskScheduled event. Mutually exclusive with the activity options fields below." + }, + "taskQueue": { + "$ref": "#/definitions/v1TaskQueue", + "description": "Activity options. Mutually exclusive with restore_original." + }, + "scheduleToCloseTimeout": { + "type": "string" + }, + "scheduleToStartTimeout": { + "type": "string" + }, + "startToCloseTimeout": { + "type": "string" + }, + "heartbeatTimeout": { + "type": "string" + }, + "retryPolicy": { + "$ref": "#/definitions/v1RetryPolicy" } }, "title": "TODO: update batch\nNOTE: keep in sync with temporal.api.batch.v1.BatchOperationUpdateActivityOptions" @@ -12838,6 +12931,36 @@ "type": "object", "description": "Deprecated." }, + "v1DescribeActivityExecutionResponse": { + "type": "object", + "properties": { + "runId": { + "type": "string", + "description": "The run ID of the activity, useful when run_id was not specified in the request." + }, + "info": { + "$ref": "#/definitions/v1ActivityExecutionInfo", + "description": "Information about the activity execution." + }, + "input": { + "$ref": "#/definitions/v1Payloads", + "description": "Serialized activity input, passed as arguments to the activity function.\nOnly set if include_input was true in the request." + }, + "result": { + "$ref": "#/definitions/v1Payloads", + "description": "The result if the activity completed successfully." + }, + "failure": { + "$ref": "#/definitions/apifailurev1Failure", + "description": "The failure if the activity completed unsuccessfully." + }, + "longPollToken": { + "type": "string", + "format": "byte", + "description": "Token for follow-on long-poll requests. Absent only if the activity is complete." + } + } + }, "v1DescribeBatchOperationResponse": { "type": "object", "properties": { @@ -13334,6 +13457,23 @@ } } }, + "v1GetActivityExecutionOutcomeResponse": { + "type": "object", + "properties": { + "runId": { + "type": "string", + "description": "The run ID of the activity, useful when run_id was not specified in the request." + }, + "result": { + "$ref": "#/definitions/v1Payloads", + "description": "The result if the activity completed successfully." + }, + "failure": { + "$ref": "#/definitions/apifailurev1Failure", + "description": "The failure if the activity completed unsuccessfully." + } + } + }, "v1GetClusterInfoResponse": { "type": "object", "properties": { @@ -15116,36 +15256,6 @@ } } }, - "v1PollActivityExecutionResponse": { - "type": "object", - "properties": { - "runId": { - "type": "string", - "description": "The run ID of the activity, useful when run_id was not specified in the request." - }, - "info": { - "$ref": "#/definitions/v1ActivityExecutionInfo", - "description": "Only set if include_info was true in the request." - }, - "input": { - "$ref": "#/definitions/v1Payloads", - "description": "Serialized activity input, passed as arguments to the activity function." - }, - "result": { - "$ref": "#/definitions/v1Payloads", - "description": "The result if the activity completed successfully." - }, - "failure": { - "$ref": "#/definitions/apifailurev1Failure", - "description": "The failure if the activity completed unsuccessfully." - }, - "stateChangeLongPollToken": { - "type": "string", - "format": "byte", - "description": "Token to use for a follow-on request using wait_any_state_change.\nOnly set if wait_policy was wait_any_state_change and the activity is not complete." - } - } - }, "v1PollActivityTaskQueueResponse": { "type": "object", "properties": { @@ -17713,9 +17823,24 @@ "v1UpdateActivityExecutionOptionsResponse": { "type": "object", "properties": { - "activityOptions": { - "$ref": "#/definitions/v1ActivityOptions", - "title": "Activity options after an update" + "taskQueue": { + "$ref": "#/definitions/v1TaskQueue", + "description": "Activity options after the update." + }, + "scheduleToCloseTimeout": { + "type": "string" + }, + "scheduleToStartTimeout": { + "type": "string" + }, + "startToCloseTimeout": { + "type": "string" + }, + "heartbeatTimeout": { + "type": "string" + }, + "retryPolicy": { + "$ref": "#/definitions/v1RetryPolicy" } } }, diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index c1f609fa9..6d8554467 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -389,7 +389,7 @@ paths: tags: - WorkflowService description: |- - See `RecordActivityTaskCanceled`. This version allows clients to record failures by + See `RespondActivityTaskCanceled`. This version allows clients to record failures by namespace/workflow id/activity id instead of task token. (-- api-linter: core::0136::prepositions=disabled @@ -463,7 +463,7 @@ paths: tags: - WorkflowService description: |- - See `RecordActivityTaskCompleted`. This version allows clients to record completions by + See `RespondActivityTaskCompleted`. This version allows clients to record completions by namespace/workflow id/activity id instead of task token. (-- api-linter: core::0136::prepositions=disabled @@ -827,12 +827,12 @@ paths: tags: - WorkflowService description: |- - PollActivityExecution returns the status and/or outcome of an activity execution. - Supported use cases include + DescribeActivityExecution returns information about an activity execution. + Supported use cases include: - Get current activity info without waiting - - Wait for next state change and return activity info - - Wait for completion and return outcome - operationId: PollActivityExecution + - Long-poll for next state change and return new activity info + Response can optionally include activity input or outcome (if the activity has completed). + operationId: DescribeActivityExecution parameters: - name: namespace in: path @@ -849,11 +849,6 @@ paths: description: Activity run ID. If empty the request targets the latest run. schema: type: string - - name: includeInfo - in: query - description: Include the info field from the response. - schema: - type: boolean - name: includeInput in: query description: Include the input field in the response. @@ -861,14 +856,18 @@ paths: type: boolean - name: includeOutcome in: query - description: Include the outcome field in the response. + description: Include the outcome (result/failure) in the response if the activity has completed. schema: type: boolean - - name: waitAnyStateChange.longPollToken + - name: longPollToken in: query description: |- - Token from a previous PollActivityExecutionResponse used to inform the server of the - last state seen by the caller. If present, run_id must also be present. + Token from a previous DescribeActivityExecutionResponse. If present, long-poll until activity + state changes from the state encoded in this token. If absent, return current state immediately. + If present, run_id must also be present. + Note that activity state may change multiple times between requests, therefore it is not + guaranteed that a client making a sequence of long-poll requests will see a complete + sequence of state changes. schema: type: string format: bytes @@ -878,7 +877,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/PollActivityExecutionResponse' + $ref: '#/components/schemas/DescribeActivityExecutionResponse' default: description: Default error response content: @@ -969,6 +968,43 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' + /api/v1/namespaces/{namespace}/activities/{activityId}/outcome: + get: + tags: + - WorkflowService + description: |- + GetActivityExecutionOutcome long-polls for an activity execution to complete and returns + the outcome (result or failure). + operationId: GetActivityExecutionOutcome + parameters: + - name: namespace + in: path + required: true + schema: + type: string + - name: activityId + in: path + required: true + schema: + type: string + - name: runId + in: query + description: Activity run ID. If empty the request targets the latest run. + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/GetActivityExecutionOutcomeResponse' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' /api/v1/namespaces/{namespace}/activities/{activityId}/terminate: post: tags: @@ -4558,7 +4594,7 @@ paths: tags: - WorkflowService description: |- - See `RecordActivityTaskCanceled`. This version allows clients to record failures by + See `RespondActivityTaskCanceled`. This version allows clients to record failures by namespace/workflow id/activity id instead of task token. (-- api-linter: core::0136::prepositions=disabled @@ -4632,7 +4668,7 @@ paths: tags: - WorkflowService description: |- - See `RecordActivityTaskCompleted`. This version allows clients to record completions by + See `RespondActivityTaskCompleted`. This version allows clients to record completions by namespace/workflow id/activity id instead of task token. (-- api-linter: core::0136::prepositions=disabled @@ -4996,12 +5032,12 @@ paths: tags: - WorkflowService description: |- - PollActivityExecution returns the status and/or outcome of an activity execution. - Supported use cases include + DescribeActivityExecution returns information about an activity execution. + Supported use cases include: - Get current activity info without waiting - - Wait for next state change and return activity info - - Wait for completion and return outcome - operationId: PollActivityExecution + - Long-poll for next state change and return new activity info + Response can optionally include activity input or outcome (if the activity has completed). + operationId: DescribeActivityExecution parameters: - name: namespace in: path @@ -5018,11 +5054,6 @@ paths: description: Activity run ID. If empty the request targets the latest run. schema: type: string - - name: includeInfo - in: query - description: Include the info field from the response. - schema: - type: boolean - name: includeInput in: query description: Include the input field in the response. @@ -5030,14 +5061,18 @@ paths: type: boolean - name: includeOutcome in: query - description: Include the outcome field in the response. + description: Include the outcome (result/failure) in the response if the activity has completed. schema: type: boolean - - name: waitAnyStateChange.longPollToken + - name: longPollToken in: query description: |- - Token from a previous PollActivityExecutionResponse used to inform the server of the - last state seen by the caller. If present, run_id must also be present. + Token from a previous DescribeActivityExecutionResponse. If present, long-poll until activity + state changes from the state encoded in this token. If absent, return current state immediately. + If present, run_id must also be present. + Note that activity state may change multiple times between requests, therefore it is not + guaranteed that a client making a sequence of long-poll requests will see a complete + sequence of state changes. schema: type: string format: bytes @@ -5047,7 +5082,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/PollActivityExecutionResponse' + $ref: '#/components/schemas/DescribeActivityExecutionResponse' default: description: Default error response content: @@ -5138,6 +5173,43 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' + /namespaces/{namespace}/activities/{activityId}/outcome: + get: + tags: + - WorkflowService + description: |- + GetActivityExecutionOutcome long-polls for an activity execution to complete and returns + the outcome (result or failure). + operationId: GetActivityExecutionOutcome + parameters: + - name: namespace + in: path + required: true + schema: + type: string + - name: activityId + in: path + required: true + schema: + type: string + - name: runId + in: query + description: Activity run ID. If empty the request targets the latest run. + schema: + type: string + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/GetActivityExecutionOutcomeResponse' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' /namespaces/{namespace}/activities/{activityId}/terminate: post: tags: @@ -9452,6 +9524,34 @@ components: Holds information about ongoing transition of a workflow execution from one worker deployment version to another. Experimental. Might change in the future. + DescribeActivityExecutionResponse: + type: object + properties: + runId: + type: string + description: The run ID of the activity, useful when run_id was not specified in the request. + info: + allOf: + - $ref: '#/components/schemas/ActivityExecutionInfo' + description: Information about the activity execution. + input: + allOf: + - $ref: '#/components/schemas/Payloads' + description: |- + Serialized activity input, passed as arguments to the activity function. + Only set if include_input was true in the request. + result: + allOf: + - $ref: '#/components/schemas/Payloads' + description: The result if the activity completed successfully. + failure: + allOf: + - $ref: '#/components/schemas/Failure' + description: The failure if the activity completed unsuccessfully. + longPollToken: + type: string + description: Token for follow-on long-poll requests. Absent only if the activity is complete. + format: bytes DescribeBatchOperationResponse: type: object properties: @@ -9986,6 +10086,20 @@ components: allOf: - $ref: '#/components/schemas/WorkerConfig' description: The worker configuration. + GetActivityExecutionOutcomeResponse: + type: object + properties: + runId: + type: string + description: The run ID of the activity, useful when run_id was not specified in the request. + result: + allOf: + - $ref: '#/components/schemas/Payloads' + description: The result if the activity completed successfully. + failure: + allOf: + - $ref: '#/components/schemas/Failure' + description: The failure if the activity completed unsuccessfully. GetClusterInfoResponse: type: object properties: @@ -11589,34 +11703,6 @@ components: version: type: string description: The version of the plugin, may be empty. - PollActivityExecutionResponse: - type: object - properties: - runId: - type: string - description: The run ID of the activity, useful when run_id was not specified in the request. - info: - allOf: - - $ref: '#/components/schemas/ActivityExecutionInfo' - description: Only set if include_info was true in the request. - input: - allOf: - - $ref: '#/components/schemas/Payloads' - description: Serialized activity input, passed as arguments to the activity function. - result: - allOf: - - $ref: '#/components/schemas/Payloads' - description: The result if the activity completed successfully. - failure: - allOf: - - $ref: '#/components/schemas/Failure' - description: The failure if the activity completed unsuccessfully. - stateChangeLongPollToken: - type: string - description: |- - Token to use for a follow-on request using wait_any_state_change. - Only set if wait_policy was wait_any_state_change and the activity is not complete. - format: bytes PollActivityTaskQueueResponse: type: object properties: @@ -13792,8 +13878,47 @@ components: type: string activityType: $ref: '#/components/schemas/ActivityType' - options: - $ref: '#/components/schemas/ActivityOptions' + taskQueue: + allOf: + - $ref: '#/components/schemas/TaskQueue' + description: Task queue to schedule this activity on. + scheduleToCloseTimeout: + pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$ + type: string + description: |- + Indicates how long the caller is willing to wait for an activity completion. Limits how long + retries will be attempted. Either this or `start_to_close_timeout` must be specified. + + (-- api-linter: core::0140::prepositions=disabled + aip.dev/not-precedent: "to" is used to indicate interval. --) + scheduleToStartTimeout: + pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$ + type: string + description: |- + Limits time an activity task can stay in a task queue before a worker picks it up. This + timeout is always non retryable, as all a retry would achieve is to put it back into the same + queue. Defaults to `schedule_to_close_timeout` if not specified. + + (-- api-linter: core::0140::prepositions=disabled + aip.dev/not-precedent: "to" is used to indicate interval. --) + startToCloseTimeout: + pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$ + type: string + description: |- + Maximum time an activity is allowed to execute after being picked up by a worker. This + timeout is always retryable. Either this or `schedule_to_close_timeout` must be + specified. + + (-- api-linter: core::0140::prepositions=disabled + aip.dev/not-precedent: "to" is used to indicate interval. --) + heartbeatTimeout: + pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$ + type: string + description: Maximum permitted time between successful worker heartbeats. + retryPolicy: + allOf: + - $ref: '#/components/schemas/RetryPolicy' + description: The retry policy for the activity. Will never exceed `schedule_to_close_timeout`. input: allOf: - $ref: '#/components/schemas/Payloads' @@ -14823,33 +14948,72 @@ components: Mutually exclusive with activity_id and workflow_activity_type. Note: Experimental - the behavior of updating all activities may change or be removed in a future release. - activityOptions: + restoreOriginal: + type: boolean + description: |- + If set, the activity options will be restored to the options the activity was originally + created with. For workflow activities the original options are restored from first + ActivityTaskScheduled event. Mutually exclusive with the activity options fields below. + taskQueue: allOf: - - $ref: '#/components/schemas/ActivityOptions' + - $ref: '#/components/schemas/TaskQueue' + description: Activity options. Mutually exclusive with restore_original. + scheduleToCloseTimeout: + pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$ + type: string description: |- - Activity options. Partial updates are accepted and controlled by update_mask - Mutually exclusive with restore_original. - updateMask: + (-- api-linter: core::0140::prepositions=disabled + aip.dev/not-precedent: "to" is used to indicate interval. --) + scheduleToStartTimeout: + pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$ type: string - description: Controls which fields from `activity_options` will be applied - format: field-mask - restoreOriginal: - type: boolean description: |- - If set, the activity options will be restored to the defaults. - Default options are then options activity was originally created with. - For workflow activities the original options are restored from first ActivityTaskScheduled event. - Mutually exclusive with activity_options. + (-- api-linter: core::0140::prepositions=disabled + aip.dev/not-precedent: "to" is used to indicate interval. --) + startToCloseTimeout: + pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$ + type: string + description: |- + (-- api-linter: core::0140::prepositions=disabled + aip.dev/not-precedent: "to" is used to indicate interval. --) + heartbeatTimeout: + pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$ + type: string + retryPolicy: + $ref: '#/components/schemas/RetryPolicy' description: |- TODO: update batch NOTE: keep in sync with temporal.api.batch.v1.BatchOperationUpdateActivityOptions UpdateActivityExecutionOptionsResponse: type: object properties: - activityOptions: + taskQueue: allOf: - - $ref: '#/components/schemas/ActivityOptions' - description: Activity options after an update + - $ref: '#/components/schemas/TaskQueue' + description: Activity options after the update. + scheduleToCloseTimeout: + pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$ + type: string + description: |- + (-- api-linter: core::0140::prepositions=disabled + aip.dev/not-precedent: "to" is used to indicate interval. --) + scheduleToStartTimeout: + pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$ + type: string + description: |- + (-- api-linter: core::0140::prepositions=disabled + aip.dev/not-precedent: "to" is used to indicate interval. --) + startToCloseTimeout: + pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$ + type: string + description: |- + (-- api-linter: core::0140::prepositions=disabled + aip.dev/not-precedent: "to" is used to indicate interval. --) + heartbeatTimeout: + pattern: ^-?(?:0|[1-9][0-9]{0,11})(?:\.[0-9]{1,9})?s$ + type: string + retryPolicy: + $ref: '#/components/schemas/RetryPolicy' UpdateActivityOptionsRequest: type: object properties: diff --git a/temporal/api/workflowservice/v1/request_response.proto b/temporal/api/workflowservice/v1/request_response.proto index 21bc896a8..8fa6fedd3 100644 --- a/temporal/api/workflowservice/v1/request_response.proto +++ b/temporal/api/workflowservice/v1/request_response.proto @@ -2619,41 +2619,68 @@ message StartActivityExecutionRequest { string activity_id = 4; temporal.api.common.v1.ActivityType activity_type = 5; - temporal.api.activity.v1.ActivityOptions options = 6; + + // Task queue to schedule this activity on. + temporal.api.taskqueue.v1.TaskQueue task_queue = 6; + // Indicates how long the caller is willing to wait for an activity completion. Limits how long + // retries will be attempted. Either this or `start_to_close_timeout` must be specified. + // + // (-- api-linter: core::0140::prepositions=disabled + // aip.dev/not-precedent: "to" is used to indicate interval. --) + google.protobuf.Duration schedule_to_close_timeout = 7; + // Limits time an activity task can stay in a task queue before a worker picks it up. This + // timeout is always non retryable, as all a retry would achieve is to put it back into the same + // queue. Defaults to `schedule_to_close_timeout` if not specified. + // + // (-- api-linter: core::0140::prepositions=disabled + // aip.dev/not-precedent: "to" is used to indicate interval. --) + google.protobuf.Duration schedule_to_start_timeout = 8; + // Maximum time an activity is allowed to execute after being picked up by a worker. This + // timeout is always retryable. Either this or `schedule_to_close_timeout` must be + // specified. + // + // (-- api-linter: core::0140::prepositions=disabled + // aip.dev/not-precedent: "to" is used to indicate interval. --) + google.protobuf.Duration start_to_close_timeout = 9; + // Maximum permitted time between successful worker heartbeats. + google.protobuf.Duration heartbeat_timeout = 10; + // The retry policy for the activity. Will never exceed `schedule_to_close_timeout`. + temporal.api.common.v1.RetryPolicy retry_policy = 11; + // Serialized arguments to the activity. These are passed as arguments to the activity function. - temporal.api.common.v1.Payloads input = 7; + temporal.api.common.v1.Payloads input = 12; // Defines whether to allow re-using the activity id from a previously *closed* activity. // The default policy is ACTIVITY_ID_REUSE_POLICY_ALLOW_DUPLICATE. - temporal.api.enums.v1.ActivityIdReusePolicy id_reuse_policy = 8; + temporal.api.enums.v1.ActivityIdReusePolicy id_reuse_policy = 13; // Defines how to resolve an activity id conflict with a *running* activity. // The default policy is ACTIVITY_ID_CONFLICT_POLICY_FAIL. - temporal.api.enums.v1.ActivityIdConflictPolicy id_conflict_policy = 9; + temporal.api.enums.v1.ActivityIdConflictPolicy id_conflict_policy = 14; // Arbitrary structured data that can be attached to the activity execution and made available via the list and // describe APIs. - temporal.api.common.v1.Memo memo = 10; + temporal.api.common.v1.Memo memo = 15; // Search attributes for indexing. - temporal.api.common.v1.SearchAttributes search_attributes = 11; + temporal.api.common.v1.SearchAttributes search_attributes = 16; // Header for context propagation and tracing purposes. - temporal.api.common.v1.Header header = 12; + temporal.api.common.v1.Header header = 17; // Request to get the first activity task inline in the response bypassing matching service and worker polling. // If set to `true` the caller is expected to have a worker available and capable of processing the task. // The returned task will be marked as started and is expected to be completed by the specified // `schedule_to_close_timeout`. - bool request_eager_execution = 13; + bool request_eager_execution = 18; // Callbacks to be called by the server when this activity reaches a terminal status. // Callback addresses must be whitelisted in the server's dynamic configuration. - repeated temporal.api.common.v1.Callback completion_callbacks = 14; + repeated temporal.api.common.v1.Callback completion_callbacks = 19; // Metadata for use by user interfaces to display the fixed as-of-start summary and details of the activity. - temporal.api.sdk.v1.UserMetadata user_metadata = 15; + temporal.api.sdk.v1.UserMetadata user_metadata = 20; // Links to be associated with the activity. - repeated temporal.api.common.v1.Link links = 16; + repeated temporal.api.common.v1.Link links = 21; // Defines actions to be done to the existing running activity when ACTIVITY_ID_CONFLICT_POLICY_USE_EXISTING is used. If not // set or empty, it won't do anything to the existing running activity. - temporal.api.activity.v1.OnConflictOptions on_conflict_options = 17; + temporal.api.activity.v1.OnConflictOptions on_conflict_options = 22; // Priority metadata - temporal.api.common.v1.Priority priority = 18; + temporal.api.common.v1.Priority priority = 23; } message StartActivityExecutionResponse { @@ -2669,49 +2696,33 @@ message StartActivityExecutionResponse { temporal.api.common.v1.Link link = 4; } -message PollActivityExecutionRequest { +message DescribeActivityExecutionRequest { string namespace = 1; string activity_id = 2; // Activity run ID. If empty the request targets the latest run. string run_id = 3; - // Include the info field from the response. - bool include_info = 4; // Include the input field in the response. - bool include_input = 5; - // Include the outcome field in the response. - bool include_outcome = 6; - - message StateChangeWaitOptions { - // Token from a previous PollActivityExecutionResponse used to inform the server of the - // last state seen by the caller. If present, run_id must also be present. - bytes long_poll_token = 1; - } - message CompletionWaitOptions {} - - // If present, the request will be handled as a long-poll. If absent, a response will be - // returned immediately containing the current activity state. - oneof wait_policy { - // Wait for any change in activity state before responding. If long_poll_token is absent - // then the current state will be returned immediately without any wait. Otherwise the - // server will wait until activity state differs from that encoded in the token before - // returning the new state. Note that activity state may change multiple times between - // requests, therefore it is not guaranteed that a client making a sequence of long-poll - // requests will see a complete sequence of state changes. - StateChangeWaitOptions wait_any_state_change = 8; - // Wait for the activity to complete before responding. - // long_poll_token is currently ignored when waiting for completion - CompletionWaitOptions wait_completion = 9; - } -} - -message PollActivityExecutionResponse { + bool include_input = 4; + // Include the outcome (result/failure) in the response if the activity has completed. + bool include_outcome = 5; + // Token from a previous DescribeActivityExecutionResponse. If present, long-poll until activity + // state changes from the state encoded in this token. If absent, return current state immediately. + // If present, run_id must also be present. + // Note that activity state may change multiple times between requests, therefore it is not + // guaranteed that a client making a sequence of long-poll requests will see a complete + // sequence of state changes. + bytes long_poll_token = 6; +} + +message DescribeActivityExecutionResponse { // The run ID of the activity, useful when run_id was not specified in the request. string run_id = 1; - // Only set if include_info was true in the request. + // Information about the activity execution. temporal.api.activity.v1.ActivityExecutionInfo info = 2; // Serialized activity input, passed as arguments to the activity function. + // Only set if include_input was true in the request. temporal.api.common.v1.Payloads input = 3; // Only set if the activity is completed and include_outcome was true in the request. @@ -2722,9 +2733,27 @@ message PollActivityExecutionResponse { temporal.api.failure.v1.Failure failure = 5; } - // Token to use for a follow-on request using wait_any_state_change. - // Only set if wait_policy was wait_any_state_change and the activity is not complete. - bytes state_change_long_poll_token = 6; + // Token for follow-on long-poll requests. Absent only if the activity is complete. + bytes long_poll_token = 6; +} + +message GetActivityExecutionOutcomeRequest { + string namespace = 1; + string activity_id = 2; + // Activity run ID. If empty the request targets the latest run. + string run_id = 3; +} + +message GetActivityExecutionOutcomeResponse { + // The run ID of the activity, useful when run_id was not specified in the request. + string run_id = 1; + + oneof outcome { + // The result if the activity completed successfully. + temporal.api.common.v1.Payloads result = 2; + // The failure if the activity completed unsuccessfully. + temporal.api.failure.v1.Failure failure = 3; + } } @@ -2843,23 +2872,40 @@ message UpdateActivityExecutionOptionsRequest { // Note: Experimental - the behavior of updating all activities may change or be removed in a future release. bool all_workflow_activities = 7; - // Activity options. Partial updates are accepted and controlled by update_mask - // Mutually exclusive with restore_original. - temporal.api.activity.v1.ActivityOptions activity_options = 8; - - // Controls which fields from `activity_options` will be applied - google.protobuf.FieldMask update_mask = 9; + // If set, the activity options will be restored to the options the activity was originally + // created with. For workflow activities the original options are restored from first + // ActivityTaskScheduled event. Mutually exclusive with the activity options fields below. + bool restore_original = 8; - // If set, the activity options will be restored to the defaults. - // Default options are then options activity was originally created with. - // For workflow activities the original options are restored from first ActivityTaskScheduled event. - // Mutually exclusive with activity_options. - bool restore_original = 10; + // Activity options. Mutually exclusive with restore_original. + temporal.api.taskqueue.v1.TaskQueue task_queue = 9; + // (-- api-linter: core::0140::prepositions=disabled + // aip.dev/not-precedent: "to" is used to indicate interval. --) + google.protobuf.Duration schedule_to_close_timeout = 10; + // (-- api-linter: core::0140::prepositions=disabled + // aip.dev/not-precedent: "to" is used to indicate interval. --) + google.protobuf.Duration schedule_to_start_timeout = 11; + // (-- api-linter: core::0140::prepositions=disabled + // aip.dev/not-precedent: "to" is used to indicate interval. --) + google.protobuf.Duration start_to_close_timeout = 12; + google.protobuf.Duration heartbeat_timeout = 13; + temporal.api.common.v1.RetryPolicy retry_policy = 14; } message UpdateActivityExecutionOptionsResponse { - // Activity options after an update - temporal.api.activity.v1.ActivityOptions activity_options = 1; + // Activity options after the update. + temporal.api.taskqueue.v1.TaskQueue task_queue = 1; + // (-- api-linter: core::0140::prepositions=disabled + // aip.dev/not-precedent: "to" is used to indicate interval. --) + google.protobuf.Duration schedule_to_close_timeout = 2; + // (-- api-linter: core::0140::prepositions=disabled + // aip.dev/not-precedent: "to" is used to indicate interval. --) + google.protobuf.Duration schedule_to_start_timeout = 3; + // (-- api-linter: core::0140::prepositions=disabled + // aip.dev/not-precedent: "to" is used to indicate interval. --) + google.protobuf.Duration start_to_close_timeout = 4; + google.protobuf.Duration heartbeat_timeout = 5; + temporal.api.common.v1.RetryPolicy retry_policy = 6; } message PauseActivityExecutionRequest { diff --git a/temporal/api/workflowservice/v1/service.proto b/temporal/api/workflowservice/v1/service.proto index 7e872ea4d..08f28198d 100644 --- a/temporal/api/workflowservice/v1/service.proto +++ b/temporal/api/workflowservice/v1/service.proto @@ -1403,12 +1403,12 @@ service WorkflowService { }; } - // PollActivityExecution returns the status and/or outcome of an activity execution. - // Supported use cases include + // DescribeActivityExecution returns information about an activity execution. + // Supported use cases include: // - Get current activity info without waiting - // - Wait for next state change and return activity info - // - Wait for completion and return outcome - rpc PollActivityExecution (PollActivityExecutionRequest) returns (PollActivityExecutionResponse) { + // - Long-poll for next state change and return new activity info + // Response can optionally include activity input or outcome (if the activity has completed). + rpc DescribeActivityExecution (DescribeActivityExecutionRequest) returns (DescribeActivityExecutionResponse) { option (google.api.http) = { get: "/namespaces/{namespace}/activities/{activity_id}" additional_bindings { @@ -1417,6 +1417,17 @@ service WorkflowService { }; } + // GetActivityExecutionOutcome long-polls for an activity execution to complete and returns + // the outcome (result or failure). + rpc GetActivityExecutionOutcome (GetActivityExecutionOutcomeRequest) returns (GetActivityExecutionOutcomeResponse) { + option (google.api.http) = { + get: "/namespaces/{namespace}/activities/{activity_id}/outcome" + additional_bindings { + get: "/api/v1/namespaces/{namespace}/activities/{activity_id}/outcome" + } + }; + } + // ListActivityExecutions is a visibility API to list activity executions in a specific namespace. rpc ListActivityExecutions (ListActivityExecutionsRequest) returns (ListActivityExecutionsResponse) { option (google.api.http) = {