Skip to content

Python: show errors from establishing session #4321

Closed

Description

@grouville

Whenever a dagger session connection fails, the output error message is not forwarded by the Python SDK.

This behavior was already commented in the codebase, but not referenced as an issue yet:

# FIXME: handle errors from establishing session

# FIXME: handle errors from establishing session

Below is an example with a modified version of our dagger session where it should retrieve the stderr of buildkit.
Instead, we get the a Dagger engine failed to start error:

Traceback (most recent call last):
...
  File "/private/tmp/dagger/sdk/python/src/dagger/engine/cli.py", line 33, in __enter__
    raise ProvisionError("Dagger engine failed to start") from e
dagger.exceptions.ProvisionError: Dagger engine failed to start

cc @helderco

Activity

  1. helderco commented on Jan 6, 2023

    @helderco
    Contributor

    Thank you for adding this. It's one of the FIXMEs, I'll need to hunt them and create issues for them soon.

  2. self-assigned this
    on Jan 6, 2023
  3. changed the title [-]feat: Python SDK: handle errors from establishing session[/-] [+]Python: show errors from establishing session[/+] on Jan 11, 2023
  4. helderco commented on Jan 11, 2023

    @helderco
    Contributor

    This is actually the part that matters here:

    out = conn + proc.stdout.read()
    err = proc.stderr.read() if proc.stderr and proc.stderr.readable() else None
    # FIXME: not actually using output since it's being
    # reraised as ProvisionError later
    # FIXME: maybe check CLI version?
    raise subprocess.CalledProcessError(ret, " ".join(proc.args), out, err)

    The code you point to in the description is covered here:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions