GitHub user sc-ndrf added a comment to the discussion: Dynamic Task Mapping 
Failure with External Python Decorator

Thank you for the quick reply.

> Likely - your external venv does not have airflow installed.

Yes, indeed. The software that is supposed to run in this external venv has 
rather complicated dependencies, so I would prefer to keep them separate and 
from the 
[documentation](https://airflow.apache.org/docs/apache-airflow/stable/howto/operator/python.html#id2)
 I understood that this should be possible (though I would not have access to 
stuff in `op_kwargs`.

Anyways, I found an easy way around by adding an intermediate task using the 
same venv as airflow:
```
@task
def reduce(items: list[str]) -> list[str]:
    return items
```
Which is then inserted into the DAG right before the task run in external 
python needing the list.
```
    pathlist = make_paths.partial(base_path=str(BASE_PATH / 
"xcom")).expand(x=[1, 2])
    reduced = reduce(pathlist)
    print_paths(input_paths=reduced)
```

> I suggest to use "real" passwords also in testing - leaving default password 
> even while you are stage-testing things is a very bad idea.

I'll check and update my settings.

GitHub link: 
https://github.com/apache/airflow/discussions/43746#discussioncomment-11167703

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to