Implement full Workflow Execution Service (WES) API support for running Galaxy
workflows via the GA4GH standard. Includes complete core functionality with run
submission, status tracking, cancellation, input/output handling, and task logs.
Core WES Features:
- 6 WES API endpoints (service-info, runs CRUD, cancel, status)
- Support for both workflow_url and workflow_attachment input methods
- Support for gxworkflow:// URI scheme for direct database workflow references
- Automatic history creation with optional custom naming
- Full workflow support: gx_workflow_ga and gx_workflow_format2
- DRS URI generation for all workflow outputs
- State mapping between Galaxy invocation states and WES states
- Cursor-based pagination for run listings
Task Log Features:
- /api/jobs/{job_id}/stdout - Job stdout as plain text
- /api/jobs/{job_id}/stderr - Job stderr as plain text
- /ga4gh/wes/v1/runs/{run_id}/tasks - Paginated task list
- /ga4gh/wes/v1/runs/{run_id}/tasks/{task_id} - Task details
- Build TaskLogs from workflow invocation steps
- Populate RunLog with task_logs list and task_logs_url
Implementation Highlights:
- Auto-generated Pydantic models from GA4GH WES OpenAPI spec
- FastAPI CBV router following Galaxy API patterns
- Service layer with full workflow submission/execution pipeline
- Shared GA4GH utilities for DRS code reuse
- Reduced test duplication with helper functions
Files Added:
- lib/galaxy/schema/wes/__init__.py - Generated Pydantic models
- lib/galaxy/webapps/galaxy/api/wes.py - WES API router
- lib/galaxy/webapps/galaxy/services/wes.py - WesService
- lib/galaxy/webapps/galaxy/services/ga4gh.py - Shared GA4GH utilities
- WES_PLAN.md - Implementation plan
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
5.7 KiB
myst
| myst | ||||||
|---|---|---|---|---|---|---|
|
GA4GH API Support
Galaxy consumes many of the APIs from the GA4GH standards. But a Galaxy server acts as an implementor of two of these standards currently.
Overview
The GA4GH standards provide standardized APIs for accessing and executing workflows and datasets across different bioinformatics platforms. Galaxy's implementation allows external tools and services to:
- DRS (Data Repository Service): Access Galaxy datasets via standardized data retrieval APIs
- WES (Workflow Execution Service): Submit and monitor Galaxy workflow executions via standardized workflow APIs
DRS - Data Repository Service
The {{ GA4GH_DRS }} enables standardized access to datasets stored in Galaxy.
For detailed API specifications, see the GA4GH DRS specification.
Configuration
DRS service information is configured via the following Galaxy settings in galaxy.yml:
galaxy:
# Organization name shown in DRS service-info responses
organization_name: "My Organization"
# Organization website URL shown in DRS service-info responses
organization_url: "https://example.com"
# GA4GH service ID (reverse domain format)
# If not set, defaults to reversed hostname (e.g., com.example for example.com)
ga4gh_service_id: "org.example.myservice"
# Environment tag for service (e.g., "test", "staging", "production")
ga4gh_service_environment: "production"
Verifying DRS Configuration
To verify DRS is properly configured, query the service-info endpoint:
curl -s http://localhost:8080/ga4gh/drs/v1/service-info | jq .
You should see output like:
{
"id": "org.example.drs",
"name": "Galaxy DRS API",
"description": "Serves Galaxy datasets according to the GA4GH DRS specification",
"organization": {
"name": "My Organization",
"url": "https://example.com"
},
"type": {
"group": "org.ga4gh",
"artifact": "drs",
"version": "1.2.0"
},
"version": "26.0",
"environment": "production"
}
Verify that:
organization.nameandorganization.urlmatch your configured valuesenvironmentis set appropriately for your deploymentidreflects yourga4gh_service_idsetting (or sensible defaults if not configured)
WES - Workflow Execution Service
The {{ GA4GH_WES }} enables external systems to submit and monitor Galaxy workflow executions.
For detailed API specifications, see the GA4GH WES specification.
Workflow Types
WES supports two Galaxy workflow formats:
- gx_workflow_ga: Native Galaxy XML/YAML workflow format
- gx_workflow_format2: Galaxy's CWL-compatible workflow format
Configuration
WES service information is configured via the same Galaxy settings as DRS in galaxy.yml:
galaxy:
# Organization name shown in WES service-info responses
organization_name: "My Organization"
# Organization website URL shown in WES service-info responses
organization_url: "https://example.com"
# GA4GH service ID (reverse domain format)
# If not set, defaults to reversed hostname
ga4gh_service_id: "org.example.myservice"
# Environment tag for service (e.g., "test", "staging", "production")
ga4gh_service_environment: "production"
Verifying WES Configuration
To verify WES is properly configured, query the service-info endpoint:
curl -s http://localhost:8080/ga4gh/wes/v1/service-info | jq .
You should see output like:
{
"id": "org.example.wes",
"name": "Galaxy WES API",
"description": "Executes Galaxy workflows according to the GA4GH WES specification",
"organization": {
"name": "My Organization",
"url": "https://example.com"
},
"type": {
"group": "org.ga4gh",
"artifact": "wes",
"version": "1.0.0"
},
"version": "26.0",
"environment": "production"
}
Verify that:
organization.nameandorganization.urlmatch your configured valuesenvironmentis set appropriately for your deploymentidreflects yourga4gh_service_idsetting (or sensible defaults if not configured)
Configuration Reference
All GA4GH configuration is optional and falls back to sensible defaults based on your Galaxy deployment.
Settings
| Setting | Default | Purpose |
|---|---|---|
organization_name |
Reversed hostname | Organization name in service responses |
organization_url |
Scheme + hostname from request | Organization website URL |
ga4gh_service_id |
Reversed hostname | Service ID in reverse domain format (e.g., org.example) |
ga4gh_service_environment |
(none) | Environment classifier (e.g., "test", "staging", "production") |
Complete Configuration Example
# galaxy.yml - Complete GA4GH configuration
galaxy:
# For DRS and WES service-info responses
organization_name: "Example Bioinformatics Institute"
organization_url: "https://example.com"
# Service identifier (reverse domain format)
ga4gh_service_id: "com.example.galaxy"
# Environment classifier
ga4gh_service_environment: "production"
Default Behavior
If GA4GH settings are not explicitly configured:
organization_nameandorganization_urlare derived from the request URLga4gh_service_idis auto-generated by reversing the hostname- For
galaxy.example.com, this becomescom.example.galaxy
- For
ga4gh_service_environmentis omitted from responses