Skip to content

Conversation

@benpankow
Copy link
Member

Summary

Collapse error messages when loading a repo for the purposes of dg list defs, in a similar vein to what we do for dg dev and dg check defs:

$ dg list defs
Using /Users/ben/repos/components_demo/missing-resource-demo/.venv/bin/dagster-components
Loading location missing-resource-demo failed:

dagster._core.errors.DagsterInvalidDefinitionError: resource with key 'my_resource' required by op 'my_asset' was not provided. Please provide a ResourceDefinition to key 'my_resource', or change the required key to one of the following keys which points to an ResourceDefinition: ['io_manager']

Stack Trace:
  [15 dagster system frames hidden, run dg check defs --verbose to see the full stack trace]

An error occurred while executing a `dagster-components` command in the Python environment at /Users/ben/repos/components_demo/missing-resource-demo/.venv.

`uv run dagster-components list definitions --location missing-resource-demo --module-name missing_resource_demo.definitions --output-file /var/folders/bc/4npnrqyd46l4vbbkdsdsw3_h0000gn/T/tmpspyxetpf` exited with code 1. Aborting.

Users are instructed to call dg check defs --verbose to get the full stacktrace.

How I Tested These Changes

New unit test, tested locally.

Changelog

[dg] dg list defs now collapses long system stacktraces

@benpankow
Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@benpankow benpankow force-pushed the benpankow/collapse-errors-list-defs branch 3 times, most recently from dae0fe8 to 3c544e2 Compare April 22, 2025 22:57
@benpankow benpankow force-pushed the benpankow/collapse-errors-list-defs branch from 3c544e2 to 09d3bc6 Compare April 22, 2025 23:52
Copy link
Member

@gibsondan gibsondan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just one question inline for sean, otherwise looks good

Comment on lines 99 to 105
@click.option(
"--verbose",
"-v",
flag_value=True,
default=False,
help="Show verbose stack traces, including system frames in stack traces.",
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smackesey does the existance of this flag interact weirdly with any of the logging changes you are planning to make?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can also just drop this flag, it's never invoked right now

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does the existance of this flag interact weirdly with any of the logging changes you are planning to make?

this is in dagster-components, so no (my logging changes are in dg-land)-- fine to leave it in

@benpankow benpankow force-pushed the benpankow/collapse-errors-list-defs branch from 7ed1a57 to f83097f Compare April 23, 2025 16:48
@benpankow benpankow requested a review from gibsondan April 23, 2025 17:59
@benpankow benpankow merged commit 723bbb1 into master Apr 24, 2025
5 checks passed
@benpankow benpankow deleted the benpankow/collapse-errors-list-defs branch April 24, 2025 15:56
dpeng817 pushed a commit that referenced this pull request Apr 24, 2025
## Summary

Collapse error messages when loading a repo for the purposes of `dg list
defs`, in a similar vein to what we do for `dg dev` and `dg check defs`:

```sh
$ dg list defs
Using /Users/ben/repos/components_demo/missing-resource-demo/.venv/bin/dagster-components
Loading location missing-resource-demo failed:

dagster._core.errors.DagsterInvalidDefinitionError: resource with key 'my_resource' required by op 'my_asset' was not provided. Please provide a ResourceDefinition to key 'my_resource', or change the required key to one of the following keys which points to an ResourceDefinition: ['io_manager']

Stack Trace:
  [15 dagster system frames hidden, run dg check defs --verbose to see the full stack trace]

An error occurred while executing a `dagster-components` command in the Python environment at /Users/ben/repos/components_demo/missing-resource-demo/.venv.

`uv run dagster-components list definitions --location missing-resource-demo --module-name missing_resource_demo.definitions --output-file /var/folders/bc/4npnrqyd46l4vbbkdsdsw3_h0000gn/T/tmpspyxetpf` exited with code 1. Aborting.
```

Users are instructed to call `dg check defs --verbose` to get the full
stacktrace.

## How I Tested These Changes

New unit test, tested locally.

## Changelog

> [dg] `dg list defs` now collapses long system stacktraces
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants