Fokko closed pull request #2362: Make FileSensor detect file or folder URL: https://github.com/apache/incubator-airflow/pull/2362
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/airflow/contrib/operators/fs_operator.py b/airflow/contrib/operators/fs_operator.py index 259648709d..b654682268 100644 --- a/airflow/contrib/operators/fs_operator.py +++ b/airflow/contrib/operators/fs_operator.py @@ -13,7 +13,7 @@ # limitations under the License. # -from os import walk +import os import logging from airflow.operators.sensors import BaseSensorOperator @@ -51,8 +51,5 @@ def poke(self, context): full_path = "/".join([basepath, self.filepath]) logging.info( 'Poking for file {full_path} '.format(**locals())) - try: - files = [f for f in walk(full_path)] - except: - return False - return True + + return os.path.exists(full_path) ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services