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/02/25 12:55:31 UTC

[GitHub] [airflow] AdamPaslawski commented on a change in pull request #21811: add newer_than parameter to SFTP sensor

AdamPaslawski commented on a change in pull request #21811:
URL: https://github.com/apache/airflow/pull/21811#discussion_r814745208



##########
File path: airflow/providers/sftp/sensors/sftp.py
##########
@@ -54,4 +63,9 @@ def poke(self, context: 'Context') -> bool:
                 raise e
             return False
         self.hook.close_conn()
-        return True
+        if self.newer_than:
+            _mod_time = datetime.strptime(mod_time, '%Y%m%d%H%M%S')
+            _newer_than = make_naive(self.newer_than) if not is_naive(self.newer_than) else self.newer_than
+            return _newer_than <= _mod_time

Review comment:
       I decided to assume a naive comparison and allow the sensor to be configured with an offset aware or unaware newer_than parameter, thoughts on this @eladkal ?




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