Skip to content

High latency can cause get_task_stream() to miss tasks #9253

Closed

Description

@amotl

Describe the issue:

When submitting a task after starting a cluster, it is not available per get_task_stream() inquiry. If we "ping" the cluster first by invoking an initial get_task_stream(), everything is accounted for perfectly afterwards.

Minimal Complete Verifiable Example:

#!/usr/bin/env python
from dask.distributed import Client


def main():
    with Client() as client:

        # FIXME: The program succeeds only when this line is active.
        # tasks = client.get_task_stream()

        # Submit dummy task.
        client.submit(lambda: True).result()

        # Inquire tasks and validate the submitted task has been run.
        tasks = client.get_task_stream()
        if not tasks:
            raise RuntimeError("No tasks have been recorded")
        task = tasks[-1]
        assert task["key"].startswith("lambda"), f"Task has wrong key: {task['key']}"
        assert task["status"] == "OK", f"Task status not OK: {task['status']}"
        print("SUCCESS")


if __name__ == "__main__":
    main()

Anything else we need to know?:

We have been running into this on behalf of those downstream exercises:

Environment:

  • Dask version: 2026.3.0
  • Python version: 3.13
  • Operating System: macOS / Linux
  • Install method (conda, pip, source): OCI / conda / uv

Kudos:

Thank you for conceiving Dask. It's a true gem.

Activity

  1. crusaderky commented on May 28, 2026

    @crusaderky
    Collaborator

    This is mitigated in the next release by #9230.
    You can try it now by installing both dask and distributed from git tip.
    Short of extreme latency between your client and your server (>1s), it should be fixed. A more robust solution would be more involved; if this is important to you we're open to contributions.

  2. changed the title [-]First task is not recorded / available per `get_task_stream()`[/-] [+]High latency can cause `get_task_stream()` to miss tasks[/+] on May 28, 2026
  3. added
    p3
    bug
    on May 28, 2026
  4. amotl commented on May 28, 2026

    @amotl
    Author

    Hi Guido. Thank you for the swift reply. I will be happy to test the next release in this regard, thanks a stack!

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

    bugdiagnosticsp3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions