Skip to content

[dagster-dg-cli] requests.* calls missing timeout= hang the CLI on slow or unreachable endpoints #33747

@shaun0927

Description

@shaun0927

Problem

Three requests.* call sites in dagster-dg-cli omit the timeout= kwarg. Because requests defaults to None (wait forever), a slow/unreachable endpoint hangs the CLI indefinitely.

Affected commands:

  • dg integrations docs — hangs if dagster-marketplace.vercel.app is slow or unreachable.
  • dg plus saml upload-identity-provider-metadata — hangs if organization_url is misconfigured or Plus is unavailable.
  • dg plus saml remove-identity-provider-metadata — same as above.

Affected call sites (master @ 911a238e94)

File Line Call
python_modules/libraries/dagster-dg-cli/dagster_dg_cli/cli/utils.py 582 requests.get(<marketplace URL>)
python_modules/libraries/dagster-dg-cli/dagster_dg_cli/cli/api/organization.py 139 requests.post(url=..., headers=..., files=...)
python_modules/libraries/dagster-dg-cli/dagster_dg_cli/cli/api/organization.py 199 requests.post(url=..., headers=...)

Reproduction (AST scan)

import ast, pathlib
root = pathlib.Path("python_modules/libraries/dagster-dg-cli")
for p in root.rglob("*.py"):
    if "_tests/" in str(p) or "/tests/" in str(p):
        continue
    tree = ast.parse(p.read_text())
    for n in ast.walk(tree):
        if (isinstance(n, ast.Call)
                and isinstance(n.func, ast.Attribute)
                and n.func.attr in {"get","post","put","delete","patch","head","request"}
                and getattr(n.func.value, "id", None) == "requests"
                and "timeout" not in {k.arg for k in n.keywords if k.arg}):
            print(f"{p.relative_to(root)}:{n.lineno} requests.{n.func.attr}() missing timeout=")

Output on current master:

dagster_dg_cli/cli/utils.py:582 requests.get() missing timeout=
dagster_dg_cli/cli/api/organization.py:139 requests.post() missing timeout=
dagster_dg_cli/cli/api/organization.py:199 requests.post() missing timeout=

Suggested fix

Add timeout=(5, 60) (5s connect / 60s read) to each call site. Matches prior direction in #17831 ("Add client timeout for schedules/sensors"). PR to follow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions