Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

async util: handle empty dirs better #3797

Merged
merged 3 commits into from
Sep 2, 2020
Merged

Conversation

oliver-sanders
Copy link
Member

Just noticed a warning which can occur if scandir attempts to scan an empty directory.

I think this is harmless ATM as the only use of scandir is workflow scanning, if a workflow dir is empty then it's not a workflow dir so can be safely skipped.

Also add a small update post-#3755.

@oliver-sanders oliver-sanders added the bug? Not sure if this is a bug or not label Sep 1, 2020
@oliver-sanders oliver-sanders added this to the cylc-8.0a3 milestone Sep 1, 2020
@oliver-sanders oliver-sanders self-assigned this Sep 1, 2020
@@ -389,7 +389,7 @@ def _scandir(future, path, request):
"""Callback helper for scandir()."""
future.set_result([
Path(path, directory.name)
for directory in request.result
for directory in request.result or []
Copy link
Member

@hjoliver hjoliver Sep 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this make any difference? If I put an empty directory in ~cylc-run then request.result is an empty list already. (And I didn't see an error without this change).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw an error where (request.result was returning None) in the log whilst working on cylc-uiserver so put this in to suppress it.

Perhaps it happens when you scan a non-existent directory or something like that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, fair enough. Probably needs a comment then, because it looks weird (if you expect request.result to always be list).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, GitHub let me create a "suggestion" and commit it to the branch 😁

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One review will do for this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brilliant, my comment was a style violation (line too long) 🤣

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hot fix coming.

@hjoliver hjoliver merged commit 946adda into cylc:master Sep 2, 2020
@hjoliver hjoliver modified the milestones: cylc-8.0a3, cylc-8.0b0 Feb 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug? Not sure if this is a bug or not
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants