-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Migrate the route "/api/invocations/{invocation_id}" of the workflows API to Fast API #17052
Closed
Closed
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
7f27b13
Start work on /api/invocations/{invocation_id}
heisner-tillman a8e8237
Merge branch 'invocations' of https://github.com/heisner-tillman/migr…
heisner-tillman 2517b85
Refactor show_invocations operation
heisner-tillman 2f71b6d
Regenerate the client schema
heisner-tillman f701e6b
Add field for reusability
heisner-tillman e1867b5
Refactor show_invocation operation to return unfinished pydantic model
heisner-tillman 58fb15f
Add unfinished pydantic model for show invocation operation
heisner-tillman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
from datetime import datetime | ||
from enum import Enum | ||
from typing import ( | ||
Any, | ||
Dict, | ||
Generic, | ||
List, | ||
Optional, | ||
TypeVar, | ||
Union, | ||
|
@@ -10,6 +13,7 @@ | |
from pydantic import ( | ||
BaseModel, | ||
Field, | ||
Required, | ||
) | ||
from pydantic.generics import GenericModel | ||
from pydantic.utils import GetterDict | ||
|
@@ -19,6 +23,12 @@ | |
) | ||
|
||
from galaxy.schema.fields import EncodedDatabaseIdField | ||
from galaxy.schema.schema import ( | ||
CreateTimeField, | ||
EntityIdField, | ||
UpdateTimeField, | ||
WorkflowIdField, | ||
) | ||
|
||
|
||
class WarningReason(str, Enum): | ||
|
@@ -153,6 +163,47 @@ class GenericInvocationEvaluationWarningWorkflowOutputNotFound( | |
) | ||
|
||
|
||
# TODO - This already exists in the WorkflowInvocation(lib/galaxy/model/__init__.py). | ||
# How can I access it to use it here? | ||
class InvocationState(str, Enum): | ||
NEW = "new" # Brand new workflow invocation... maybe this should be same as READY | ||
READY = "ready" # Workflow ready for another iteration of scheduling. | ||
SCHEDULED = "scheduled" # Workflow has been scheduled. | ||
CANCELLED = "cancelled" | ||
CANCELLING = "cancelling" # invocation scheduler will cancel job in next iteration | ||
FAILED = "failed" | ||
|
||
|
||
class EncodedInvocation(BaseModel): | ||
id: EncodedDatabaseIdField = EntityIdField | ||
create_time: datetime = CreateTimeField | ||
update_time: datetime = UpdateTimeField | ||
workflow_id: EncodedDatabaseIdField = WorkflowIdField | ||
# history_id: EncodedDatabaseIdField = HistoryIdField # TODO - fix HistoryIdField? | ||
history_id: EncodedDatabaseIdField = Field( | ||
default=Required, title="History ID", description="The encoded ID of the history associated with this item." | ||
) | ||
# TODO this fails weirdly ... try to understand and fix it | ||
# uuid: UUID4 = UuidField | ||
uuid: Any = Field(..., title="UUID", description="Universal unique identifier for this dataset.") | ||
state: InvocationState = Field( | ||
default=Required, title="Invocation state", description="State of workflow invocation." | ||
) | ||
# TODO - is there a class which classifies these models | ||
model_class: str = Field(default=Required, title="Model class", description="Model class name.") | ||
# TODO - Add proper models | ||
steps: Optional[List[Dict[str, Optional[str]]]] = None | ||
inputs: Optional[Dict[str, Dict[str, Optional[str]]]] = None | ||
input_step_parameters: Optional[Dict[str, Dict[str, Optional[str]]]] = None | ||
outputs: Optional[Dict[str, Dict[str, Optional[str]]]] = None | ||
output_collections: Optional[Dict[str, Dict[str, Optional[str]]]] = None | ||
output_values: Optional[Dict[str, Optional[str]]] = None | ||
# TODO understand where this comes from | ||
message: Optional[str] = Field( | ||
default=None, title="Message", description="Message associated with this invocation." | ||
Comment on lines
+193
to
+203
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. Are these really optional, or is it just that they can be null ? That's not the same |
||
) | ||
|
||
|
||
InvocationCancellationReviewFailed = GenericInvocationCancellationReviewFailed[int] | ||
InvocationCancellationHistoryDeleted = GenericInvocationCancellationHistoryDeleted[int] | ||
InvocationCancellationUserRequest = GenericInvocationCancellationUserRequest[int] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Can you name these things
{Something}Response
?