airflow-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From twinkle <twinkle.sachd...@gmail.com>
Subject Regarding getting the result of another task in your current task
Date Thu, 22 Dec 2016 16:32:28 GMT
Hi,

I want to get the result of one task t1, inside task t2.

I have set the result of t1, by returning a value, which is set for the key
result_value.

While using the PythonOperator as t2, i am able to get the value of the
result of task t1.
Code for doing this in PythonOperator is:

pull = PythonOperator(

    task_id='puller', dag=main_dag, provide_context=True,
python_callable=puller)


def puller(**kwargs):

    ti = kwargs['ti']

    v1 = ti.xcom_pull(key=None, task_ids=[t1])

    logging.info("v1 :%s" %v1)

How can i do that in any other operator?
I tried, accessing 'ti' from context as well as kwargs, for both of them i
get the following error:

task_instance = context['ti']

    task_instance = context['ti']
TypeError: string indices must be integers


Any pointers?

Regards,
Twinkle

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message