Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add wait-for-process-completion #36

Merged
merged 2 commits into from
Jun 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 80 additions & 1 deletion api-schema/xcherry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,27 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/ApiErrorResponse'
/api/v1/xcherry/service/process-execution/wait-for-process-completion:
post:
summary: wait for a process completion
requestBody:
content:
'application/json':
schema:
$ref: '#/components/schemas/ProcessExecutionWaitForCompletionRequest'
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/ProcessExecutionWaitForCompletionResponse'
default:
description: "400: Invalid request, 404: Process execution not exists"
content:
application/json:
schema:
$ref: '#/components/schemas/ApiErrorResponse'
# workers APIs are hosted by applications via SDKs, for server to call back
/api/v1/xcherry/worker/async-state/wait-until:
post:
Expand Down Expand Up @@ -222,7 +243,22 @@ paths:
responses:
'200':
description: successful operation
content: {}
content: {}
/internal/api/v1/xcherry/wait-for-process-completion:
post:
summary: "for api service to ask async service to wait for process completion"
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/WaitForProcessCompletionRequest'
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/WaitForProcessCompletionResponse'
components:
schemas:
ProcessExecutionDescribeRequest:
Expand Down Expand Up @@ -812,6 +848,25 @@ components:
processExecutionId:
type: string
description: optional field for distributed database without global secondary index, to pull for specific task rather than a page
WaitForProcessCompletionRequest:
required:
- shardId
- processExecutionId
type: object
properties:
shardId:
type: integer
processExecutionId:
type: string
WaitForProcessCompletionResponse:
type: object
properties:
timeout:
type: boolean
stopBySystem:
type: boolean
status:
$ref: '#/components/schemas/ProcessStatus'
ProcessExecutionStopRequest:
type: object
description: the request for stopping a process execution
Expand Down Expand Up @@ -872,6 +927,30 @@ components:
properties:
output:
$ref: '#/components/schemas/EncodedObject'
ProcessExecutionWaitForCompletionRequest:
type: object
description: the request for waiting for a process completion
required:
- namespace
- processId
properties:
namespace:
type: string
processId:
type: string
timeoutSeconds:
type: integer
description: the timeout for the waiting operation
ProcessExecutionWaitForCompletionResponse:
type: object
description: the response for waiting for a process completion
properties:
timeout:
type: boolean
stopBySystem:
type: boolean
status:
$ref: '#/components/schemas/ProcessStatus'
ProcessRpcWorkerRequest:
type: object
description: the request of the worker RPC API
Expand Down
8 changes: 8 additions & 0 deletions goapi/xcapi/.openapi-generator/FILES
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ docs/ProcessExecutionStartRequest.md
docs/ProcessExecutionStartResponse.md
docs/ProcessExecutionStopRequest.md
docs/ProcessExecutionStopType.md
docs/ProcessExecutionWaitForCompletionRequest.md
docs/ProcessExecutionWaitForCompletionResponse.md
docs/ProcessIdFilter.md
docs/ProcessIdReusePolicy.md
docs/ProcessRpcWorkerRequest.md
Expand All @@ -74,6 +76,8 @@ docs/ThreadCloseType.md
docs/TimeRangeFilter.md
docs/TimerCommand.md
docs/TimerResult.md
docs/WaitForProcessCompletionRequest.md
docs/WaitForProcessCompletionResponse.md
docs/WorkerApiType.md
docs/WorkerErrorResponse.md
docs/WriteConflictMode.md
Expand Down Expand Up @@ -129,6 +133,8 @@ model_process_execution_start_request.go
model_process_execution_start_response.go
model_process_execution_stop_request.go
model_process_execution_stop_type.go
model_process_execution_wait_for_completion_request.go
model_process_execution_wait_for_completion_response.go
model_process_id_filter.go
model_process_id_reuse_policy.go
model_process_rpc_worker_request.go
Expand All @@ -147,6 +153,8 @@ model_thread_close_type.go
model_time_range_filter.go
model_timer_command.go
model_timer_result.go
model_wait_for_process_completion_request.go
model_wait_for_process_completion_response.go
model_worker_api_type.go
model_worker_error_response.go
model_write_conflict_mode.go
Expand Down
6 changes: 6 additions & 0 deletions goapi/xcapi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,13 @@ Class | Method | HTTP request | Description
*DefaultAPI* | [**ApiV1XcherryServiceProcessExecutionRpcPost**](docs/DefaultAPI.md#apiv1xcherryserviceprocessexecutionrpcpost) | **Post** /api/v1/xcherry/service/process-execution/rpc | execute a RPC method of a process execution
*DefaultAPI* | [**ApiV1XcherryServiceProcessExecutionStartPost**](docs/DefaultAPI.md#apiv1xcherryserviceprocessexecutionstartpost) | **Post** /api/v1/xcherry/service/process-execution/start | start a process execution
*DefaultAPI* | [**ApiV1XcherryServiceProcessExecutionStopPost**](docs/DefaultAPI.md#apiv1xcherryserviceprocessexecutionstoppost) | **Post** /api/v1/xcherry/service/process-execution/stop | stop a process execution
*DefaultAPI* | [**ApiV1XcherryServiceProcessExecutionWaitForProcessCompletionPost**](docs/DefaultAPI.md#apiv1xcherryserviceprocessexecutionwaitforprocesscompletionpost) | **Post** /api/v1/xcherry/service/process-execution/wait-for-process-completion | wait for a process completion
*DefaultAPI* | [**ApiV1XcherryWorkerAsyncStateExecutePost**](docs/DefaultAPI.md#apiv1xcherryworkerasyncstateexecutepost) | **Post** /api/v1/xcherry/worker/async-state/execute | invoking AsyncState.execute API
*DefaultAPI* | [**ApiV1XcherryWorkerAsyncStateWaitUntilPost**](docs/DefaultAPI.md#apiv1xcherryworkerasyncstatewaituntilpost) | **Post** /api/v1/xcherry/worker/async-state/wait-until | invoking AsyncState.waitUntil API
*DefaultAPI* | [**ApiV1XcherryWorkerProcessRpcPost**](docs/DefaultAPI.md#apiv1xcherryworkerprocessrpcpost) | **Post** /api/v1/xcherry/worker/process/rpc | execute a RPC method of a process execution in the worker
*DefaultAPI* | [**InternalApiV1XcherryNotifyImmediateTasksPost**](docs/DefaultAPI.md#internalapiv1xcherrynotifyimmediatetaskspost) | **Post** /internal/api/v1/xcherry/notify-immediate-tasks | for api service to tell async service that there are new immediate tasks added to the queue
*DefaultAPI* | [**InternalApiV1XcherryNotifyTimerTasksPost**](docs/DefaultAPI.md#internalapiv1xcherrynotifytimertaskspost) | **Post** /internal/api/v1/xcherry/notify-timer-tasks | for api service to tell async service that there are new timer tasks added to the queue
*DefaultAPI* | [**InternalApiV1XcherryWaitForProcessCompletionPost**](docs/DefaultAPI.md#internalapiv1xcherrywaitforprocesscompletionpost) | **Post** /internal/api/v1/xcherry/wait-for-process-completion | for api service to ask async service to wait for process completion


## Documentation For Models
Expand Down Expand Up @@ -141,6 +143,8 @@ Class | Method | HTTP request | Description
- [ProcessExecutionStartResponse](docs/ProcessExecutionStartResponse.md)
- [ProcessExecutionStopRequest](docs/ProcessExecutionStopRequest.md)
- [ProcessExecutionStopType](docs/ProcessExecutionStopType.md)
- [ProcessExecutionWaitForCompletionRequest](docs/ProcessExecutionWaitForCompletionRequest.md)
- [ProcessExecutionWaitForCompletionResponse](docs/ProcessExecutionWaitForCompletionResponse.md)
- [ProcessIdFilter](docs/ProcessIdFilter.md)
- [ProcessIdReusePolicy](docs/ProcessIdReusePolicy.md)
- [ProcessRpcWorkerRequest](docs/ProcessRpcWorkerRequest.md)
Expand All @@ -159,6 +163,8 @@ Class | Method | HTTP request | Description
- [TimeRangeFilter](docs/TimeRangeFilter.md)
- [TimerCommand](docs/TimerCommand.md)
- [TimerResult](docs/TimerResult.md)
- [WaitForProcessCompletionRequest](docs/WaitForProcessCompletionRequest.md)
- [WaitForProcessCompletionResponse](docs/WaitForProcessCompletionResponse.md)
- [WorkerApiType](docs/WorkerApiType.md)
- [WorkerErrorResponse](docs/WorkerErrorResponse.md)
- [WriteConflictMode](docs/WriteConflictMode.md)
Expand Down
94 changes: 94 additions & 0 deletions goapi/xcapi/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,27 @@ paths:
description: |
400: Invalid request, 404: Process execution not exists, or not running to accept write operation, 424: app database write failure or worker RPC execution failure, see ErrorSubType for details
summary: execute a RPC method of a process execution
/api/v1/xcherry/service/process-execution/wait-for-process-completion:
post:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/ProcessExecutionWaitForCompletionRequest'
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/ProcessExecutionWaitForCompletionResponse'
description: successful operation
default:
content:
application/json:
schema:
$ref: '#/components/schemas/ApiErrorResponse'
description: "400: Invalid request, 404: Process execution not exists"
summary: wait for a process completion
/api/v1/xcherry/worker/async-state/wait-until:
post:
requestBody:
Expand Down Expand Up @@ -224,6 +245,21 @@ paths:
description: successful operation
summary: for api service to tell async service that there are new timer tasks
added to the queue
/internal/api/v1/xcherry/wait-for-process-completion:
post:
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/WaitForProcessCompletionRequest'
responses:
"200":
content:
application/json:
schema:
$ref: '#/components/schemas/WaitForProcessCompletionResponse'
description: successful operation
summary: for api service to ask async service to wait for process completion
components:
schemas:
ProcessExecutionDescribeRequest:
Expand Down Expand Up @@ -1654,6 +1690,32 @@ components:
- fireTimestamps
- shardId
type: object
WaitForProcessCompletionRequest:
example:
processExecutionId: processExecutionId
shardId: 0
properties:
shardId:
type: integer
processExecutionId:
type: string
required:
- processExecutionId
- shardId
type: object
WaitForProcessCompletionResponse:
example:
timeout: true
stopBySystem: true
status: null
properties:
timeout:
type: boolean
stopBySystem:
type: boolean
status:
$ref: '#/components/schemas/ProcessStatus'
type: object
ProcessExecutionStopRequest:
description: the request for stopping a process execution
example:
Expand Down Expand Up @@ -1757,6 +1819,38 @@ components:
output:
$ref: '#/components/schemas/EncodedObject'
type: object
ProcessExecutionWaitForCompletionRequest:
description: the request for waiting for a process completion
example:
processId: processId
namespace: namespace
timeoutSeconds: 0
properties:
namespace:
type: string
processId:
type: string
timeoutSeconds:
description: the timeout for the waiting operation
type: integer
required:
- namespace
- processId
type: object
ProcessExecutionWaitForCompletionResponse:
description: the response for waiting for a process completion
example:
timeout: true
stopBySystem: true
status: null
properties:
timeout:
type: boolean
stopBySystem:
type: boolean
status:
$ref: '#/components/schemas/ProcessStatus'
type: object
ProcessRpcWorkerRequest:
description: the request of the worker RPC API
example:
Expand Down
Loading
Loading