-
Notifications
You must be signed in to change notification settings - Fork 31
feat: Execute work item API #199
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
base: master
Are you sure you want to change the base?
Changes from all commits
5d01927
c7a8e1d
8b69fd8
a776a0f
4a95f26
a7398d3
e40ff49
bac1be5
06711c5
5b4014a
8ac5cf1
759661a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| from typing import List, Literal | ||
|
|
||
| from nisystemlink.clients.core._api_error import ApiError | ||
| from nisystemlink.clients.core._uplink._json_model import JsonModel | ||
|
|
||
|
|
||
| class ExecutionResult(JsonModel): | ||
| """Result of executing a work item action.""" | ||
|
|
||
| type: Literal["NONE", "MANUAL", "NOTEBOOK", "JOB", "SCHEDULE", "UNSCHEDULE"] | ||
| """Type of execution.""" | ||
|
|
||
| error: ApiError | None = None | ||
| """Error information if the execution encountered an error.""" | ||
|
|
||
| execution_id: str | None = None | ||
| """The notebook execution ID. Only populated when type is NOTEBOOK.""" | ||
|
|
||
| job_ids: List[str] | None = None | ||
| """The list of job IDs. Only populated when type is JOB.""" | ||
|
|
||
|
|
||
| class ExecuteWorkItemResponse(JsonModel): | ||
| """Response for executing a work item action.""" | ||
|
|
||
| error: ApiError | None = None | ||
| """Error information if the action failed.""" | ||
|
|
||
| result: ExecutionResult | None = None | ||
| """Result of the action execution.""" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I want to know if we can clean up this response model or if its useful to have these extra layers. Best I can tell the Conversely, if we do need to return both the error and the execution result together in the error case then we need to override the base client's status code handler so it doesn't throw so we can have the behavior we'd want. @darrenbiel or @kaviarasu-ni can you comment on the way we intend the API to behave? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The service may return both an error and job IDs in a partial failure case. It will cancel the jobs it successfully queued and return their IDs along with the error. The error is duplicated at the base response and in the I think we would need to override the base client as you suggested. |
||
priyadarshini-ni marked this conversation as resolved.
Show resolved
Hide resolved
priyadarshini-ni marked this conversation as resolved.
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If these are only used for their corresponding job types then we should make different model objects for these rather than relying on comments.
Ideally this would be defined as a discriminated union.