uranusjr opened a new issue, #50003:
URL: https://github.com/apache/airflow/issues/50003
### Description
Currently, operations toward a non-declared outlet to `outlet_events` is
simply ignored:
```python
@task
def emit_alias_event():
context = get_current_context()
context["outlet_events"][AssetAlias("a")].add(Asset("new"))
# Line above does nothing since AssetAlias("a") is not an outlet.
```
The same also applies to `yield Metadata`.
This is a bit confusing to the user since they did something, and reasonably
expect it’s an Airflow bug if nothing seems to happen.
I can think of a couple of ways to resolve this:
#### Automatically add outlets when you do this
If you access something, it automatically becomes an outlet. However,
Airflow would not be able to detect such a dynamic outlet in many other places,
such as the dag dependency graph (which is generated statically). Would this
only shift the confusion elsewhere?
#### Raise a KeyError
Or a more detailed error with a hint. More explicit, but would it be awkward
for certain workflows?
### Use case/motivation
_No response_
### Related issues
_No response_
### Are you willing to submit a PR?
- [x] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]