Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
8a11fbd
Create GA4GH WES Implementation of PAML::Platform class using Claude 3.7
golharam May 7, 2025
37d06f8
Address issues with urljoin
golharam May 7, 2025
94dfa5c
Address pylint issues
golharam May 7, 2025
6f38cdb
Address pylint issues
golharam May 7, 2025
70b2a6b
Revert last commit changes to src/cwl_platform/wes_platform.py
golharam May 7, 2025
38a33df
Revert updates to 37d06f8a20c808916b09a07fc910af11b5e95565
golharam May 7, 2025
29db37a
Format with black
golharam May 7, 2025
f3d01a0
Update README and fix class name
golharam May 19, 2025
6a28367
Fix platform name
golharam May 19, 2025
a3013b5
Add workflow_engine parameter
golharam May 19, 2025
41273af
Rename GA4GHWESPlatform to NGS360Platform to better reflect what is h…
golharam May 19, 2025
7535878
Merge branch 'main' into ga4gh_wes_api
golharam Oct 9, 2025
c03fcce
Read the endpoint & token from env vars
Oct 9, 2025
3970a55
Merge branch 'ga4gh_wes_api' of https://github.com/NGS360/PAML into g…
Oct 9, 2025
87b1837
Encode username/password as a token
Oct 9, 2025
64950d5
Rename env vars for WES_USERNAME/WES_PASSWORD
golharam Oct 10, 2025
fcf3c80
Add username,password auth support
golharam Oct 10, 2025
599cd2a
Remove left over code
golharam Oct 10, 2025
e07bd4f
update get_tasks_by_name and submit_task
maggiecbms Oct 29, 2025
bb1a371
update folder id
maggiecbms Nov 18, 2025
d340673
add cache id
maggiecbms Dec 12, 2025
8688892
fix unit test
maggiecbms Dec 15, 2025
832ea58
fix pylint issues
maggiecbms Dec 15, 2025
a30fff4
fix pyint issues
maggiecbms Dec 15, 2025
0811b2e
fix unit test
maggiecbms Dec 15, 2025
7e13a7a
fix pylint
maggiecbms Dec 15, 2025
13d9e65
Merge pull request #98 from NGS360/update_ga4gh_functions
golharam Dec 24, 2025
ce901b0
Rename test file
golharam Jan 2, 2026
1e7f02e
Update code comments
golharam Jan 2, 2026
c881e0e
Update submit_task test for NGS360 GA4GH WES API call
golharam Jan 3, 2026
cd91753
Resolve too many arguments and too many positional arguments in WESTa…
golharam Jan 3, 2026
06e50ee
Resolve too many arguments in WESTask __init__
golharam Jan 3, 2026
285b992
Reduice instance attribute count by combining auth and auth_token int…
golharam Jan 3, 2026
c7c7ccd
Update tests to setup _auth_config correctly
golharam Jan 3, 2026
1d7d9e0
Fix test_connect method to use _auth_config
golharam Jan 3, 2026
eef6c5f
Reduce arguments to _make_request
golharam Jan 3, 2026
562a7be
Remove id from create_project
golharam Jan 3, 2026
3257b6a
Use ProjectName instead of Project and TaskName instead of Name in ge…
golharam Jan 3, 2026
c8c5114
Update test get_tasks_by_name
golharam Jan 3, 2026
3f47a5f
Remove unused import
golharam Jan 3, 2026
8a06f50
Update NGS360 Platform to mimick explicity platform behaviour for fil…
golharam Jan 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 126 additions & 0 deletions docs/wes_platform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# GA4GH WES Platform Implementation

This document describes the GA4GH Workflow Execution Service (WES) platform implementation for the PAML library.

## Overview

The GA4GH WES API provides a standard way to submit and manage workflows across different workflow execution systems.
This implementation allows you to use the PAML library to submit workflows to any WES-compatible service.

The WES platform implementation (`GA4GHWESPlatform`) inherits from the `Platform` abstract base class and implements all the required methods to interact with a WES API endpoint.

## Features

- Connect to any WES API endpoint
- Submit CWL workflows
- Monitor workflow execution status
- Retrieve workflow outputs

## Limitations

Since the WES API is focused on workflow execution and doesn't include concepts like projects, folders, or file management, some features of the Platform API are not fully supported:

- File operations (upload, download, copy) are limited
- Project management is simulated using virtual projects
- User management is not supported

## Usage

### Initialization and Connection

```python
from src.cwl_platform import PlatformFactory

# Initialize the platform factory
factory = PlatformFactory()

# Get the WES platform
platform = factory.get_platform('GA4GHWESPlatform')

# Connect to the WES API
platform.connect(
api_endpoint="https://wes.example.com/ga4gh/wes/v1",
auth_token="your_auth_token" # Optional
)
```

### Submitting a Workflow

```python

# Create a virtual project (not used by WES but required by the API)
project = {
project_name = 'GA4GH WES Example Project'
}
#project = platform.create_project('wes-example', 'WES Example Project')

# Define workflow parameters
workflow_parameters = {
"input_file": {
"class": "File",
"path": "platform-specific id"
},
"output_filename": "output.txt"
}

# Submit the workflow
task = platform.submit_task(
name="My Workflow",
project=project,
workflow="platform://<platform-specific workflow id", # URL or local file path
parameters=workflow_parameters
execution_settings={
'workflow_engine': 'Arvados'
}
)

# Get the run ID
run_id = task.run_id
```

### Monitoring Workflow Execution

```python
# Check the workflow state
state = platform.get_task_state(task)
print(f"Workflow state: {state}")

# Refresh the state from the server
state = platform.get_task_state(task, refresh=True)
print(f"Updated workflow state: {state}")

# Monitor until completion
import time
while True:
state = platform.get_task_state(task, refresh=True)
print(f"Workflow state: {state}")

if state in ['Complete', 'Failed', 'Cancelled']:
break

time.sleep(10) # Check every 10 seconds
```

### Retrieving Workflow Outputs

```python
# Get all outputs
outputs = platform.get_task_outputs(task)
print(f"Outputs: {outputs}")

# Get a specific output
output_file = platform.get_task_output(task, "output_file")
print(f"Output file: {output_file}")
```

## Example Script

See the `examples/wes_platform_example.py` script for a complete example of using the WES platform implementation.

## Configuration

The WES platform can be configured using the following environment variables:

- `WES_API_ENDPOINT`: The URL of the WES API endpoint
- `WES_AUTH_TOKEN`: Authentication token for the WES API

96 changes: 96 additions & 0 deletions examples/wes_platform_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
#!/usr/bin/env python3
'''
Example script demonstrating how to use the WES Platform implementation
'''
import json
import sys
import time
import logging
import argparse

from cwl_platform import PlatformFactory

def main():
'''
Main function
'''
# Set up logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
logger = logging.getLogger(__name__)

# Parse command line arguments
parser = argparse.ArgumentParser(description='WES Platform Example')
parser.add_argument('--api-endpoint', required=True, help='WES API endpoint URL')
parser.add_argument('--auth-token', help='Authentication token for the WES API')
parser.add_argument('--workflow', required=True, help='Path to workflow file or URL')
parser.add_argument('--params', required=True, help='Path to workflow parameters JSON file')
args = parser.parse_args()

# Initialize the platform factory
factory = PlatformFactory()

try:
# Get the WES platform
platform = factory.get_platform('WES')
logger.info("Initialized WES platform")

# Connect to the WES API
connected = platform.connect(
api_endpoint=args.api_endpoint,
auth_token=args.auth_token
)

if not connected:
logger.error("Failed to connect to WES API")
return 1

logger.info("Connected to WES API")

# Create a virtual project (not used by WES but required by the API)
project = platform.create_project('wes-example', 'WES Example Project')
logger.info("Created virtual project: %s", project['name'])

# Load workflow parameters
with open(args.params, 'r', encoding='utf-8') as f:
parameters = json.load(f)

# Submit the workflow
task = platform.submit_task(
name="WES Example Task",
project=project,
workflow=args.workflow,
parameters=parameters
)

if not task:
logger.error("Failed to submit workflow")
return 1

logger.info("Submitted workflow with run ID: %s", task.run_id)

# Monitor the workflow execution
while True:
state = platform.get_task_state(task, refresh=True)
logger.info("Workflow state: %s", state)

if state in ['Complete', 'Failed', 'Cancelled']:
break

time.sleep(10) # Check every 10 seconds

# Get the workflow outputs
if state == 'Complete':
outputs = platform.get_task_outputs(task)
logger.info("Workflow completed successfully")
logger.info("Outputs: %s", outputs)
return 0

logger.error("Workflow failed or was cancelled")
return 1

except Exception as e: # pylint: disable=broad-except
logger.exception("Error: %s", e)
return 1

if __name__ == '__main__':
sys.exit(main())
4 changes: 3 additions & 1 deletion src/cwl_platform/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@

from .arvados_platform import ArvadosPlatform
from .sevenbridges_platform import SevenBridgesPlatform
from .ngs360_platform import NGS360Platform
#from .omics_platform import OmicsPlatform

# Move this for a config file
SUPPORTED_PLATFORMS = {
'Arvados': ArvadosPlatform,
# 'Omics': OmicsPlatform,
'SevenBridges': SevenBridgesPlatform
'SevenBridges': SevenBridgesPlatform,
'NGS360': NGS360Platform
}

class PlatformFactory():
Expand Down
Loading
Loading