GitHub user tdenjoyer added a comment to the discussion: Processing logic in 
Sensors

I think this is exactly what I wanted:

```python
class ScheduledPythonOperator(DateTimeSensorAsync):

    def __init__(
        self,
        *,
        python_callable: Callable,
        op_args: Collection[Any] | None = None,
        op_kwargs: Mapping[str, Any] | None = None,
        **kwargs,
    ) -> None:
        self.python_callable = python_callable
        self.op_args = op_args or ()
        self.op_kwargs = op_kwargs or {}
        super().__init__(
            **kwargs,
        )

    def execute_complete(self, context: Context, event: Any = None) -> None:
        self.python_callable(*self.op_args, **self.op_kwargs)
```

Simple as that, just overcomplicated it in my head.

Dziękuję!

GitHub link: 
https://github.com/apache/airflow/discussions/43579#discussioncomment-11128439

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to