RNHTTR commented on issue #33020:
URL: https://github.com/apache/airflow/issues/33020#issuecomment-1662035761
Is this not currently possible?
Outlet DAG:
```python
from pendulum import datetime
from airflow.decorators import (
dag,
task,
)
from airflow.datasets import Dataset
@dag(
schedule=None,
start_date=datetime(2023, 1, 1),
catchup=False,
default_args={
"retries": 2, # If a task fails, it will retry 2 times.
},
tags=["example"],
) # If set, this tag is shown in the DAG view of the Airflow UI
def outlet():
@task(outlets=[Dataset("outlet")])
def write_xcom(ti=None):
ti.xcom_push(key="outlet_xcom", value="xyz")
write_xcom()
outlet()
```
Inlet DAG:
```python
import json
from pendulum import datetime
from airflow.decorators import (
dag,
task,
)
from airflow.datasets import Dataset
@dag(
schedule=[Dataset("outlet")],
start_date=datetime(2023, 1, 1),
catchup=False,
default_args={
"retries": 2, # If a task fails, it will retry 2 times.
},
tags=["example"],
)
def inlet():
@task()
def read_xcom(ti=None):
xcoms = ti.xcom_pull(
dag_id="outlet",
task_ids="write_xcom",
key="outlet_xcom",
include_prior_dates=True,
)
print(f"xcoms: {xcoms}")
read_xcom()
inlet()
```
```
[2023-08-02, 11:24:20 UTC] {logging_mixin.py:150} INFO - xcoms: xyz
```
--
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]