airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <>
Subject [GitHub] [airflow] dstandish commented on a change in pull request #6210: [AIRFLOW-5567] BaseAsyncOperator
Date Wed, 16 Oct 2019 17:19:31 GMT
dstandish commented on a change in pull request #6210: [AIRFLOW-5567] BaseAsyncOperator

 File path: airflow/models/
 @@ -0,0 +1,161 @@
+# -*- coding: utf-8 -*-
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+Base Asynchronous Operator for kicking off a long running
+operations and polling for completion with reschedule mode.
+from abc import abstractmethod
+from typing import Dict, List, Optional, Union
+from airflow.models import SkipMixin, TaskReschedule
+from airflow.models.xcom import XCOM_EXTERNAL_RESOURCE_ID_KEY
+from airflow.sensors.base_sensor_operator import BaseSensorOperator
+from airflow.utils.decorators import apply_defaults
 Review comment:
   OK I think I may have found an issue.
   In live testing it appeared XCOM was not recorded.  In actuality, the problem is XCOM is
cleared when task restarts after reschedule.  So after first rescheduled poke, the xcom is
   XCOM data appears to be cleared at start of each task.  [See here](
   So during when task restarts after reschedule, we lose the resource id.
   Probably a similar explanation for invisible logs issue i commented on earlier.
   Here's my sample operator:
   class Op(BaseAsyncOperator):
       def submit_request(self, context: Dict) -> str:
           return '129uh8981h9u80eh'
       def poke(self, context):
           ti = context['ti']
           print(f"try_number: {ti.try_number}")
           for k, v in context.items():
               print(f"{k}: {v}")
           print("\n sleeping")
           import time
           return False
   Not sure what is best way to resolve.

This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

With regards,
Apache Git Services

View raw message