You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "simonprydden (via GitHub)" <gi...@apache.org> on 2023/12/15 08:56:48 UTC

[I] S3 sensor error when using timedelta [airflow]

simonprydden opened a new issue, #36238:
URL: https://github.com/apache/airflow/issues/36238

   ### Apache Airflow version
   
   Other Airflow 2 version (please specify below)
   
   ### If "Other Airflow 2 version" selected, which one?
   
   2.5.3
   
   ### What happened?
   
   hi, I'm getting a dabbag load error when using s3 key sensor operator.
   ``` 
   File "/usr/local/airflow/.local/lib/python3.10/site-packages/airflow/sensors/base.py", line 130, in __init__
       self._validate_input_values()
     File "/usr/local/airflow/.local/lib/python3.10/site-packages/airflow/sensors/base.py", line 142, in _validate_input_values
       raise AirflowException("The poke_interval must be a non-negative number")
   airflow.exceptions.AirflowException: The poke_interval must be a non-negative number
   ```
   
   
   ### What you think should happen instead?
   
   _No response_
   
   ### How to reproduce
   
   here is the code from the dag.
   ```
       check_file = S3KeySensor(
           task_id="check_file",
           bucket_key="example_key",
           bucket_name="example_bucket",
           poke_interval=timedelta(seconds=10),
           timeout=timedelta(seconds=60),
       )
   ````
   
   ### Operating System
   
   linux
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Amazon (AWS) MWAA
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   I think the validate function does not consider timedelta as valid, but the docstring mentions it  `poke_interval: timedelta | float = 60,`
   ```
       def _validate_input_values(self) -> None:
           if not isinstance(self.poke_interval, (int, float)) or self.poke_interval < 0:
               raise AirflowException("The poke_interval must be a non-negative number")
           if not isinstance(self.timeout, (int, float)) or self.timeout < 0:
               raise AirflowException("The timeout must be a non-negative number")
   ```
   here is link to the function.
   https://github.com/apache/airflow/blob/01fd0d31b46682f4d700aaacf19cfe7a0fe9a057/airflow/sensors/base.py#L183
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


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

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


Re: [I] S3 sensor error when using timedelta [airflow]

Posted by "Taragolis (via GitHub)" <gi...@apache.org>.
Taragolis commented on issue #36238:
URL: https://github.com/apache/airflow/issues/36238#issuecomment-1857530451

   Support of `datetime.timedelta` as valid parameter for `BaseOperatorSensor.poke_interval` was added in Airflow 2.7:
   - https://github.com/apache/airflow/pull/32515
   
   So it not applicable to use timedelta as poke_interval in any Sensors if you use Airflow 2.5.3
   
   


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


Re: [I] S3 sensor error when using timedelta [airflow]

Posted by "Taragolis (via GitHub)" <gi...@apache.org>.
Taragolis closed issue #36238: S3 sensor error when using timedelta
URL: https://github.com/apache/airflow/issues/36238


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