<p>So I've been struggling with this for hours. This is the code of my operator:</p>

<pre><code>task1 = GKEPodOperator(
        task_id="task1",
        project_id="proj",
        location="location",
        cluster_name="cluster_name",
        name="cluster-calculator",
        namespace="default",
        image=Variable.get("cluster_calculator_image"),
        arguments=['--name clustercalculator'],
        env_vars=env_vars,
        xcom_push=True,
        is_delete_operator_pod=True,
        get_logs=True,
        dag=dag
    )
</code></pre>

<p>The pod runs a simple docker container with Java application inside doing some stuff and writing results to the default <strong>/airflow/xcom/result.json</strong> file.</p>

<p>This is how I try to obtain the xcom_push result:</p>

<pre><code>def print_xcom_result(*op_args, **kwargs):
        print(op_args)
        print(kwargs['task_instance'].xcom_pull(task_ids='task1'))

    test_values = PythonOperator(
        task_id="task1_test",
        python_callable=print_xcom_result,
        provide_context=True,
        op_args=["{{task_instance.xcom_pull(task_ids='task1')}}"],
        dag=dag
    )
</code></pre>

<p>Whatever I try, it always prints None.</p>

<pre><code>[2019-10-12 00:06:23,061] {{logging_mixin.py:95}} INFO - ('None',)
[2019-10-12 00:06:23,072] {{logging_mixin.py:95}} INFO - None
</code></pre>

<p>When I go to the XCOM on the Airflow UI it shows nothing. 
I also tried example from here: <a href="https://stackoverflow.com/questions/53499079/failed-to-extract-xcom-from-airflow-pod-kubernetes-pod-operator?noredirect=1&amp;lq=1">Failed to extract xcom from airflow pod - Kubernetes Pod Operator</a> and it didn't work either. </p>

<p>The sidecar container is created for sure and I see its output in the logs:</p>

<pre><code>Running command... [1mcat /airflow/xcom/return.json[0m
Running command... [1mkill -s SIGINT 1[0m
INFO[0m - {"clusterSize":2}[0m
</code></pre>

<p>I even tried to run the docker container externally, verified that the result is written to the xcom directory correctly, but have no luck obtaining this result during DAG execution. </p>

<p>Airflow version is latest. Python 3.7</p>

<p>If this matters, I have 6 containers running Airflow (webserver, flower, worker, scheduler, postgre, rabbitmq). Celery is the executor. Pods are running in the Kubernetes Engine on the Google Cloud.</p>

<p>There are no errors, both operators succeed. </p>

<p>Does anyone have any ideas? Thank you in advance.</p>

Zarial
<p>There is a bug in airflow where execute of the GKEPodOperator doesnt have a return statement</p>

<pre><code>super(GKEPodOperator, self).execute(context)
</code></pre>

<p>should be</p>

<pre><code>return super(GKEPodOperator, self).execute(context)
</code></pre>

<p>The bug is fixed in airflow 2.0 (<a href="https://issues.apache.org/jira/browse/AIRFLOW-4072" rel="nofollow noreferrer">https://issues.apache.org/jira/browse/AIRFLOW-4072</a>)</p>

<p>A suggestion could be to to create a plugin YourOwnGKEOperator that fixes this problem locally. (and deploy it into your plugins folder)</p>
