airflow.models.sensorinstance
¶
Module Contents¶
Classes¶
SensorInstance support the smart sensor service. It stores the sensor task states |
- class airflow.models.sensorinstance.SensorInstance(ti)[source]¶
Bases:
airflow.models.base.Base
SensorInstance support the smart sensor service. It stores the sensor task states and context that required for poking include poke context and execution context. In sensor_instance table we also save the sensor operator classpath so that inside smart sensor there is no need to import the dagbag and create task object for each sensor task.
SensorInstance include another set of columns to support the smart sensor shard on large number of sensor instance. The key idea is to generate the hash code from the poke context and use it to map to a shorter shard code which can be used as an index. Every smart sensor process takes care of tasks whose shardcode are in a certain range.
- static get_classpath(obj)[source]¶
Get the object dotted class path. Used for getting operator classpath.
- Parameters
obj –
- Returns
The class path of input object
- Return type
- classmethod register(cls, ti, poke_context, execution_context, session=None)[source]¶
Register task instance ti for a sensor in sensor_instance table. Persist the context used for a sensor and set the sensor_instance table state to sensing.
- Parameters
- Type
ti:
- Returns
True if the ti was registered successfully.
- Return type
Boolean