From 9d88e1234551e1cdee2b5894ec5f8e3b79bc75a6 Mon Sep 17 00:00:00 2001 From: Yuri Date: Tue, 1 Oct 2024 11:29:17 -0700 Subject: [PATCH 1/5] Add activiy APSs - pause, reset, resume, descrive --- openapi/openapiv2.json | 454 +++++++++++++++++- openapi/openapiv3.yaml | 400 ++++++++++++++- temporal/api/enums/v1/activity.proto | 41 ++ .../workflowservice/v1/request_response.proto | 90 ++++ temporal/api/workflowservice/v1/service.proto | 62 ++- 5 files changed, 1041 insertions(+), 6 deletions(-) create mode 100644 temporal/api/enums/v1/activity.proto diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 8457a409..5ab68368 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -317,6 +317,46 @@ ] } }, + "/api/v1/namespaces/{namespace}/activities/describe-by-id": { + "post": { + "summary": "DescribeActivityById is called by the client to get current activity options and state.", + "operationId": "DescribeActivityById2", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1DescribeActivityByIdResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "namespace", + "description": "Namespace of the workflow which scheduled this activity", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/WorkflowServiceDescribeActivityByIdBody" + } + } + ], + "tags": [ + "WorkflowService" + ] + } + }, "/api/v1/namespaces/{namespace}/activities/fail": { "post": { "summary": "RespondActivityTaskFailed is called by workers when processing an activity task fails.", @@ -477,9 +517,129 @@ ] } }, + "/api/v1/namespaces/{namespace}/activities/pause-by-id": { + "post": { + "summary": "PauseActivityById is called by the client to pause an activity.", + "operationId": "PauseActivityById2", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1PauseActivityByIdResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "namespace", + "description": "Namespace of the workflow which scheduled this activity", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/WorkflowServicePauseActivityByIdBody" + } + } + ], + "tags": [ + "WorkflowService" + ] + } + }, + "/api/v1/namespaces/{namespace}/activities/reset-by-id": { + "post": { + "summary": "ResetActivityById is called by the client to reset the activity to its \"original\" state.", + "operationId": "ResetActivityById2", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1ResetActivityByIdResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "namespace", + "description": "Namespace of the workflow which scheduled this activity", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/WorkflowServiceResetActivityByIdBody" + } + } + ], + "tags": [ + "WorkflowService" + ] + } + }, + "/api/v1/namespaces/{namespace}/activities/resume-by-id": { + "post": { + "summary": "ResumeActivityById is called by the client to resume the activity that is in paused or waiting state.", + "operationId": "ResumeActivityById2", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1ResumeActivityByIdResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "namespace", + "description": "Namespace of the workflow which scheduled this activity", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/WorkflowServiceResumeActivityByIdBody" + } + } + ], + "tags": [ + "WorkflowService" + ] + } + }, "/api/v1/namespaces/{namespace}/activities/update-options-by-id": { "post": { - "summary": "UpdateActivityOptionsById is called by the client to update the options of an activity", + "summary": "UpdateActivityOptionsById is called by the client to update the options of an activity.", "operationId": "UpdateActivityOptionsById2", "responses": { "200": { @@ -2925,6 +3085,46 @@ ] } }, + "/namespaces/{namespace}/activities/describe-by-id": { + "post": { + "summary": "DescribeActivityById is called by the client to get current activity options and state.", + "operationId": "DescribeActivityById", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1DescribeActivityByIdResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "namespace", + "description": "Namespace of the workflow which scheduled this activity", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/WorkflowServiceDescribeActivityByIdBody" + } + } + ], + "tags": [ + "WorkflowService" + ] + } + }, "/namespaces/{namespace}/activities/fail": { "post": { "summary": "RespondActivityTaskFailed is called by workers when processing an activity task fails.", @@ -3085,9 +3285,129 @@ ] } }, + "/namespaces/{namespace}/activities/pause-by-id": { + "post": { + "summary": "PauseActivityById is called by the client to pause an activity.", + "operationId": "PauseActivityById", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1PauseActivityByIdResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "namespace", + "description": "Namespace of the workflow which scheduled this activity", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/WorkflowServicePauseActivityByIdBody" + } + } + ], + "tags": [ + "WorkflowService" + ] + } + }, + "/namespaces/{namespace}/activities/reset-by-id": { + "post": { + "summary": "ResetActivityById is called by the client to reset the activity to its \"original\" state.", + "operationId": "ResetActivityById", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1ResetActivityByIdResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "namespace", + "description": "Namespace of the workflow which scheduled this activity", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/WorkflowServiceResetActivityByIdBody" + } + } + ], + "tags": [ + "WorkflowService" + ] + } + }, + "/namespaces/{namespace}/activities/resume-by-id": { + "post": { + "summary": "ResumeActivityById is called by the client to resume the activity that is in paused or waiting state.", + "operationId": "ResumeActivityById", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1ResumeActivityByIdResponse" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/rpcStatus" + } + } + }, + "parameters": [ + { + "name": "namespace", + "description": "Namespace of the workflow which scheduled this activity", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/WorkflowServiceResumeActivityByIdBody" + } + } + ], + "tags": [ + "WorkflowService" + ] + } + }, "/namespaces/{namespace}/activities/update-options-by-id": { "post": { - "summary": "UpdateActivityOptionsById is called by the client to update the options of an activity", + "summary": "UpdateActivityOptionsById is called by the client to update the options of an activity.", "operationId": "UpdateActivityOptionsById", "responses": { "200": { @@ -5021,6 +5341,27 @@ } } }, + "WorkflowServiceDescribeActivityByIdBody": { + "type": "object", + "properties": { + "workflowId": { + "type": "string", + "title": "Id of the workflow which scheduled this activity" + }, + "runId": { + "type": "string", + "title": "Run Id of the workflow which scheduled this activity\nif empty - latest workflow is used" + }, + "activityId": { + "type": "string", + "title": "Id of the activity we're updating" + }, + "identity": { + "type": "string", + "title": "The identity of the client who initiated this request" + } + } + }, "WorkflowServiceExecuteMultiOperationBody": { "type": "object", "properties": { @@ -5050,6 +5391,27 @@ } } }, + "WorkflowServicePauseActivityByIdBody": { + "type": "object", + "properties": { + "workflowId": { + "type": "string", + "title": "Id of the workflow which scheduled this activity" + }, + "runId": { + "type": "string", + "title": "Run Id of the workflow which scheduled this activity\nif empty - latest workflow is used" + }, + "activityId": { + "type": "string", + "title": "Id of the activity we're updating" + }, + "identity": { + "type": "string", + "title": "The identity of the client who initiated this request" + } + } + }, "WorkflowServiceQueryWorkflowBody": { "type": "object", "properties": { @@ -5155,6 +5517,35 @@ } } }, + "WorkflowServiceResetActivityByIdBody": { + "type": "object", + "properties": { + "workflowId": { + "type": "string", + "title": "Id of the workflow which scheduled this activity" + }, + "runId": { + "type": "string", + "title": "Run Id of the workflow which scheduled this activity\nif empty - latest workflow is used" + }, + "activityId": { + "type": "string", + "title": "Id of the activity we're updating" + }, + "identity": { + "type": "string", + "title": "The identity of the client who initiated this request" + }, + "forceNewRun": { + "type": "boolean", + "title": "Starts new activity even if the activity is already running" + }, + "keepPaused": { + "type": "boolean", + "title": "If activity was paused, it will be kept paused after reset" + } + } + }, "WorkflowServiceResetWorkflowExecutionBody": { "type": "object", "properties": { @@ -5341,6 +5732,31 @@ } } }, + "WorkflowServiceResumeActivityByIdBody": { + "type": "object", + "properties": { + "workflowId": { + "type": "string", + "title": "Id of the workflow which scheduled this activity" + }, + "runId": { + "type": "string", + "title": "Run Id of the workflow which scheduled this activity\nif empty - latest workflow is used" + }, + "activityId": { + "type": "string", + "title": "Id of the activity we're updating" + }, + "identity": { + "type": "string", + "title": "The identity of the client who initiated this request" + }, + "triggerImmediately": { + "type": "boolean", + "title": "Indicates that activity should be triggered immediately after resuming" + } + } + }, "WorkflowServiceSignalWithStartWorkflowExecutionBody": { "type": "object", "properties": { @@ -5996,6 +6412,18 @@ } } }, + "v1ActivityState": { + "type": "string", + "enum": [ + "ACTIVITY_STATE_UNSPECIFIED", + "ACTIVITY_STATE_SCHEDULED", + "ACTIVITY_STATE_STARTED", + "ACTIVITY_STATE_PAUSED", + "ACTIVITY_STATE_WAITING_FOR_RETRY", + "ACTIVITY_STATE_FINISHED" + ], + "default": "ACTIVITY_STATE_UNSPECIFIED" + }, "v1ActivityTaskCancelRequestedEventAttributes": { "type": "object", "properties": { @@ -7151,6 +7579,19 @@ "type": "object", "description": "Deprecated." }, + "v1DescribeActivityByIdResponse": { + "type": "object", + "properties": { + "activityOptions": { + "$ref": "#/definitions/v1ActivityOptions", + "title": "Activity options after an update" + }, + "activityState": { + "$ref": "#/definitions/v1ActivityState", + "title": "Activity state" + } + } + }, "v1DescribeBatchOperationResponse": { "type": "object", "properties": { @@ -8790,6 +9231,9 @@ "v1PatchScheduleResponse": { "type": "object" }, + "v1PauseActivityByIdResponse": { + "type": "object" + }, "v1Payload": { "description": "Arbitrary payload data in an unconstrained format.\nThis may be activity input parameters, a workflow result, a memo, etc.\n" }, @@ -9528,6 +9972,9 @@ "v1RequestCancelWorkflowExecutionResponse": { "type": "object" }, + "v1ResetActivityByIdResponse": { + "type": "object" + }, "v1ResetOptions": { "type": "object", "properties": { @@ -9739,6 +10186,9 @@ "v1RespondWorkflowTaskFailedResponse": { "type": "object" }, + "v1ResumeActivityByIdResponse": { + "type": "object" + }, "v1RetryPolicy": { "type": "object", "properties": { diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index 2a10d449..1b76652e 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -269,6 +269,41 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' + /api/v1/namespaces/{namespace}/activities/describe-by-id: + post: + tags: + - WorkflowService + description: |- + DescribeActivityById is called by the client to get current activity options and state. + (-- api-linter: core::0136::prepositions=disabled + aip.dev/not-precedent: "By" is used to indicate request type. --) + operationId: DescribeActivityById + parameters: + - name: namespace + in: path + description: Namespace of the workflow which scheduled this activity + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DescribeActivityByIdRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DescribeActivityByIdResponse' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' /api/v1/namespaces/{namespace}/activities/fail: post: tags: @@ -416,12 +451,117 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' + /api/v1/namespaces/{namespace}/activities/pause-by-id: + post: + tags: + - WorkflowService + description: |- + PauseActivityById is called by the client to pause an activity. + (-- api-linter: core::0136::prepositions=disabled + aip.dev/not-precedent: "By" is used to indicate request type. --) + operationId: PauseActivityById + parameters: + - name: namespace + in: path + description: Namespace of the workflow which scheduled this activity + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PauseActivityByIdRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/PauseActivityByIdResponse' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/namespaces/{namespace}/activities/reset-by-id: + post: + tags: + - WorkflowService + description: |- + ResetActivityById is called by the client to reset the activity to its "original" state. + (-- api-linter: core::0136::prepositions=disabled + aip.dev/not-precedent: "By" is used to indicate request type. --) + operationId: ResetActivityById + parameters: + - name: namespace + in: path + description: Namespace of the workflow which scheduled this activity + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ResetActivityByIdRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ResetActivityByIdResponse' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /api/v1/namespaces/{namespace}/activities/resume-by-id: + post: + tags: + - WorkflowService + description: |- + ResumeActivityById is called by the client to resume the activity that is in paused or waiting state. + (-- api-linter: core::0136::prepositions=disabled + aip.dev/not-precedent: "By" is used to indicate request type. --) + operationId: ResumeActivityById + parameters: + - name: namespace + in: path + description: Namespace of the workflow which scheduled this activity + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ResumeActivityByIdRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ResumeActivityByIdResponse' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' /api/v1/namespaces/{namespace}/activities/update-options-by-id: post: tags: - WorkflowService description: |- - UpdateActivityOptionsById is called by the client to update the options of an activity + UpdateActivityOptionsById is called by the client to update the options of an activity. (-- api-linter: core::0136::prepositions=disabled aip.dev/not-precedent: "By" is used to indicate request type. --) operationId: UpdateActivityOptionsById @@ -2531,6 +2671,41 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' + /namespaces/{namespace}/activities/describe-by-id: + post: + tags: + - WorkflowService + description: |- + DescribeActivityById is called by the client to get current activity options and state. + (-- api-linter: core::0136::prepositions=disabled + aip.dev/not-precedent: "By" is used to indicate request type. --) + operationId: DescribeActivityById + parameters: + - name: namespace + in: path + description: Namespace of the workflow which scheduled this activity + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DescribeActivityByIdRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/DescribeActivityByIdResponse' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' /namespaces/{namespace}/activities/fail: post: tags: @@ -2678,12 +2853,117 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' + /namespaces/{namespace}/activities/pause-by-id: + post: + tags: + - WorkflowService + description: |- + PauseActivityById is called by the client to pause an activity. + (-- api-linter: core::0136::prepositions=disabled + aip.dev/not-precedent: "By" is used to indicate request type. --) + operationId: PauseActivityById + parameters: + - name: namespace + in: path + description: Namespace of the workflow which scheduled this activity + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PauseActivityByIdRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/PauseActivityByIdResponse' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /namespaces/{namespace}/activities/reset-by-id: + post: + tags: + - WorkflowService + description: |- + ResetActivityById is called by the client to reset the activity to its "original" state. + (-- api-linter: core::0136::prepositions=disabled + aip.dev/not-precedent: "By" is used to indicate request type. --) + operationId: ResetActivityById + parameters: + - name: namespace + in: path + description: Namespace of the workflow which scheduled this activity + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ResetActivityByIdRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ResetActivityByIdResponse' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' + /namespaces/{namespace}/activities/resume-by-id: + post: + tags: + - WorkflowService + description: |- + ResumeActivityById is called by the client to resume the activity that is in paused or waiting state. + (-- api-linter: core::0136::prepositions=disabled + aip.dev/not-precedent: "By" is used to indicate request type. --) + operationId: ResumeActivityById + parameters: + - name: namespace + in: path + description: Namespace of the workflow which scheduled this activity + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ResumeActivityByIdRequest' + required: true + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/ResumeActivityByIdResponse' + default: + description: Default error response + content: + application/json: + schema: + $ref: '#/components/schemas/Status' /namespaces/{namespace}/activities/update-options-by-id: post: tags: - WorkflowService description: |- - UpdateActivityOptionsById is called by the client to update the options of an activity + UpdateActivityOptionsById is called by the client to update the options of an activity. (-- api-linter: core::0136::prepositions=disabled aip.dev/not-precedent: "By" is used to indicate request type. --) operationId: UpdateActivityOptionsById @@ -5088,6 +5368,44 @@ components: DeleteScheduleResponse: type: object properties: {} + DescribeActivityByIdRequest: + type: object + properties: + namespace: + type: string + description: Namespace of the workflow which scheduled this activity + workflowId: + type: string + description: Id of the workflow which scheduled this activity + runId: + type: string + description: |- + Run Id of the workflow which scheduled this activity + if empty - latest workflow is used + activityId: + type: string + description: Id of the activity we're updating + identity: + type: string + description: The identity of the client who initiated this request + DescribeActivityByIdResponse: + type: object + properties: + activityOptions: + allOf: + - $ref: '#/components/schemas/ActivityOptions' + description: Activity options after an update + activityState: + enum: + - ACTIVITY_STATE_UNSPECIFIED + - ACTIVITY_STATE_SCHEDULED + - ACTIVITY_STATE_STARTED + - ACTIVITY_STATE_PAUSED + - ACTIVITY_STATE_WAITING_FOR_RETRY + - ACTIVITY_STATE_FINISHED + type: string + description: Activity state + format: enum DescribeBatchOperationResponse: type: object properties: @@ -6478,6 +6796,29 @@ components: PatchScheduleResponse: type: object properties: {} + PauseActivityByIdRequest: + type: object + properties: + namespace: + type: string + description: Namespace of the workflow which scheduled this activity + workflowId: + type: string + description: Id of the workflow which scheduled this activity + runId: + type: string + description: |- + Run Id of the workflow which scheduled this activity + if empty - latest workflow is used + activityId: + type: string + description: Id of the activity we're updating + identity: + type: string + description: The identity of the client who initiated this request + PauseActivityByIdResponse: + type: object + properties: {} Payload: description: |- Represents some binary (byte array) data (ex: activity input parameters or workflow result) with @@ -7018,6 +7359,35 @@ components: RequestCancelWorkflowExecutionResponse: type: object properties: {} + ResetActivityByIdRequest: + type: object + properties: + namespace: + type: string + description: Namespace of the workflow which scheduled this activity + workflowId: + type: string + description: Id of the workflow which scheduled this activity + runId: + type: string + description: |- + Run Id of the workflow which scheduled this activity + if empty - latest workflow is used + activityId: + type: string + description: Id of the activity we're updating + identity: + type: string + description: The identity of the client who initiated this request + forceNewRun: + type: boolean + description: Starts new activity even if the activity is already running + keepPaused: + type: boolean + description: If activity was paused, it will be kept paused after reset + ResetActivityByIdResponse: + type: object + properties: {} ResetOptions: type: object properties: @@ -7328,6 +7698,32 @@ components: description: |- Server validation failures could include last_heartbeat_details payload is too large, request failure is too large + ResumeActivityByIdRequest: + type: object + properties: + namespace: + type: string + description: Namespace of the workflow which scheduled this activity + workflowId: + type: string + description: Id of the workflow which scheduled this activity + runId: + type: string + description: |- + Run Id of the workflow which scheduled this activity + if empty - latest workflow is used + activityId: + type: string + description: Id of the activity we're updating + identity: + type: string + description: The identity of the client who initiated this request + triggerImmediately: + type: boolean + description: Indicates that activity should be triggered immediately after resuming + ResumeActivityByIdResponse: + type: object + properties: {} RetryPolicy: type: object properties: diff --git a/temporal/api/enums/v1/activity.proto b/temporal/api/enums/v1/activity.proto new file mode 100644 index 00000000..d2698cf8 --- /dev/null +++ b/temporal/api/enums/v1/activity.proto @@ -0,0 +1,41 @@ +// The MIT License +// +// Copyright (c) 2024 Temporal Technologies Inc. All rights reserved. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +syntax = "proto3"; + +package temporal.api.enums.v1; + +option go_package = "go.temporal.io/api/enums/v1;enums"; +option java_package = "io.temporal.api.enums.v1"; +option java_multiple_files = true; +option java_outer_classname = "ActivityProto"; +option ruby_package = "Temporalio::Api::Enums::V1"; +option csharp_namespace = "Temporalio.Api.Enums.V1"; + +enum ActivityState { + ACTIVITY_STATE_UNSPECIFIED = 0; + ACTIVITY_STATE_SCHEDULED = 1; + ACTIVITY_STATE_STARTED = 2; + ACTIVITY_STATE_PAUSED = 3; + ACTIVITY_STATE_WAITING_FOR_RETRY = 4; + ACTIVITY_STATE_FINISHED = 5; +} diff --git a/temporal/api/workflowservice/v1/request_response.proto b/temporal/api/workflowservice/v1/request_response.proto index 3357a74c..e4050097 100644 --- a/temporal/api/workflowservice/v1/request_response.proto +++ b/temporal/api/workflowservice/v1/request_response.proto @@ -31,6 +31,7 @@ option java_outer_classname = "RequestResponseProto"; option ruby_package = "Temporalio::Api::WorkflowService::V1"; option csharp_namespace = "Temporalio.Api.WorkflowService.V1"; +import "temporal/api/enums/v1/activity.proto"; import "temporal/api/enums/v1/batch_operation.proto"; import "temporal/api/enums/v1/common.proto"; import "temporal/api/enums/v1/workflow.proto"; @@ -1695,3 +1696,92 @@ message UpdateActivityOptionsByIdResponse { // Activity options after an update temporal.api.activity.v1.ActivityOptions activity_options = 1; } + +message DescribeActivityByIdRequest { + // Namespace of the workflow which scheduled this activity + string namespace = 1; + // Id of the workflow which scheduled this activity + string workflow_id = 2; + // Run Id of the workflow which scheduled this activity + // if empty - latest workflow is used + string run_id = 3; + // Id of the activity we're updating + string activity_id = 4; + + // The identity of the client who initiated this request + string identity = 5; +} + +message DescribeActivityByIdResponse { + // Activity options after an update + temporal.api.activity.v1.ActivityOptions activity_options = 1; + + // Activity state + temporal.api.enums.v1.ActivityState activity_state = 2; +} + +message PauseActivityByIdRequest { + // Namespace of the workflow which scheduled this activity + string namespace = 1; + // Id of the workflow which scheduled this activity + string workflow_id = 2; + // Run Id of the workflow which scheduled this activity + // if empty - latest workflow is used + string run_id = 3; + // Id of the activity we're updating + string activity_id = 4; + + // The identity of the client who initiated this request + string identity = 5; +} + +message PauseActivityByIdResponse { + +} + +message ResumeActivityByIdRequest { + // Namespace of the workflow which scheduled this activity + string namespace = 1; + // Id of the workflow which scheduled this activity + string workflow_id = 2; + // Run Id of the workflow which scheduled this activity + // if empty - latest workflow is used + string run_id = 3; + // Id of the activity we're updating + string activity_id = 4; + + // The identity of the client who initiated this request + string identity = 5; + + // Indicates that activity should be triggered immediately after resuming + bool trigger_immediately = 6; +} + +message ResumeActivityByIdResponse { + +} + +message ResetActivityByIdRequest { + // Namespace of the workflow which scheduled this activity + string namespace = 1; + // Id of the workflow which scheduled this activity + string workflow_id = 2; + // Run Id of the workflow which scheduled this activity + // if empty - latest workflow is used + string run_id = 3; + // Id of the activity we're updating + string activity_id = 4; + + // The identity of the client who initiated this request + string identity = 5; + + // Starts new activity even if the activity is already running + bool force_new_run = 6; + + // If activity was paused, it will be kept paused after reset + bool keep_paused = 7; +} + +message ResetActivityByIdResponse { + +} diff --git a/temporal/api/workflowservice/v1/service.proto b/temporal/api/workflowservice/v1/service.proto index 468f9b18..92bef5c0 100644 --- a/temporal/api/workflowservice/v1/service.proto +++ b/temporal/api/workflowservice/v1/service.proto @@ -856,7 +856,7 @@ service WorkflowService { rpc RespondNexusTaskFailed(RespondNexusTaskFailedRequest) returns (RespondNexusTaskFailedResponse) { } - // UpdateActivityOptionsById is called by the client to update the options of an activity + // UpdateActivityOptionsById is called by the client to update the options of an activity. // (-- api-linter: core::0136::prepositions=disabled // aip.dev/not-precedent: "By" is used to indicate request type. --) rpc UpdateActivityOptionsById (UpdateActivityOptionsByIdRequest) returns (UpdateActivityOptionsByIdResponse) @@ -871,5 +871,63 @@ service WorkflowService { }; } -} + // DescribeActivityById is called by the client to get current activity options and state. + // (-- api-linter: core::0136::prepositions=disabled + // aip.dev/not-precedent: "By" is used to indicate request type. --) + rpc DescribeActivityById (DescribeActivityByIdRequest) returns (DescribeActivityByIdResponse) + { + option (google.api.http) = { + post: "/namespaces/{namespace}/activities/describe-by-id" + body: "*" + additional_bindings { + post: "/api/v1/namespaces/{namespace}/activities/describe-by-id" + body: "*" + } + }; + } + + // PauseActivityById is called by the client to pause an activity. + // (-- api-linter: core::0136::prepositions=disabled + // aip.dev/not-precedent: "By" is used to indicate request type. --) + rpc PauseActivityById (PauseActivityByIdRequest) returns (PauseActivityByIdResponse) + { + option (google.api.http) = { + post: "/namespaces/{namespace}/activities/pause-by-id" + body: "*" + additional_bindings { + post: "/api/v1/namespaces/{namespace}/activities/pause-by-id" + body: "*" + } + }; + } + // ResumeActivityById is called by the client to resume the activity that is in paused or waiting state. + // (-- api-linter: core::0136::prepositions=disabled + // aip.dev/not-precedent: "By" is used to indicate request type. --) + rpc ResumeActivityById (ResumeActivityByIdRequest) returns (ResumeActivityByIdResponse) + { + option (google.api.http) = { + post: "/namespaces/{namespace}/activities/resume-by-id" + body: "*" + additional_bindings { + post: "/api/v1/namespaces/{namespace}/activities/resume-by-id" + body: "*" + } + }; + } + + // ResetActivityById is called by the client to reset the activity to its "original" state. + // (-- api-linter: core::0136::prepositions=disabled + // aip.dev/not-precedent: "By" is used to indicate request type. --) + rpc ResetActivityById (ResetActivityByIdRequest) returns (ResetActivityByIdResponse) + { + option (google.api.http) = { + post: "/namespaces/{namespace}/activities/reset-by-id" + body: "*" + additional_bindings { + post: "/api/v1/namespaces/{namespace}/activities/reset-by-id" + body: "*" + } + }; + } +} From 488b9fac32e30e00e3aad55293f040e50748ad2e Mon Sep 17 00:00:00 2001 From: Yuri Date: Tue, 1 Oct 2024 14:56:01 -0700 Subject: [PATCH 2/5] work on comments --- temporal/api/workflowservice/v1/service.proto | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/temporal/api/workflowservice/v1/service.proto b/temporal/api/workflowservice/v1/service.proto index 92bef5c0..d3e63260 100644 --- a/temporal/api/workflowservice/v1/service.proto +++ b/temporal/api/workflowservice/v1/service.proto @@ -859,8 +859,7 @@ service WorkflowService { // UpdateActivityOptionsById is called by the client to update the options of an activity. // (-- api-linter: core::0136::prepositions=disabled // aip.dev/not-precedent: "By" is used to indicate request type. --) - rpc UpdateActivityOptionsById (UpdateActivityOptionsByIdRequest) returns (UpdateActivityOptionsByIdResponse) - { + rpc UpdateActivityOptionsById (UpdateActivityOptionsByIdRequest) returns (UpdateActivityOptionsByIdResponse) { option (google.api.http) = { post: "/namespaces/{namespace}/activities/update-options-by-id" body: "*" @@ -874,23 +873,23 @@ service WorkflowService { // DescribeActivityById is called by the client to get current activity options and state. // (-- api-linter: core::0136::prepositions=disabled // aip.dev/not-precedent: "By" is used to indicate request type. --) - rpc DescribeActivityById (DescribeActivityByIdRequest) returns (DescribeActivityByIdResponse) - { + rpc DescribeActivityById (DescribeActivityByIdRequest) returns (DescribeActivityByIdResponse) { option (google.api.http) = { - post: "/namespaces/{namespace}/activities/describe-by-id" + get: "/namespaces/{namespace}/activities/describe-by-id" body: "*" additional_bindings { - post: "/api/v1/namespaces/{namespace}/activities/describe-by-id" - body: "*" + get: "/api/v1/namespaces/{namespace}/activities/describe-by-id" } }; } // PauseActivityById is called by the client to pause an activity. + // Multiple calls to this function will return success. + // If activity is already paused, this function will return success. + // This call will fail if the activity is in a terminal state (finished). // (-- api-linter: core::0136::prepositions=disabled // aip.dev/not-precedent: "By" is used to indicate request type. --) - rpc PauseActivityById (PauseActivityByIdRequest) returns (PauseActivityByIdResponse) - { + rpc PauseActivityById (PauseActivityByIdRequest) returns (PauseActivityByIdResponse) { option (google.api.http) = { post: "/namespaces/{namespace}/activities/pause-by-id" body: "*" @@ -902,10 +901,12 @@ service WorkflowService { } // ResumeActivityById is called by the client to resume the activity that is in paused or waiting state. + // If activity is already running, this function will return success. + // Multiple calls to this function will return success. + // This call will fail if the activity is in a terminal state (finished). // (-- api-linter: core::0136::prepositions=disabled // aip.dev/not-precedent: "By" is used to indicate request type. --) - rpc ResumeActivityById (ResumeActivityByIdRequest) returns (ResumeActivityByIdResponse) - { + rpc ResumeActivityById (ResumeActivityByIdRequest) returns (ResumeActivityByIdResponse) { option (google.api.http) = { post: "/namespaces/{namespace}/activities/resume-by-id" body: "*" @@ -917,10 +918,14 @@ service WorkflowService { } // ResetActivityById is called by the client to reset the activity to its "original" state. + // This is useful when an activity is stuck in a state that cannot be resolved by other means. + // With this call the number of attempts will be reset to 0 and the activity can be rescheduled. + // This call will fail if the activity is in a terminal state (finished). + // If activity is Pause state, it will be resumed if the corresponding flag is provided. + // If activity currently running - it will be terminated and rescheduled if the corresponding flag is provided. // (-- api-linter: core::0136::prepositions=disabled // aip.dev/not-precedent: "By" is used to indicate request type. --) - rpc ResetActivityById (ResetActivityByIdRequest) returns (ResetActivityByIdResponse) - { + rpc ResetActivityById (ResetActivityByIdRequest) returns (ResetActivityByIdResponse) { option (google.api.http) = { post: "/namespaces/{namespace}/activities/reset-by-id" body: "*" From e3ce8ad2f75260cf952790259f278e2d36f3f98c Mon Sep 17 00:00:00 2001 From: Yuri Date: Tue, 1 Oct 2024 15:19:08 -0700 Subject: [PATCH 3/5] linter --- temporal/api/workflowservice/v1/service.proto | 1 - 1 file changed, 1 deletion(-) diff --git a/temporal/api/workflowservice/v1/service.proto b/temporal/api/workflowservice/v1/service.proto index d3e63260..59f5644a 100644 --- a/temporal/api/workflowservice/v1/service.proto +++ b/temporal/api/workflowservice/v1/service.proto @@ -876,7 +876,6 @@ service WorkflowService { rpc DescribeActivityById (DescribeActivityByIdRequest) returns (DescribeActivityByIdResponse) { option (google.api.http) = { get: "/namespaces/{namespace}/activities/describe-by-id" - body: "*" additional_bindings { get: "/api/v1/namespaces/{namespace}/activities/describe-by-id" } From e4c0cfb2c6bffa13424dc5a1c1b0269c4d5f2bc5 Mon Sep 17 00:00:00 2001 From: Yuri Date: Tue, 1 Oct 2024 15:37:27 -0700 Subject: [PATCH 4/5] regenerate openapi files --- openapi/openapiv2.json | 101 +++++++++++++++++++++++----------------- openapi/openapiv3.yaml | 102 +++++++++++++++++++++++++++-------------- 2 files changed, 128 insertions(+), 75 deletions(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 5ab68368..57ebb4ce 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -318,7 +318,7 @@ } }, "/api/v1/namespaces/{namespace}/activities/describe-by-id": { - "post": { + "get": { "summary": "DescribeActivityById is called by the client to get current activity options and state.", "operationId": "DescribeActivityById2", "responses": { @@ -344,12 +344,32 @@ "type": "string" }, { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/WorkflowServiceDescribeActivityByIdBody" - } + "name": "workflowId", + "description": "Id of the workflow which scheduled this activity", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "runId", + "description": "Run Id of the workflow which scheduled this activity\nif empty - latest workflow is used", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "activityId", + "description": "Id of the activity we're updating", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "identity", + "description": "The identity of the client who initiated this request", + "in": "query", + "required": false, + "type": "string" } ], "tags": [ @@ -519,7 +539,7 @@ }, "/api/v1/namespaces/{namespace}/activities/pause-by-id": { "post": { - "summary": "PauseActivityById is called by the client to pause an activity.", + "summary": "PauseActivityById is called by the client to pause an activity.\nMultiple calls to this function will return success.\nIf activity is already paused, this function will return success.\nThis call will fail if the activity is in a terminal state (finished).", "operationId": "PauseActivityById2", "responses": { "200": { @@ -559,7 +579,7 @@ }, "/api/v1/namespaces/{namespace}/activities/reset-by-id": { "post": { - "summary": "ResetActivityById is called by the client to reset the activity to its \"original\" state.", + "summary": "ResetActivityById is called by the client to reset the activity to its \"original\" state.\nThis is useful when an activity is stuck in a state that cannot be resolved by other means.\nWith this call the number of attempts will be reset to 0 and the activity can be rescheduled.\nThis call will fail if the activity is in a terminal state (finished).\nIf activity is Pause state, it will be resumed if the corresponding flag is provided.\nIf activity currently running - it will be terminated and rescheduled if the corresponding flag is provided.", "operationId": "ResetActivityById2", "responses": { "200": { @@ -599,7 +619,7 @@ }, "/api/v1/namespaces/{namespace}/activities/resume-by-id": { "post": { - "summary": "ResumeActivityById is called by the client to resume the activity that is in paused or waiting state.", + "summary": "ResumeActivityById is called by the client to resume the activity that is in paused or waiting state.\nIf activity is already running, this function will return success.\nMultiple calls to this function will return success.\nThis call will fail if the activity is in a terminal state (finished).", "operationId": "ResumeActivityById2", "responses": { "200": { @@ -3086,7 +3106,7 @@ } }, "/namespaces/{namespace}/activities/describe-by-id": { - "post": { + "get": { "summary": "DescribeActivityById is called by the client to get current activity options and state.", "operationId": "DescribeActivityById", "responses": { @@ -3112,12 +3132,32 @@ "type": "string" }, { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/WorkflowServiceDescribeActivityByIdBody" - } + "name": "workflowId", + "description": "Id of the workflow which scheduled this activity", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "runId", + "description": "Run Id of the workflow which scheduled this activity\nif empty - latest workflow is used", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "activityId", + "description": "Id of the activity we're updating", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "identity", + "description": "The identity of the client who initiated this request", + "in": "query", + "required": false, + "type": "string" } ], "tags": [ @@ -3287,7 +3327,7 @@ }, "/namespaces/{namespace}/activities/pause-by-id": { "post": { - "summary": "PauseActivityById is called by the client to pause an activity.", + "summary": "PauseActivityById is called by the client to pause an activity.\nMultiple calls to this function will return success.\nIf activity is already paused, this function will return success.\nThis call will fail if the activity is in a terminal state (finished).", "operationId": "PauseActivityById", "responses": { "200": { @@ -3327,7 +3367,7 @@ }, "/namespaces/{namespace}/activities/reset-by-id": { "post": { - "summary": "ResetActivityById is called by the client to reset the activity to its \"original\" state.", + "summary": "ResetActivityById is called by the client to reset the activity to its \"original\" state.\nThis is useful when an activity is stuck in a state that cannot be resolved by other means.\nWith this call the number of attempts will be reset to 0 and the activity can be rescheduled.\nThis call will fail if the activity is in a terminal state (finished).\nIf activity is Pause state, it will be resumed if the corresponding flag is provided.\nIf activity currently running - it will be terminated and rescheduled if the corresponding flag is provided.", "operationId": "ResetActivityById", "responses": { "200": { @@ -3367,7 +3407,7 @@ }, "/namespaces/{namespace}/activities/resume-by-id": { "post": { - "summary": "ResumeActivityById is called by the client to resume the activity that is in paused or waiting state.", + "summary": "ResumeActivityById is called by the client to resume the activity that is in paused or waiting state.\nIf activity is already running, this function will return success.\nMultiple calls to this function will return success.\nThis call will fail if the activity is in a terminal state (finished).", "operationId": "ResumeActivityById", "responses": { "200": { @@ -5341,27 +5381,6 @@ } } }, - "WorkflowServiceDescribeActivityByIdBody": { - "type": "object", - "properties": { - "workflowId": { - "type": "string", - "title": "Id of the workflow which scheduled this activity" - }, - "runId": { - "type": "string", - "title": "Run Id of the workflow which scheduled this activity\nif empty - latest workflow is used" - }, - "activityId": { - "type": "string", - "title": "Id of the activity we're updating" - }, - "identity": { - "type": "string", - "title": "The identity of the client who initiated this request" - } - } - }, "WorkflowServiceExecuteMultiOperationBody": { "type": "object", "properties": { diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index 1b76652e..2a2a39da 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -270,7 +270,7 @@ paths: schema: $ref: '#/components/schemas/Status' /api/v1/namespaces/{namespace}/activities/describe-by-id: - post: + get: tags: - WorkflowService description: |- @@ -285,12 +285,28 @@ paths: required: true schema: type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/DescribeActivityByIdRequest' - required: true + - name: workflowId + in: query + description: Id of the workflow which scheduled this activity + schema: + type: string + - name: runId + in: query + description: |- + Run Id of the workflow which scheduled this activity + if empty - latest workflow is used + schema: + type: string + - name: activityId + in: query + description: Id of the activity we're updating + schema: + type: string + - name: identity + in: query + description: The identity of the client who initiated this request + schema: + type: string responses: "200": description: OK @@ -457,6 +473,9 @@ paths: - WorkflowService description: |- PauseActivityById is called by the client to pause an activity. + Multiple calls to this function will return success. + If activity is already paused, this function will return success. + This call will fail if the activity is in a terminal state (finished). (-- api-linter: core::0136::prepositions=disabled aip.dev/not-precedent: "By" is used to indicate request type. --) operationId: PauseActivityById @@ -492,6 +511,11 @@ paths: - WorkflowService description: |- ResetActivityById is called by the client to reset the activity to its "original" state. + This is useful when an activity is stuck in a state that cannot be resolved by other means. + With this call the number of attempts will be reset to 0 and the activity can be rescheduled. + This call will fail if the activity is in a terminal state (finished). + If activity is Pause state, it will be resumed if the corresponding flag is provided. + If activity currently running - it will be terminated and rescheduled if the corresponding flag is provided. (-- api-linter: core::0136::prepositions=disabled aip.dev/not-precedent: "By" is used to indicate request type. --) operationId: ResetActivityById @@ -527,6 +551,9 @@ paths: - WorkflowService description: |- ResumeActivityById is called by the client to resume the activity that is in paused or waiting state. + If activity is already running, this function will return success. + Multiple calls to this function will return success. + This call will fail if the activity is in a terminal state (finished). (-- api-linter: core::0136::prepositions=disabled aip.dev/not-precedent: "By" is used to indicate request type. --) operationId: ResumeActivityById @@ -2672,7 +2699,7 @@ paths: schema: $ref: '#/components/schemas/Status' /namespaces/{namespace}/activities/describe-by-id: - post: + get: tags: - WorkflowService description: |- @@ -2687,12 +2714,28 @@ paths: required: true schema: type: string - requestBody: - content: - application/json: - schema: - $ref: '#/components/schemas/DescribeActivityByIdRequest' - required: true + - name: workflowId + in: query + description: Id of the workflow which scheduled this activity + schema: + type: string + - name: runId + in: query + description: |- + Run Id of the workflow which scheduled this activity + if empty - latest workflow is used + schema: + type: string + - name: activityId + in: query + description: Id of the activity we're updating + schema: + type: string + - name: identity + in: query + description: The identity of the client who initiated this request + schema: + type: string responses: "200": description: OK @@ -2859,6 +2902,9 @@ paths: - WorkflowService description: |- PauseActivityById is called by the client to pause an activity. + Multiple calls to this function will return success. + If activity is already paused, this function will return success. + This call will fail if the activity is in a terminal state (finished). (-- api-linter: core::0136::prepositions=disabled aip.dev/not-precedent: "By" is used to indicate request type. --) operationId: PauseActivityById @@ -2894,6 +2940,11 @@ paths: - WorkflowService description: |- ResetActivityById is called by the client to reset the activity to its "original" state. + This is useful when an activity is stuck in a state that cannot be resolved by other means. + With this call the number of attempts will be reset to 0 and the activity can be rescheduled. + This call will fail if the activity is in a terminal state (finished). + If activity is Pause state, it will be resumed if the corresponding flag is provided. + If activity currently running - it will be terminated and rescheduled if the corresponding flag is provided. (-- api-linter: core::0136::prepositions=disabled aip.dev/not-precedent: "By" is used to indicate request type. --) operationId: ResetActivityById @@ -2929,6 +2980,9 @@ paths: - WorkflowService description: |- ResumeActivityById is called by the client to resume the activity that is in paused or waiting state. + If activity is already running, this function will return success. + Multiple calls to this function will return success. + This call will fail if the activity is in a terminal state (finished). (-- api-linter: core::0136::prepositions=disabled aip.dev/not-precedent: "By" is used to indicate request type. --) operationId: ResumeActivityById @@ -5368,26 +5422,6 @@ components: DeleteScheduleResponse: type: object properties: {} - DescribeActivityByIdRequest: - type: object - properties: - namespace: - type: string - description: Namespace of the workflow which scheduled this activity - workflowId: - type: string - description: Id of the workflow which scheduled this activity - runId: - type: string - description: |- - Run Id of the workflow which scheduled this activity - if empty - latest workflow is used - activityId: - type: string - description: Id of the activity we're updating - identity: - type: string - description: The identity of the client who initiated this request DescribeActivityByIdResponse: type: object properties: From b0c0ac92cf14bba89e2465fa551fb71fab44a2d8 Mon Sep 17 00:00:00 2001 From: Yuri Date: Wed, 2 Oct 2024 09:56:08 -0700 Subject: [PATCH 5/5] add more comments --- openapi/openapiv2.json | 4 ++-- openapi/openapiv3.yaml | 14 ++++++++++---- temporal/api/workflowservice/v1/service.proto | 7 +++++-- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 57ebb4ce..0126d608 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -579,7 +579,7 @@ }, "/api/v1/namespaces/{namespace}/activities/reset-by-id": { "post": { - "summary": "ResetActivityById is called by the client to reset the activity to its \"original\" state.\nThis is useful when an activity is stuck in a state that cannot be resolved by other means.\nWith this call the number of attempts will be reset to 0 and the activity can be rescheduled.\nThis call will fail if the activity is in a terminal state (finished).\nIf activity is Pause state, it will be resumed if the corresponding flag is provided.\nIf activity currently running - it will be terminated and rescheduled if the corresponding flag is provided.", + "summary": "ResetActivityById is called by the client to reset the activity to its \"original\" state.\nThis is useful when an activity is stuck in a state that cannot be resolved by other means.\nWith this call the number of attempts will be reset to 0 and the activity can be rescheduled.\nThis call will fail if the activity is in a terminal state (finished).\nIf activity is in Pause state, it will be resumed unless the `keep_paused` flag is `true`.\nIf activity is in Started state (currently running):\n* if the `force_new_run` flag is `true` it will be rescheduled immediately.\n* if the `force_new_run` flag is `false` it will be rescheduled after the current run is completed and failed.\n if the run completed successfully ResetActivityById will have no effect", "operationId": "ResetActivityById2", "responses": { "200": { @@ -3367,7 +3367,7 @@ }, "/namespaces/{namespace}/activities/reset-by-id": { "post": { - "summary": "ResetActivityById is called by the client to reset the activity to its \"original\" state.\nThis is useful when an activity is stuck in a state that cannot be resolved by other means.\nWith this call the number of attempts will be reset to 0 and the activity can be rescheduled.\nThis call will fail if the activity is in a terminal state (finished).\nIf activity is Pause state, it will be resumed if the corresponding flag is provided.\nIf activity currently running - it will be terminated and rescheduled if the corresponding flag is provided.", + "summary": "ResetActivityById is called by the client to reset the activity to its \"original\" state.\nThis is useful when an activity is stuck in a state that cannot be resolved by other means.\nWith this call the number of attempts will be reset to 0 and the activity can be rescheduled.\nThis call will fail if the activity is in a terminal state (finished).\nIf activity is in Pause state, it will be resumed unless the `keep_paused` flag is `true`.\nIf activity is in Started state (currently running):\n* if the `force_new_run` flag is `true` it will be rescheduled immediately.\n* if the `force_new_run` flag is `false` it will be rescheduled after the current run is completed and failed.\n if the run completed successfully ResetActivityById will have no effect", "operationId": "ResetActivityById", "responses": { "200": { diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index 2a2a39da..db168bf2 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -514,8 +514,11 @@ paths: This is useful when an activity is stuck in a state that cannot be resolved by other means. With this call the number of attempts will be reset to 0 and the activity can be rescheduled. This call will fail if the activity is in a terminal state (finished). - If activity is Pause state, it will be resumed if the corresponding flag is provided. - If activity currently running - it will be terminated and rescheduled if the corresponding flag is provided. + If activity is in Pause state, it will be resumed unless the `keep_paused` flag is `true`. + If activity is in Started state (currently running): + * if the `force_new_run` flag is `true` it will be rescheduled immediately. + * if the `force_new_run` flag is `false` it will be rescheduled after the current run is completed and failed. + if the run completed successfully ResetActivityById will have no effect (-- api-linter: core::0136::prepositions=disabled aip.dev/not-precedent: "By" is used to indicate request type. --) operationId: ResetActivityById @@ -2943,8 +2946,11 @@ paths: This is useful when an activity is stuck in a state that cannot be resolved by other means. With this call the number of attempts will be reset to 0 and the activity can be rescheduled. This call will fail if the activity is in a terminal state (finished). - If activity is Pause state, it will be resumed if the corresponding flag is provided. - If activity currently running - it will be terminated and rescheduled if the corresponding flag is provided. + If activity is in Pause state, it will be resumed unless the `keep_paused` flag is `true`. + If activity is in Started state (currently running): + * if the `force_new_run` flag is `true` it will be rescheduled immediately. + * if the `force_new_run` flag is `false` it will be rescheduled after the current run is completed and failed. + if the run completed successfully ResetActivityById will have no effect (-- api-linter: core::0136::prepositions=disabled aip.dev/not-precedent: "By" is used to indicate request type. --) operationId: ResetActivityById diff --git a/temporal/api/workflowservice/v1/service.proto b/temporal/api/workflowservice/v1/service.proto index 59f5644a..4c444847 100644 --- a/temporal/api/workflowservice/v1/service.proto +++ b/temporal/api/workflowservice/v1/service.proto @@ -920,8 +920,11 @@ service WorkflowService { // This is useful when an activity is stuck in a state that cannot be resolved by other means. // With this call the number of attempts will be reset to 0 and the activity can be rescheduled. // This call will fail if the activity is in a terminal state (finished). - // If activity is Pause state, it will be resumed if the corresponding flag is provided. - // If activity currently running - it will be terminated and rescheduled if the corresponding flag is provided. + // If activity is in Pause state, it will be resumed unless the `keep_paused` flag is `true`. + // If activity is in Started state (currently running): + // * if the `force_new_run` flag is `true` it will be rescheduled immediately. + // * if the `force_new_run` flag is `false` it will be rescheduled after the current run is completed and failed. + // if the run completed successfully ResetActivityById will have no effect // (-- api-linter: core::0136::prepositions=disabled // aip.dev/not-precedent: "By" is used to indicate request type. --) rpc ResetActivityById (ResetActivityByIdRequest) returns (ResetActivityByIdResponse) {