-
Notifications
You must be signed in to change notification settings - Fork 1
Support cancelling a submission #75
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
b53e7cd
6b34ce9
085bd84
fa223da
9b3f119
744cb95
7bb5cf1
0977184
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,7 @@ members = [ | |
| ] | ||
|
|
||
| [workspace.package] | ||
| version = "0.34.0" | ||
| version = "0.35.0" | ||
|
|
||
|
|
||
| [workspace.lints.clippy] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,7 @@ | ||
| ## Expected errors: | ||
|
|
||
| from . import opsqueue_internal | ||
| from typing import Optional | ||
|
|
||
|
|
||
| class SubmissionFailedError(Exception): | ||
|
|
@@ -38,6 +39,36 @@ def __repr__(self) -> str: | |
| return str(self) | ||
|
|
||
|
|
||
| class SubmissionNotCancellableError(Exception): | ||
| """Raised when a submission could not be cancelled due to already being | ||
| completed, failed or cancelled. | ||
|
|
||
| """ | ||
|
|
||
| __slots__ = ["submission", "chunk"] | ||
|
|
||
| def __init__( | ||
| self, | ||
| submission: opsqueue_internal.SubmissionNotCancellable, | ||
| chunk: Optional[opsqueue_internal.ChunkFailed] = None, | ||
| ): | ||
| super().__init__() | ||
| self.submission = submission | ||
| self.chunk = chunk | ||
|
|
||
| def __str__(self) -> str: | ||
| chunk_str = f"\n{self.chunk}" | ||
| return f""" | ||
| Submission {self.submission.submission.id} was not cancelled because: | ||
|
|
||
| {self.submission} | ||
| {"" if self.chunk is None else chunk_str} | ||
| """ | ||
|
|
||
| def __repr__(self) -> str: | ||
| return str(self) | ||
|
|
||
|
|
||
| ## Usage errors: | ||
|
|
||
|
|
||
|
|
@@ -76,7 +107,20 @@ class SubmissionNotFoundError(IncorrectUsageError): | |
| but the submission doesn't exist within the Opsqueue. | ||
| """ | ||
|
|
||
| pass | ||
| __slots__ = ["submission_id"] | ||
|
Contributor
Author
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. If the client is requesting to cancel a submission, they will know the ID of the submission they are trying to cancel. So I suggest this change is reverted. |
||
|
|
||
| def __init__( | ||
| self, | ||
| submission_id: int, | ||
| ): | ||
| super().__init__() | ||
| self.submission_id = submission_id | ||
|
|
||
| def __str__(self) -> str: | ||
| return f"Submission {self.submission_id} could not be found" | ||
|
|
||
| def __repr__(self) -> str: | ||
| return str(self) | ||
|
|
||
|
|
||
| class ChunkCountIsZeroError(IncorrectUsageError): | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.