Lee-W commented on issue #41306:
URL: https://github.com/apache/airflow/issues/41306#issuecomment-2278149828
forget about making the method a task. that's wrong. something like the
following should work. you just need to rewrite `gen_kwargs` and use
`GlueJobOperator` instead
```python
from __future__ import annotations
from datetime import datetime
from airflow import DAG
from airflow.operators.python import PythonOperator
def print_args(x, y):
print(x)
print(y)
return x + y
def gen_kwargs():
return [
{"op_kwargs": {"x": 1, "y": 2}, "show_return_value_in_logs": True},
{"op_kwargs": {"x": 3, "y": 4}, "show_return_value_in_logs": False},
]
with DAG(dag_id="mapped_python", start_date=datetime(2020, 4, 7),
catchup=False) as dag:
PythonOperator.partial(task_id="task-1",
python_callable=print_args).expand_kwargs(gen_kwargs())
```
--
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]