Documentation
Workflow Execution Service (WES)
Providers

WES Providers

The @elixir-cloud/wes package provides providers for connecting to GA4GH Workflow Execution Service (WES) APIs. The main provider is RestWesProvider which implements the WesProvider interface for REST-based WES endpoints.

Quick Start: Create a RestWesProvider with your WES server URL and pass it to WES components to start submitting and monitoring workflows.

WesProvider Interface

The WesProvider interface defines the operations that all WES providers must implement:

export interface WesProvider {
  // Service information
  getServiceInfo(): Promise<ServiceInfo>;
 
  // Run management
  listRuns(pageSize?: number, pageToken?: string): Promise<RunListResponse>;
  runWorkflow(request: RunRequest): Promise<RunId>;
  getRunLog(runId: string): Promise<RunLog>;
  getRunStatus(runId: string): Promise<RunStatus>;
  cancelRun(runId: string): Promise<RunId>;
 
  // Optional (WES 1.1 task listing, log fetching)
  listRunTasks?(
    runId: string,
    pageSize?: number,
    pageToken?: string
  ): Promise<TaskListResponse>;
  getLog?(url: string): Promise<string>;
}

RestWesProvider

The RestWesProvider is the main implementation that communicates with WES APIs using REST/HTTP.

Constructor

constructor(baseUrl: string)

Parameters:

  • baseUrl: The base URL of the WES API endpoint (e.g., https://weskit.example.com/ga4gh/wes/v1)

Basic Usage

import { RestWesProvider } from '@elixir-cloud/wes/providers';
import { EccClientGa4ghWesRuns } from '@elixir-cloud/wes';
 
function WorkflowApp() {
  const provider = new RestWesProvider(
    'https://weskit.example.com/ga4gh/wes/v1'
  );
 
  return (
    <div>
      <h2>Workflow Runs</h2>
      <EccClientGa4ghWesRuns provider={provider} />
    </div>
  );
}

Provider Methods

getServiceInfo()

Retrieves information about the WES service.

getServiceInfo(): Promise<ServiceInfo>

listRuns()

Retrieves a list of workflow runs with optional pagination.

listRuns(pageSize?: number, pageToken?: string): Promise<RunListResponse>

runWorkflow()

Submits a new workflow for execution.

runWorkflow(request: RunRequest): Promise<RunId>

getRunLog()

Gets detailed information and logs for a specific workflow run.

getRunLog(runId: string): Promise<RunLog>

getRunStatus()

Gets the current status of a workflow run.

getRunStatus(runId: string): Promise<RunStatus>

cancelRun()

Cancels a running workflow.

cancelRun(runId: string): Promise<RunId>

listRunTasks()

Lists a page of a run's tasks (GET /runs/{run_id}/tasks, WES 1.1). Optional in the interface; ecc-client-ga4gh-wes-run uses it for runs that give task_logs_url instead of task_logs. RestWesProvider calls the endpoint under its base URL; it doesn't follow task_logs_url itself, so the provider's authorization never goes to another address.

listRunTasks(runId: string, pageSize?: number, pageToken?: string): Promise<TaskListResponse>

getLog()

Fetches the text of a log URL (stdout, stderr). Optional in the interface; without it, components fetch logs without credentials. RestWesProvider fetches URLs on its base URL's origin through its fetch (so a subclass's Authorization header goes along), other origins without credentials, and refuses URLs that aren't HTTP(S). A relative base URL is resolved against the page. Redirects are followed: browsers drop Authorization and cookies when a redirect leaves the origin, but not other headers, so a subclass that adds its own header (e.g. X-Api-Key) should send it only where it belongs, or override getLog().

getLog(url: string): Promise<string>

Type Definitions

State

type State =
  | "UNKNOWN"
  | "QUEUED"
  | "INITIALIZING"
  | "RUNNING"
  | "PAUSED"
  | "COMPLETE"
  | "EXECUTOR_ERROR"
  | "SYSTEM_ERROR"
  | "CANCELED"
  | "CANCELING";

RunRequest

interface RunRequest {
  workflow_params: object;
  workflow_type: string;
  workflow_type_version: string;
  tags?: Record<string, string>;
  workflow_engine_parameters?: Record<string, string>;
  workflow_url: string;
  workflow_attachment?: File[];
}

RunId

interface RunId {
  run_id: string;
}

RunStatus

interface RunStatus {
  run_id: string;
  state: State;
}

Log

interface Log {
  name?: string;
  cmd?: string[];
  start_time?: string;
  end_time?: string;
  stdout?: string;
  stderr?: string;
  exit_code?: number;
}

TaskLog

interface TaskLog extends Log {
  id?: string;
  system_logs?: string[];
  tes_uri?: string;
}

RunLog

interface RunLog {
  run_id: string;
  request: RunRequest;
  state: State;
  run_log: Log;
  task_logs?: TaskLog[] | null; // deprecated in WES 1.1
  task_logs_url?: string | null; // WES 1.1
  outputs: object;
}

TaskListResponse

interface TaskListResponse {
  task_logs: TaskLog[];
  next_page_token?: string;
}

RunListResponse

interface RunListResponse {
  runs: RunStatus[];
  next_page_token?: string;
}

WorkflowTypeVersion

interface WorkflowTypeVersion {
  workflow_type_version: string[];
}

DefaultWorkflowEngineParameter

interface DefaultWorkflowEngineParameter {
  name: string;
  type: string;
  default_value: string;
}

ServiceInfo

interface ServiceInfo {
  workflow_type_versions: Record<string, WorkflowTypeVersion>;
  supported_wes_versions: string[];
  supported_filesystem_protocols: string[];
  workflow_engine_versions: Record<string, string>;
  default_workflow_engine_parameters: DefaultWorkflowEngineParameter[];
  system_state_counts: Record<string, number>;
  auth_instructions_url?: string;
  contact_info_url?: string;
  tags?: Record<string, string>;
}

Using with Components

Workflow Submission

import { RestWesProvider } from '@elixir-cloud/wes/providers';
import { EccClientGa4ghWesRunCreate } from '@elixir-cloud/wes';
 
function WorkflowSubmitter() {
  const provider = new RestWesProvider('https://weskit.example.com/ga4gh/wes/v1');
 
  return (
    <EccClientGa4ghWesRunCreate 
      provider={provider}
      onEccRunSubmitted={(event) => {
        console.log('Workflow submitted:', event.detail.runId);
      }}
      onEccRunCreateFailed={(event) => {
        console.error('Submission failed:', event.detail.error);
      }}
    />
  );
}

Workflow Monitoring

import { RestWesProvider } from '@elixir-cloud/wes/providers';
import { EccClientGa4ghWesRun } from '@elixir-cloud/wes';
 
function WorkflowMonitor({ runId }) {
  const provider = new RestWesProvider('https://weskit.example.com/ga4gh/wes/v1');
 
  return (
    <EccClientGa4ghWesRun 
      provider={provider}
      runId={runId}
      onEccRunChanged={(event) => {
        console.log('Run status changed:', event.detail.state);
      }}
    />
  );
}

Output Provider

ecc-client-ga4gh-wes-run-output reads files from the deployment's storage, not the WES API, so it takes a WesOutputProvider instead. See Run Output.

Custom Providers

For custom use cases, you can extend RestWesProvider or implement the WesProvider interface directly. This is useful for:

  • Adding custom authentication
  • Implementing caching or offline support
  • Connecting to non-standard APIs
  • Adding custom error handling or retry logic
// Example: Custom provider with authentication
class CustomWesProvider extends RestWesProvider {
  constructor(baseUrl, apiKey) {
    super(baseUrl);
    this.apiKey = apiKey;
  }
 
  async fetch(url, options = {}) {
    return super.fetch(url, {
      ...options,
      headers: {
        'Authorization': `Bearer ${this.apiKey}`,
        ...options.headers
      }
    });
  }
}

For comprehensive patterns and examples, see the Providers Overview documentation.

Testing

Test your WES provider setup:

async function testWesProvider(provider) {
  try {
    console.log('Testing WES provider...');
    
    // Test service info
    const serviceInfo = await provider.getServiceInfo();
    console.log('✅ Service info:', serviceInfo.workflow_type_versions);
    
    // Test listing runs
    const runs = await provider.listRuns(5);
    console.log(`✅ Found ${runs.runs.length} recent runs`);
    
    console.log('✅ WES provider is working correctly!');
    return true;
  } catch (error) {
    console.error('❌ WES provider test failed:', error);
    return false;
  }
}
 
// Usage
const provider = new RestWesProvider('https://weskit.example.com/ga4gh/wes/v1');
testWesProvider(provider);

Next Steps: Check the Providers Overview for patterns on authentication, error handling, caching, and environment configuration that you can apply to your WES provider.

Released under Apache 2.0 License.

Copyright © 2023-2026 ELIXIR