You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/08/26 08:35:15 UTC

[GitHub] [airflow] potiuk edited a comment on issue #17834: Python Sensor cannot be turned into a Smart Sensor

potiuk edited a comment on issue #17834:
URL: https://github.com/apache/airflow/issues/17834#issuecomment-906207958


   You are right we cannot do a "generic" python operator but maybe we could have some variant of AbstractAsyncPythonSensor (Abstract class). This could allow you to define a truly async Python operator. I could imagine API like that (pseudo-code):
   
   
   ```
   class AbstractAsyncPythonSensor(Sensor):
       __init__(self, poke_method: Callable):
             ....
   
       async def wait():
             raise NotImplemeted()
   ```
   
   
   Then you could define your own SpecificAsyncPythonSensor - where wait() method would be an async method doing await internally on somehing in triggerer but then the poke method would be actually executed  in worker after the task is started.
   
   I think that could be the closest it can get to async/awaitable Python generic operator :)
   
   WDYT? It is a bit of an improvement over having to always write a new class. If you have potentially different sensor logic (but all sensors being awoken on the same kind of stuff (for example an SQS message coming), that might be a nice tool.
   


-- 
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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org