question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

filesensor wildcard matching does not recognize directories

See original GitHub issue

Apache Airflow version: 2.1.0

Environment:

  • Cloud provider or hardware configuration:
  • OS (e.g. from /etc/os-release):
  • Kernel (e.g. uname -a):
  • Install tools:
  • Others:

What happened: FileSensor does not recognize directories with wildcard glob matching.

What you expected to happen: FileSensor would sense a directory that contains files if it matches with the wild card option.

How to reproduce it: Create a directory with a pattern that matches a wild card using glob

Anything else we need to know: Code from FileSensor source that I believe to cause the issue:

for path in glob(full_path):
            if os.path.isfile(path):
                mod_time = os.path.getmtime(path)
                mod_time = datetime.datetime.fromtimestamp(mod_time).strftime('%Y%m%d%H%M%S')
                self.log.info('Found File %s last modified: %s', str(path), str(mod_time))
                return True

            for _, _, files in os.walk(full_path):
                if len(files) > 0:
                    return True
        return False

I believe to resolve the issue full_path in os.walk should be path instead.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
0sunnycommented, Jul 9, 2021

Can you please assign this to me ?

1reaction
potiukcommented, Jul 8, 2021

Running now

Read more comments on GitHub >

github_iconTop Results From Across the Web

airflow fileSensor matching with specific file pattern
Since the FileSensor operator uses glob module to match file patterns, you can use a file name pattern or a wildcard to achieve...
Read more >
PRTG Manual: File Sensor - Paessler
The File sensor monitors a file located on the local disk on the probe system, parent device, or a file that is accessible...
Read more >
Source code for airflow.sensors.s3_key_sensor
S3 being a key/value it does not support folders. The path is just a key a resource. :param bucket_key: The key being waited...
Read more >
org.apache.airflow.commits - 2021 July - 5,955 messages - MarkMail
[GitHub] [airflow] ShraddheyaS commented on issue #16725: filesensor wildcard matching does not recognize directories - GitBox.
Read more >
Narrowing the focus with analysis scope
Pattern matching with wildcards is not supported. ... in the scanner invocation or in the appropriate configuration file (see Analysis Parameters).
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found