toil.server.wes.abstract_backend

Module Contents

Classes

WESBackend

A class to represent a GA4GH Workflow Execution Service (WES) API backend.

Functions

handle_errors(func)

This decorator catches errors from the wrapped function and returns a JSON

Attributes

logger

TaskLog

toil.server.wes.abstract_backend.logger
toil.server.wes.abstract_backend.TaskLog
exception toil.server.wes.abstract_backend.VersionNotImplementedException(wf_type, version=None, supported_versions=None)

Bases: Exception

digraph inheritance86a81c09d0 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "VersionNotImplementedException" [URL="#toil.server.wes.abstract_backend.VersionNotImplementedException",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Raised when the requested workflow version is not implemented."]; }

Raised when the requested workflow version is not implemented.

Parameters
  • wf_type (str) –

  • version (Optional[str]) –

  • supported_versions (Optional[List[str]]) –

exception toil.server.wes.abstract_backend.MalformedRequestException(message)

Bases: Exception

digraph inheritance6d7abd4296 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "MalformedRequestException" [URL="#toil.server.wes.abstract_backend.MalformedRequestException",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Raised when the request is malformed."]; }

Raised when the request is malformed.

Parameters

message (str) –

exception toil.server.wes.abstract_backend.WorkflowNotFoundException

Bases: Exception

digraph inheritancecf3e939240 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "WorkflowNotFoundException" [URL="#toil.server.wes.abstract_backend.WorkflowNotFoundException",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Raised when the requested run ID is not found."]; }

Raised when the requested run ID is not found.

exception toil.server.wes.abstract_backend.WorkflowConflictException(run_id)

Bases: Exception

digraph inheritance504b933b05 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "WorkflowConflictException" [URL="#toil.server.wes.abstract_backend.WorkflowConflictException",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Raised when the requested workflow is not in the expected state."]; }

Raised when the requested workflow is not in the expected state.

Parameters

run_id (str) –

exception toil.server.wes.abstract_backend.OperationForbidden(message)

Bases: Exception

digraph inheritancee0ebc7b1d3 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "OperationForbidden" [URL="#toil.server.wes.abstract_backend.OperationForbidden",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Raised when the request is forbidden."]; }

Raised when the request is forbidden.

Parameters

message (str) –

exception toil.server.wes.abstract_backend.WorkflowExecutionException(message)

Bases: Exception

digraph inheritance5b56d64636 { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "WorkflowExecutionException" [URL="#toil.server.wes.abstract_backend.WorkflowExecutionException",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Raised when an internal error occurred during the execution of the workflow."]; }

Raised when an internal error occurred during the execution of the workflow.

Parameters

message (str) –

toil.server.wes.abstract_backend.handle_errors(func)

This decorator catches errors from the wrapped function and returns a JSON formatted error message with the appropriate status code defined by the GA4GH WES spec.

Parameters

func (Callable[Ellipsis, Any]) –

Return type

Callable[Ellipsis, Any]

class toil.server.wes.abstract_backend.WESBackend(options)

A class to represent a GA4GH Workflow Execution Service (WES) API backend. Intended to be inherited. Subclasses should implement all abstract methods to handle user requests when they hit different endpoints.

Parameters

options (List[str]) –

resolve_operation_id(operation_id)

Map an operationId defined in the OpenAPI or swagger yaml file to a function.

Parameters

operation_id (str) – The operation ID defined in the specification.

Returns

A function that should be called when the given endpoint is reached.

Return type

Any

abstract get_service_info()

Get information about the Workflow Execution Service.

GET /service-info

Return type

Dict[str, Any]

abstract list_runs(page_size=None, page_token=None)

List the workflow runs.

GET /runs

Parameters
  • page_size (Optional[int]) –

  • page_token (Optional[str]) –

Return type

Dict[str, Any]

abstract run_workflow()

Run a workflow. This endpoint creates a new workflow run and returns a RunId to monitor its progress.

POST /runs

Return type

Dict[str, str]

abstract get_run_log(run_id)

Get detailed info about a workflow run.

GET /runs/{run_id}

Parameters

run_id (str) –

Return type

Dict[str, Any]

abstract cancel_run(run_id)

Cancel a running workflow.

POST /runs/{run_id}/cancel

Parameters

run_id (str) –

Return type

Dict[str, str]

abstract get_run_status(run_id)

Get quick status info about a workflow run, returning a simple result with the overall state of the workflow run.

GET /runs/{run_id}/status

Parameters

run_id (str) –

Return type

Dict[str, str]

static log_for_run(run_id, message)
Parameters
  • run_id (Optional[str]) –

  • message (str) –

Return type

None

static secure_path(path)
Parameters

path (str) –

Return type

str

collect_attachments(run_id, temp_dir)

Collect attachments from the current request by staging uploaded files to temp_dir, and return the temp_dir and parsed body of the request.

Parameters
  • run_id (Optional[str]) – The run ID for logging.

  • temp_dir (Optional[str]) – The directory where uploaded files should be staged. If None, a temporary directory is created.

Return type

Tuple[str, Dict[str, Any]]