diff --git a/openapi/openapiv2.json b/openapi/openapiv2.json index 8457a409..0126d608 100644 --- a/openapi/openapiv2.json +++ b/openapi/openapiv2.json @@ -317,6 +317,66 @@ ] } }, + "/api/v1/namespaces/{namespace}/activities/describe-by-id": { + "get": { + "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": "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": [ + "WorkflowService" + ] + } + }, "/api/v1/namespaces/{namespace}/activities/fail": { "post": { "summary": "RespondActivityTaskFailed is called by workers when processing an activity task fails.", @@ -477,9 +537,129 @@ ] } }, + "/api/v1/namespaces/{namespace}/activities/pause-by-id": { + "post": { + "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": { + "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.\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": { + "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.\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": { + "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 +3105,66 @@ ] } }, + "/namespaces/{namespace}/activities/describe-by-id": { + "get": { + "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": "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": [ + "WorkflowService" + ] + } + }, "/namespaces/{namespace}/activities/fail": { "post": { "summary": "RespondActivityTaskFailed is called by workers when processing an activity task fails.", @@ -3085,9 +3325,129 @@ ] } }, + "/namespaces/{namespace}/activities/pause-by-id": { + "post": { + "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": { + "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.\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": { + "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.\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": { + "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": { @@ -5050,6 +5410,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 +5536,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 +5751,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 +6431,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 +7598,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 +9250,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 +9991,9 @@ "v1RequestCancelWorkflowExecutionResponse": { "type": "object" }, + "v1ResetActivityByIdResponse": { + "type": "object" + }, "v1ResetOptions": { "type": "object", "properties": { @@ -9739,6 +10205,9 @@ "v1RespondWorkflowTaskFailedResponse": { "type": "object" }, + "v1ResumeActivityByIdResponse": { + "type": "object" + }, "v1RetryPolicy": { "type": "object", "properties": { diff --git a/openapi/openapiv3.yaml b/openapi/openapiv3.yaml index 2a10d449..db168bf2 100644 --- a/openapi/openapiv3.yaml +++ b/openapi/openapiv3.yaml @@ -269,6 +269,57 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' + /api/v1/namespaces/{namespace}/activities/describe-by-id: + get: + 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 + - 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 + 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 +467,131 @@ 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. + 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 + 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. + 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 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 + 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. + 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 + 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 +2701,57 @@ paths: application/json: schema: $ref: '#/components/schemas/Status' + /namespaces/{namespace}/activities/describe-by-id: + get: + 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 + - 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 + 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 +2899,131 @@ 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. + 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 + 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. + 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 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 + 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. + 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 + 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 +5428,24 @@ components: DeleteScheduleResponse: type: object properties: {} + 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 +6836,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 +7399,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 +7738,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..4c444847 100644 --- a/temporal/api/workflowservice/v1/service.proto +++ b/temporal/api/workflowservice/v1/service.proto @@ -856,11 +856,10 @@ 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) - { + rpc UpdateActivityOptionsById (UpdateActivityOptionsByIdRequest) returns (UpdateActivityOptionsByIdResponse) { option (google.api.http) = { post: "/namespaces/{namespace}/activities/update-options-by-id" body: "*" @@ -871,5 +870,71 @@ 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) = { + get: "/namespaces/{namespace}/activities/describe-by-id" + additional_bindings { + 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) { + 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. + // 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) { + 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. + // 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 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) { + option (google.api.http) = { + post: "/namespaces/{namespace}/activities/reset-by-id" + body: "*" + additional_bindings { + post: "/api/v1/namespaces/{namespace}/activities/reset-by-id" + body: "*" + } + }; + } +}