Skip to content

Commit

Permalink
Fix typing
Browse files Browse the repository at this point in the history
  • Loading branch information
heisner-tillman committed Jan 12, 2024
1 parent 21cf05c commit f7df69d
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 57 deletions.
43 changes: 28 additions & 15 deletions lib/galaxy/schema/invocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,21 +343,34 @@ class InvocationStep(Model, WithModelClass):
model_class: INVOCATION_STEP_MODEL_CLASS = ModelClassField(INVOCATION_STEP_MODEL_CLASS)
id: Annotated[EncodedDatabaseIdField, Field(..., title="Invocation Step ID")]
update_time: Optional[datetime] = schema.UpdateTimeField
job_id: Optional[EncodedDatabaseIdField] = Field(
default=None,
title="Job ID",
description="The encoded ID of the job associated with this workflow invocation step.",
)
workflow_step_id: EncodedDatabaseIdField = Field(
...,
title="Workflow step ID",
description="The encoded ID of the workflow step associated with this workflow invocation step.",
)
subworkflow_invocation_id: Optional[EncodedDatabaseIdField] = Field(
default=None,
title="Subworkflow invocation ID",
description="The encoded ID of the subworkflow invocation.",
)
job_id: Optional[
Annotated[
EncodedDatabaseIdField,
Field(
default=None,
title="Job ID",
description="The encoded ID of the job associated with this workflow invocation step.",
),
]
]
workflow_step_id: Annotated[
EncodedDatabaseIdField,
Field(
...,
title="Workflow step ID",
description="The encoded ID of the workflow step associated with this workflow invocation step.",
),
]
subworkflow_invocation_id: Optional[
Annotated[
EncodedDatabaseIdField,
Field(
default=None,
title="Subworkflow invocation ID",
description="The encoded ID of the subworkflow invocation.",
),
]
]
state: Optional[Union[InvocationStepState, JobState]] = Field(
default=None,
title="State of the invocation step",
Expand Down
12 changes: 4 additions & 8 deletions lib/galaxy/schema/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -1429,18 +1429,14 @@ class InvocationSortByEnum(str, Enum):


class InvocationIndexQueryPayload(Model):
workflow_id: Optional[DecodedDatabaseIdField] = Field(
workflow_id: Optional[int] = Field(
None, title="Workflow ID", description="Return only invocations for this Workflow ID"
)
history_id: Optional[DecodedDatabaseIdField] = Field(
history_id: Optional[int] = Field(
None, title="History ID", description="Return only invocations for this History ID"
)
job_id: Optional[DecodedDatabaseIdField] = Field(
None, title="Job ID", description="Return only invocations for this Job ID"
)
user_id: Optional[DecodedDatabaseIdField] = Field(
None, title="User ID", description="Return invocations for this User ID"
)
job_id: Optional[int] = Field(None, title="Job ID", description="Return only invocations for this Job ID")
user_id: Optional[int] = Field(None, title="User ID", description="Return invocations for this User ID")
sort_by: Optional[InvocationSortByEnum] = Field(
None, title="Sort By", description="Sort Workflow Invocations by this attribute"
)
Expand Down
2 changes: 1 addition & 1 deletion lib/galaxy/webapps/galaxy/api/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def parse_serialization_params(


def query_serialization_params(
view: Annotated[Optional[str], SerializationViewQueryParam] = None,
view: SerializationViewQueryParam = None,
keys: Optional[str] = SerializationKeysQueryParam,
) -> SerializationParams:
return parse_serialization_params(view=view, keys=keys)
Expand Down
3 changes: 1 addition & 2 deletions lib/galaxy/webapps/galaxy/api/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
)

from fastapi import Path
from typing_extensions import Annotated

from galaxy.managers.configuration import ConfigurationManager
from galaxy.managers.context import ProvidesUserContext
Expand Down Expand Up @@ -61,7 +60,7 @@ def whoami(self, trans: ProvidesUserContext = DependsOnTrans) -> Optional[UserMo
def index(
self,
trans: ProvidesUserContext = DependsOnTrans,
view: Annotated[Optional[str], SerializationViewQueryParam] = None,
view: SerializationViewQueryParam = None,
keys: Optional[str] = SerializationKeysQueryParam,
) -> Dict[str, Any]:
"""
Expand Down
61 changes: 30 additions & 31 deletions lib/galaxy/webapps/galaxy/api/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
InvocationMessageResponseModel,
InvocationReport,
InvocationSerializationParams,
InvocationSerializationView,
InvocationStep,
InvocationStepJobsResponseCollectionJobsModel,
InvocationStepJobsResponseJobModel,
Expand Down Expand Up @@ -1122,8 +1121,8 @@ def undelete_workflow(
)
def show_versions(
self,
workflow_id: StoredWorkflowIDPathParam,
trans: ProvidesUserContext = DependsOnTrans,
workflow_id: DecodedDatabaseIdField = StoredWorkflowIDPathParam,
instance: Annotated[Optional[bool], InstanceQueryParam] = False,
):
return self.service.get_versions(trans, workflow_id, instance)
Expand Down Expand Up @@ -1278,7 +1277,7 @@ class FastAPIInvocations:
)
def create_invocations_from_store(
self,
payload: Annotated[CreateInvocationsFromStorePayload, CreateInvocationsFromStoreBody],
payload: CreateInvocationsFromStoreBody,
trans: ProvidesHistoryContext = DependsOnTrans,
) -> List[WorkflowInvocationResponse]:
"""
Expand All @@ -1299,18 +1298,18 @@ def create_invocations_from_store(
def index_invocations(
self,
response: Response,
workflow_id: Annotated[Optional[DecodedDatabaseIdField], WorkflowIdQueryParam] = None,
history_id: Annotated[Optional[DecodedDatabaseIdField], HistoryIdQueryParam] = None,
job_id: Annotated[Optional[DecodedDatabaseIdField], JobIdQueryParam] = None,
user_id: Annotated[Optional[DecodedDatabaseIdField], UserIdQueryParam] = None,
sort_by: Annotated[Optional[InvocationSortByEnum], InvocationsSortByQueryParam] = None,
sort_desc: Annotated[Optional[bool], InvocationsSortDescQueryParam] = False,
include_terminal: Annotated[Optional[bool], InvocationsIncludeTerminalQueryParam] = True,
limit: Annotated[Optional[int], InvocationsLimitQueryParam] = None,
offset: Annotated[Optional[int], InvocationsOffsetQueryParam] = None,
instance: Annotated[Optional[bool], InvocationsInstanceQueryParam] = False,
view: Annotated[Optional[InvocationSerializationView], SerializationViewQueryParam] = None,
step_details: Annotated[Optional[bool], StepDetailQueryParam] = False,
workflow_id: WorkflowIdQueryParam = None,
history_id: HistoryIdQueryParam = None,
job_id: JobIdQueryParam = None,
user_id: UserIdQueryParam = None,
sort_by: InvocationsSortByQueryParam = None,
sort_desc: InvocationsSortDescQueryParam = False,
include_terminal: InvocationsIncludeTerminalQueryParam = True,
limit: InvocationsLimitQueryParam = None,
offset: InvocationsOffsetQueryParam = None,
instance: InvocationsInstanceQueryParam = False,
view: SerializationViewQueryParam = None,
step_details: StepDetailQueryParam = False,
trans: ProvidesUserContext = DependsOnTrans,
) -> List[WorkflowInvocationResponse]:
"""If workflow_id is supplied (either via URL or query parameter) it should be an
Expand All @@ -1322,17 +1321,17 @@ def index_invocations(
:raises: exceptions.MessageException, exceptions.ObjectNotFound
"""
invocation_payload = InvocationIndexPayload(
workflow_id=workflow_id,
history_id=history_id,
job_id=job_id,
user_id=user_id,
sort_by=sort_by,
sort_desc=sort_desc,
include_terminal=include_terminal,
limit=limit,
offset=offset,
instance=instance,
)
invocation_payload.workflow_id = workflow_id
invocation_payload.history_id = history_id
invocation_payload.job_id = job_id
invocation_payload.user_id = user_id
serialization_params = InvocationSerializationParams(
view=view,
step_details=step_details,
Expand All @@ -1349,18 +1348,18 @@ def index_invocations(
def index_workflow_invocations(
self,
response: Response,
workflow_id: Annotated[DecodedDatabaseIdField, StoredWorkflowIDPathParam],
history_id: Annotated[Optional[DecodedDatabaseIdField], HistoryIdQueryParam] = None,
job_id: Annotated[Optional[DecodedDatabaseIdField], JobIdQueryParam] = None,
user_id: Annotated[Optional[DecodedDatabaseIdField], UserIdQueryParam] = None,
sort_by: Annotated[Optional[InvocationSortByEnum], InvocationsSortByQueryParam] = None,
sort_desc: Annotated[Optional[bool], InvocationsSortDescQueryParam] = False,
include_terminal: Annotated[Optional[bool], InvocationsIncludeTerminalQueryParam] = True,
limit: Annotated[Optional[int], InvocationsLimitQueryParam] = None,
offset: Annotated[Optional[int], InvocationsOffsetQueryParam] = None,
instance: Annotated[Optional[bool], InvocationsInstanceQueryParam] = False,
view: Annotated[Optional[InvocationSerializationView], SerializationViewQueryParam] = None,
step_details: Annotated[Optional[bool], StepDetailQueryParam] = False,
workflow_id: StoredWorkflowIDPathParam,
history_id: HistoryIdQueryParam = None,
job_id: JobIdQueryParam = None,
user_id: UserIdQueryParam = None,
sort_by: InvocationsSortByQueryParam = None,
sort_desc: InvocationsSortDescQueryParam = False,
include_terminal: InvocationsIncludeTerminalQueryParam = True,
limit: InvocationsLimitQueryParam = None,
offset: InvocationsOffsetQueryParam = None,
instance: InvocationsInstanceQueryParam = False,
view: SerializationViewQueryParam = None,
step_details: StepDetailQueryParam = False,
trans: ProvidesUserContext = DependsOnTrans,
) -> List[WorkflowInvocationResponse]:
"""An alias for GET '/api/invocations'"""
Expand Down

0 comments on commit f7df69d

Please sign in to comment.