Hi Or,

There is support for pulling multiple XComs at once (see XCom.get_many())
but it won't be directly available inside a jinja template, where you you
are typically calling ti.xcom_pull() and returning a single XCom at a time,
using a key you know in advance.

I would suggest that you do this processing either inside your existing
PythonOperator or in a subsequent PythonOperator that calls XCom.get_many()
and produces the final template for your email operator. It is
theoretically possible for you to do this in your email template using
template macros, but I only have a basic knowledge of that (and it's a
convoluted process) so I don't want to give you bad advice. If you can do
your preprocessing in your PythonOperator I think you will be happier,
especially because the result will be visible in the Airflow UI and logs.

Best,
Jeremiah

On Wed, Jun 15, 2016 at 9:49 AM Or Sher <[email protected]> wrote:

> Hi all,
>
> For the purpose of data validation tests I have two adjacent operators:
> Python - Parsing predefined json of tests and saves the result as an xcom
> where each key is a test id.
>
> Email - I'd like to be able to iterate over all keys from the previous task
> inside the predefined email template so I won't need to change it every
> time I change the tests json.
>
> It seems like it's not supported. Is that right?
> What are my choices?
> If I won't find anything else, I assume I can always use one key for all of
> the tests combined into one json.
>

Reply via email to