From 2cb718948209dcf1feaf0a322f2ec6d982b64318 Mon Sep 17 00:00:00 2001 From: Dannon Baker Date: Sat, 2 May 2026 19:11:53 -0400 Subject: [PATCH] Move workflow/invocation index payloads into central schema WorkflowIndexPayload and InvocationIndexPayload were defined in the webapps service layer, which forced operations.py (in galaxy-app) to reach across the package boundary into galaxy-webapps just to construct them. They're plain Pydantic models that extend a base already living in galaxy.schema.schema, so move them next to their parents. Services keep the same names via re-export so external consumers don't break, and operations.py can now import them at module level alongside the rest of the galaxy.schema imports. --- lib/galaxy/agents/operations.py | 4 ++-- lib/galaxy/schema/schema.py | 8 ++++++++ lib/galaxy/webapps/galaxy/api/workflows.py | 8 +++----- lib/galaxy/webapps/galaxy/services/invocations.py | 8 +------- lib/galaxy/webapps/galaxy/services/workflows.py | 6 +----- 5 files changed, 15 insertions(+), 19 deletions(-) diff --git a/lib/galaxy/agents/operations.py b/lib/galaxy/agents/operations.py index da1554705e1..57e32fed5b3 100644 --- a/lib/galaxy/agents/operations.py +++ b/lib/galaxy/agents/operations.py @@ -30,12 +30,12 @@ from galaxy.schema.invocation import InvocationSerializationParams from galaxy.schema.schema import ( CreateHistoryPayload, DatasetSourceType, + InvocationIndexPayload, + WorkflowIndexPayload, ) from galaxy.schema.workflows import InvokeWorkflowPayload from galaxy.structured_app import MinimalManagerApp from galaxy.tool_util_models.dynamic_tool_models import DynamicUnprivilegedToolCreatePayload -from galaxy.webapps.galaxy.services.invocations import InvocationIndexPayload -from galaxy.webapps.galaxy.services.workflows import WorkflowIndexPayload log = logging.getLogger(__name__) diff --git a/lib/galaxy/schema/schema.py b/lib/galaxy/schema/schema.py index 2e6da397e84..ea0b85f5d57 100644 --- a/lib/galaxy/schema/schema.py +++ b/lib/galaxy/schema/schema.py @@ -1637,6 +1637,10 @@ class WorkflowIndexQueryPayload(Model): skip_step_counts: bool = False +class WorkflowIndexPayload(WorkflowIndexQueryPayload): + missing_tools: bool = False + + class JobIndexSortByEnum(str, Enum): create_time = "create_time" update_time = "update_time" @@ -1689,6 +1693,10 @@ class InvocationIndexQueryPayload(Model): include_nested_invocations: bool = True +class InvocationIndexPayload(InvocationIndexQueryPayload): + instance: bool = Field(default=False, description="Is provided workflow id for Workflow instead of StoredWorkflow?") + + PageSortByEnum = Literal["create_time", "title", "update_time", "username"] diff --git a/lib/galaxy/webapps/galaxy/api/workflows.py b/lib/galaxy/webapps/galaxy/api/workflows.py index e9883c4476e..4309e9c02a5 100644 --- a/lib/galaxy/webapps/galaxy/api/workflows.py +++ b/lib/galaxy/webapps/galaxy/api/workflows.py @@ -73,12 +73,14 @@ from galaxy.schema.schema import ( AsyncTaskResultSummary, ClaimLandingPayload, CreateWorkflowLandingRequestPayload, + InvocationIndexPayload, InvocationSortByEnum, InvocationsStateCounts, SetSlugPayload, ShareWithPayload, ShareWithStatus, SharingStatus, + WorkflowIndexPayload, WorkflowJobMetric, WorkflowLandingRequest, WorkflowSortByEnum, @@ -120,15 +122,11 @@ from galaxy.webapps.galaxy.services.base import ( ServesExportStores, ) from galaxy.webapps.galaxy.services.invocations import ( - InvocationIndexPayload, InvocationsService, PrepareStoreDownloadPayload, WriteInvocationStoreToPayload, ) -from galaxy.webapps.galaxy.services.workflows import ( - WorkflowIndexPayload, - WorkflowsService, -) +from galaxy.webapps.galaxy.services.workflows import WorkflowsService from galaxy.workflow.extract import extract_workflow from galaxy.workflow.modules import module_factory diff --git a/lib/galaxy/webapps/galaxy/services/invocations.py b/lib/galaxy/webapps/galaxy/services/invocations.py index dc5cc27a577..b71d810c9a4 100644 --- a/lib/galaxy/webapps/galaxy/services/invocations.py +++ b/lib/galaxy/webapps/galaxy/services/invocations.py @@ -4,8 +4,6 @@ from typing import ( Any, ) -from pydantic import Field - from galaxy.celery.helpers import async_task_summary from galaxy.celery.tasks import ( prepare_invocation_download, @@ -51,7 +49,7 @@ from galaxy.schema.schema import ( AsyncTaskResultSummary, BcoGenerationParametersMixin, ExportObjectType, - InvocationIndexQueryPayload, + InvocationIndexPayload, StoreExportPayload, WriteStoreToPayload, ) @@ -71,10 +69,6 @@ from galaxy.webapps.galaxy.services.base import ( log = logging.getLogger(__name__) -class InvocationIndexPayload(InvocationIndexQueryPayload): - instance: bool = Field(default=False, description="Is provided workflow id for Workflow instead of StoredWorkflow?") - - class PrepareStoreDownloadPayload(StoreExportPayload, BcoGenerationParametersMixin): pass diff --git a/lib/galaxy/webapps/galaxy/services/workflows.py b/lib/galaxy/webapps/galaxy/services/workflows.py index 25b9fcb965f..8b23b0a9aaf 100644 --- a/lib/galaxy/webapps/galaxy/services/workflows.py +++ b/lib/galaxy/webapps/galaxy/services/workflows.py @@ -29,7 +29,7 @@ from galaxy.schema.fields import DecodedDatabaseIdField from galaxy.schema.invocation import WorkflowInvocationResponse from galaxy.schema.schema import ( InvocationsStateCounts, - WorkflowIndexQueryPayload, + WorkflowIndexPayload, ) from galaxy.schema.workflows import ( InvokeWorkflowPayload, @@ -45,10 +45,6 @@ from galaxy.workflow.run_request import build_workflow_run_configs log = logging.getLogger(__name__) -class WorkflowIndexPayload(WorkflowIndexQueryPayload): - missing_tools: bool = False - - class WorkflowsService(ServiceBase): def __init__( self,