You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by ms...@apache.org on 2016/10/25 05:03:40 UTC
incubator-airflow git commit: [AIRFLOW-592] example_xcom import Error
Repository: incubator-airflow
Updated Branches:
refs/heads/master 928fa986c -> c49d0b36b
[AIRFLOW-592] example_xcom import Error
fix exmple_xcom import error:
AttributeError: 'module' object has no attribute
'python_operator'
Closes #1853 from forevernull/master
Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/c49d0b36
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/c49d0b36
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/c49d0b36
Branch: refs/heads/master
Commit: c49d0b36b20c5e69453aef6082f2175ff37a9a98
Parents: 928fa98
Author: forevernull <fo...@163.com>
Authored: Tue Oct 25 10:33:17 2016 +0530
Committer: Sumit Maheshwari <su...@qubole.com>
Committed: Tue Oct 25 10:33:17 2016 +0530
----------------------------------------------------------------------
airflow/example_dags/example_xcom.py | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/c49d0b36/airflow/example_dags/example_xcom.py
----------------------------------------------------------------------
diff --git a/airflow/example_dags/example_xcom.py b/airflow/example_dags/example_xcom.py
index ed8825c..50728c3 100644
--- a/airflow/example_dags/example_xcom.py
+++ b/airflow/example_dags/example_xcom.py
@@ -12,7 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import print_function
-import airflow
+from airflow import DAG
+from airflow.operators.python_operator import PythonOperator
from datetime import datetime, timedelta
seven_days_ago = datetime.combine(
@@ -24,7 +25,7 @@ args = {
'provide_context': True
}
-dag = airflow.DAG(
+dag = DAG(
'example_xcom',
start_date=datetime(2015, 1, 1),
schedule_interval="@once",
@@ -59,13 +60,13 @@ def puller(**kwargs):
v1, v2 = ti.xcom_pull(key=None, task_ids=['push', 'push_by_returning'])
assert (v1, v2) == (value_1, value_2)
-push1 = airflow.operators.python_operator.PythonOperator(
+push1 = PythonOperator(
task_id='push', dag=dag, python_callable=push)
-push2 = airflow.operators.python_operator.PythonOperator(
+push2 = PythonOperator(
task_id='push_by_returning', dag=dag, python_callable=push_by_returning)
-pull = airflow.operators.python_operator.PythonOperator(
+pull = PythonOperator(
task_id='puller', dag=dag, python_callable=puller)
pull.set_upstream([push1, push2])