Skip to content

fix: submit tasks to backends exactly once #274

Closed

Description

@uniqueg

Problem

Requests to TES backends time out after a hard-coded 5 seconds (TIMEOUT in pro_tes/ga4gh/tes/backends.py). On top of that, py-tes 1.1.4 tries three base paths (/ga4gh/tes/v1, /v1, /) and moves on to the next one after any RequestException (including a read timeout), any 404 and any 5xx, also for POST /tasks and POST /tasks/{id}:cancel. TaskRuns.create_task then tries the next backend after any RequestException.

A backend that accepted a task, but answered slowly or with a 5xx, keeps its copy. proTES records only the last forward, so earlier copies are neither tracked nor cancelable through proTES, and they run under proTES's credentials. If all backends are slow, the client gets a 500 and the task is stored as SYSTEM_ERROR, while it runs on every backend.

custom.controllers.post_task.timeout (post, poll, job) is validated but never read, so operators can't raise the timeout.

Found in the pre-release review of v0.3.0 (finding 1; the timeout part of finding 9).

Proposed change

  • Send POST requests (create, cancel) exactly once, to the API path of the backend's configured URL (<url>/ga4gh/tes/v1), without py-tes's path fallback.
  • Fail over to the next backend only on errors that show that the backend did not accept the task: no connection (refused, DNS failure, connect timeout, TLS failure), no credentials, a host that is not allowed, and responses other than 2xx and 5xx (e.g., 4xx).
  • Treat read timeouts, connections lost after sending, 5xx responses and 2xx responses without a task identifier as "outcome unknown": don't try other backends, store the task as SYSTEM_ERROR with the backend it was sent to, and return an error that says the outcome is unknown.
  • Replace the dead post_task.timeout with a timeout of requests to TES backends (custom.tes.timeout) with a longer default (30 seconds), used by the app and the Celery worker.
  • Document the behaviour, and the removed key in docs/upgrading.md.

Activity

  1. added
    priority: high
    status: in progress
    type: bug
    workload: hours
    on Oct 23, 2026
  2. removed
    status: in progress
    on Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: hightype: bugworkload: hours

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions