dagster-io / dagster

An orchestration platform for the development, production, and observation of data assets.
https://dagster.io
Apache License 2.0
10.83k stars 1.35k forks source link

Dagster-pipes errors out even though run was successfull #22117

Open ion-elgreco opened 1 month ago

ion-elgreco commented 1 month ago

Dagster version

1.7.3

What's the issue?

MaterializationResult doesn't have a partition key option, so I have an asset that just has it's own logic to derive the data version per partition key and then yields AssetMaterializations, see below: image

This works until it throws a failure because it expects an output {result}. This issue only occurs because of dagster-pipes. It would be great if we can opt-out of this, otherwise all my databricks jobs will be marked as failed jobs even though they completely sucssefully.

dagster._core.errors.DagsterInvariantViolationError: op '<redacted>' did not yield or return expected outputs {'result'}. Did you forget to `yield from pipes_session.get_results()` or `return <PipesClient>.run(...).get_results`? If using `open_pipes_session`, `pipes_session.get_results` should be called once after the `open_pipes_session` block has exited to yield any remaining buffered results via `<PipesSession>.get_results()`. If using `<PipesClient>.run`, you should always return `<PipesClient>.run(...).get_results()` or `<PipesClient>.run(...).get_materialize_result()`.

What did you expect to happen?

Don't throw an invalidationError if no output was yielded. Allow users to disable this:

https://github.com/dagster-io/dagster/blob/ad8b2a5b3929ef6fa185c2eebc8f3514248f9318/python_modules/dagster/dagster/_core/pipes/utils.py#L602-L603

How to reproduce?

Run dagster_pipes but don't yield the MaterializationResult, just yield AssetMaterializations yourself.

Deployment type

None

Deployment details

No response

Additional information

No response

Message from the maintainers

Impacted by this issue? Give it a 👍! We factor engagement into prioritization.

ion-elgreco commented 1 month ago

As a workaround, I am just manually disabling this check by doing: context._step_execution_context._requires_typed_event_stream = False