[AIRFLOW-4085] FileSensor - adding wildcard option#5358
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5358 +/- ##
==========================================
- Coverage 79.03% 79.03% -0.01%
==========================================
Files 481 481
Lines 30212 30210 -2
==========================================
- Hits 23877 23875 -2
Misses 6335 6335
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
| dir_ = tempfile.mkdtemp() | |
| dir = tempfile.mkdtemp() |
The diff is much easier to read and easier to review if you don't make changes like this. Please revert it.
ashb
left a comment
There was a problem hiding this comment.
This isn't an "option" for wildcard but support for them always. This is probably okay (as most people don't put * or ? etc in paths, but at the very least this should be mentioned in UPDATING.md
d6ed736 to
01982ea
Compare
|
@ashb done. |
01982ea to
e034cc1
Compare
|
@zacharya19 can you resolve the conflict? |
e034cc1 to
3d418bc
Compare
|
@OmerJog Done. |
ashb
left a comment
There was a problem hiding this comment.
Largely looking okay, but a few changes to make. please mention/ping me when you rebase as otherwise I might miss the update.
e8358de to
0d986c9
Compare
0d986c9 to
e93a87f
Compare
|
@ashb Fixed conflicts and answered your comments. |
ashb
left a comment
There was a problem hiding this comment.
Code looks good.
Tests were failing, I've restarted the tests, hopefully it was just a transient failure.
|
Merged. Now I just need to decide if we merge this in for release with 1.10.6 or not. It is technically a breaking change, but it is just very unlikely to affect anyone. I think. |
|
FYI this behaviour is inconsistent. If anyone like me comes to this PR after looking at the glob() behaviour, this cannot work for hooks that make use of a remote FS (like SFTPHook for example). As the Python documentation states that glob() uses a mix of os.scandir() and fnmatch.fnmatch() which make the code proposed here only adapted to a local FS. Thus, trying to use a path with a glob pattern and a hook to a remote FS will have a random effect: either you're lucky and the glob() will not find the equivalent path locally and just return that the path does not exist (the sensor will never trigger); or in a worse case scenario you might trigger the sensor for a file that exists locally but not on the remote FS as expected... |
Make sure you have checked all steps below.
Jira
Description
Changing FileSensor to use glob in order to allow wildcard and more functionality in this sensor.
Tests
Commits
Documentation
Code Quality
flake8