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 2022/10/27 20:22:31 UTC

[GitHub] [airflow] potiuk opened a new pull request, #27333: Add examples and howtos about sensors

potiuk opened a new pull request, #27333:
URL: https://github.com/apache/airflow/pull/27333

   The examples and docs were missing for a number of built-in sensors. This documentation and examples do not add much but at least give the user information that there are such sensors available when they look at our documentation.
   
   <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of an existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
   In case of fundamental code changes, an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in a newsfragment file, named `{pr_number}.significant.rst` or `{issue_number}.significant.rst`, in [newsfragments](https://github.com/apache/airflow/tree/main/newsfragments).
   


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


[GitHub] [airflow] potiuk merged pull request #27333: Add examples and howtos about sensors

Posted by GitBox <gi...@apache.org>.
potiuk merged PR #27333:
URL: https://github.com/apache/airflow/pull/27333


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


[GitHub] [airflow] XD-DENG commented on a diff in pull request #27333: Add examples and howtos about sensors

Posted by GitBox <gi...@apache.org>.
XD-DENG commented on code in PR #27333:
URL: https://github.com/apache/airflow/pull/27333#discussion_r1007808785


##########
docs/apache-airflow/howto/operator/time.rst:
##########
@@ -0,0 +1,78 @@
+ .. 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
+
+ ..   http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+
+
+.. _howto/operator:TimeDeltaSensor:
+
+TimeDeltaSensor
+===============
+
+Use the :class:`~airflow.sensors.time_delta.TimeDeltaSensor` to end sensing after specific time
+
+
+.. exampleinclude:: /../../airflow/example_dags/example_sensors.py
+    :language: python
+    :dedent: 4
+    :start-after: [START example_time_delta_sensor]
+    :end-before: [END example_time_delta_sensor]
+
+
+.. _howto/operator:TimeDeltaSensorAsync:
+
+TimeDeltaSensorAsync
+====================
+
+Use the :class:`~airflow.sensors.time_delta.TimeDeltaSensorAsync` to end sensing after specific time.
+It is an async version of the operator and requires Triggerer to run.
+
+
+.. exampleinclude:: /../../airflow/example_dags/example_sensors.py
+    :language: python
+    :dedent: 4
+    :start-after: [START example_time_delta_sensor_async]
+    :end-before: [END example_time_delta_sensor_async]
+
+
+
+.. _howto/operator:TimeSensor:
+
+TimeDeltaSensor

Review Comment:
   ```suggestion
   TimeSensor
   ```
   
   Is this a typo here?



##########
docs/apache-airflow/howto/operator/time.rst:
##########
@@ -0,0 +1,78 @@
+ .. 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
+
+ ..   http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+
+
+.. _howto/operator:TimeDeltaSensor:
+
+TimeDeltaSensor
+===============
+
+Use the :class:`~airflow.sensors.time_delta.TimeDeltaSensor` to end sensing after specific time

Review Comment:
   ```suggestion
   Use the :class:`~airflow.sensors.time_delta.TimeDeltaSensor` to end sensing after specific time.
   ```



##########
docs/apache-airflow/howto/operator/time.rst:
##########
@@ -0,0 +1,78 @@
+ .. 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
+
+ ..   http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+
+
+.. _howto/operator:TimeDeltaSensor:
+
+TimeDeltaSensor
+===============
+
+Use the :class:`~airflow.sensors.time_delta.TimeDeltaSensor` to end sensing after specific time
+
+
+.. exampleinclude:: /../../airflow/example_dags/example_sensors.py
+    :language: python
+    :dedent: 4
+    :start-after: [START example_time_delta_sensor]
+    :end-before: [END example_time_delta_sensor]
+
+
+.. _howto/operator:TimeDeltaSensorAsync:
+
+TimeDeltaSensorAsync
+====================
+
+Use the :class:`~airflow.sensors.time_delta.TimeDeltaSensorAsync` to end sensing after specific time.
+It is an async version of the operator and requires Triggerer to run.
+
+
+.. exampleinclude:: /../../airflow/example_dags/example_sensors.py
+    :language: python
+    :dedent: 4
+    :start-after: [START example_time_delta_sensor_async]
+    :end-before: [END example_time_delta_sensor_async]
+
+
+
+.. _howto/operator:TimeSensor:
+
+TimeDeltaSensor
+===============
+
+Use the :class:`~airflow.sensors.time_sensor.TimeSensor` to end sensing after time specified.
+
+.. exampleinclude:: /../../airflow/example_dags/example_sensors.py
+    :language: python
+    :dedent: 4
+    :start-after: [START example_time_sensors]
+    :end-before: [END example_time_sensors]
+
+
+.. _howto/operator:TimeSensorAsync:
+
+TimeDeltaSensorAsync

Review Comment:
   ```suggestion
   TimeSensorAsync
   ```
   
   Also seems a typo here?



##########
airflow/sensors/time_delta.py:
##########
@@ -28,6 +28,12 @@ class TimeDeltaSensor(BaseSensorOperator):
     Waits for a timedelta after the run's data interval.
 
     :param delta: time length to wait after the data interval before succeeding.
+
+    .. seealso::
+        For more information on how to use this sensor, take a look at the guide:

Review Comment:
   Very minor thing: I see sometimes you wrote _"For more information on how to use this **sensor**"_ and sometimes you wrote _"For more information on how to use this **operator**"_. Does it make sense to you to make it more consistent?



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


[GitHub] [airflow] XD-DENG commented on a diff in pull request #27333: Add examples and howtos about sensors

Posted by GitBox <gi...@apache.org>.
XD-DENG commented on code in PR #27333:
URL: https://github.com/apache/airflow/pull/27333#discussion_r1007808785


##########
docs/apache-airflow/howto/operator/time.rst:
##########
@@ -0,0 +1,78 @@
+ .. 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
+
+ ..   http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+
+
+.. _howto/operator:TimeDeltaSensor:
+
+TimeDeltaSensor
+===============
+
+Use the :class:`~airflow.sensors.time_delta.TimeDeltaSensor` to end sensing after specific time
+
+
+.. exampleinclude:: /../../airflow/example_dags/example_sensors.py
+    :language: python
+    :dedent: 4
+    :start-after: [START example_time_delta_sensor]
+    :end-before: [END example_time_delta_sensor]
+
+
+.. _howto/operator:TimeDeltaSensorAsync:
+
+TimeDeltaSensorAsync
+====================
+
+Use the :class:`~airflow.sensors.time_delta.TimeDeltaSensorAsync` to end sensing after specific time.
+It is an async version of the operator and requires Triggerer to run.
+
+
+.. exampleinclude:: /../../airflow/example_dags/example_sensors.py
+    :language: python
+    :dedent: 4
+    :start-after: [START example_time_delta_sensor_async]
+    :end-before: [END example_time_delta_sensor_async]
+
+
+
+.. _howto/operator:TimeSensor:
+
+TimeDeltaSensor

Review Comment:
   ```suggestion
   TimeSensor
   ```
   
   Wrong title here?



##########
docs/apache-airflow/howto/operator/time.rst:
##########
@@ -0,0 +1,78 @@
+ .. 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
+
+ ..   http://www.apache.org/licenses/LICENSE-2.0
+
+ .. Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+
+
+
+.. _howto/operator:TimeDeltaSensor:
+
+TimeDeltaSensor
+===============
+
+Use the :class:`~airflow.sensors.time_delta.TimeDeltaSensor` to end sensing after specific time
+
+
+.. exampleinclude:: /../../airflow/example_dags/example_sensors.py
+    :language: python
+    :dedent: 4
+    :start-after: [START example_time_delta_sensor]
+    :end-before: [END example_time_delta_sensor]
+
+
+.. _howto/operator:TimeDeltaSensorAsync:
+
+TimeDeltaSensorAsync
+====================
+
+Use the :class:`~airflow.sensors.time_delta.TimeDeltaSensorAsync` to end sensing after specific time.
+It is an async version of the operator and requires Triggerer to run.
+
+
+.. exampleinclude:: /../../airflow/example_dags/example_sensors.py
+    :language: python
+    :dedent: 4
+    :start-after: [START example_time_delta_sensor_async]
+    :end-before: [END example_time_delta_sensor_async]
+
+
+
+.. _howto/operator:TimeSensor:
+
+TimeDeltaSensor
+===============
+
+Use the :class:`~airflow.sensors.time_sensor.TimeSensor` to end sensing after time specified.
+
+.. exampleinclude:: /../../airflow/example_dags/example_sensors.py
+    :language: python
+    :dedent: 4
+    :start-after: [START example_time_sensors]
+    :end-before: [END example_time_sensors]
+
+
+.. _howto/operator:TimeSensorAsync:
+
+TimeDeltaSensorAsync

Review Comment:
   ```suggestion
   TimeSensorAsync
   ```
   
   Also seems wrong title here?



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


[GitHub] [airflow] potiuk commented on pull request #27333: Add examples and howtos about sensors

Posted by GitBox <gi...@apache.org>.
potiuk commented on PR #27333:
URL: https://github.com/apache/airflow/pull/27333#issuecomment-1294060637

   Small but I think nice :)


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


[GitHub] [airflow] potiuk commented on pull request #27333: Add examples and howtos about sensors

Posted by GitBox <gi...@apache.org>.
potiuk commented on PR #27333:
URL: https://github.com/apache/airflow/pull/27333#issuecomment-1295080155

   All addressed @XD-DENG 


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


[GitHub] [airflow] potiuk commented on a diff in pull request #27333: Add examples and howtos about sensors

Posted by GitBox <gi...@apache.org>.
potiuk commented on code in PR #27333:
URL: https://github.com/apache/airflow/pull/27333#discussion_r1008092902


##########
airflow/sensors/time_delta.py:
##########
@@ -28,6 +28,12 @@ class TimeDeltaSensor(BaseSensorOperator):
     Waits for a timedelta after the run's data interval.
 
     :param delta: time length to wait after the data interval before succeeding.
+
+    .. seealso::
+        For more information on how to use this sensor, take a look at the guide:

Review Comment:
   Yeeah. :). I think I missed it in a few places. This is verbatim copied from our "build-docs" warning when such clause is missing and "operator" is there, so I needed to manually change it. Obvioulsy missed it in a few places 



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