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

Add a default timeout for filelock #2391

Merged
merged 1 commit into from
Jul 15, 2024
Merged

Conversation

edevil
Copy link
Contributor

@edevil edevil commented Jul 15, 2024

File lock operations did not have an associated timeout, which could present problems when trying to debug an issue since nothing would be logged if we could not acquire the lock and would wait forever.

@Wauplin
Copy link
Contributor

Wauplin commented Jul 15, 2024

Hi @edevil, thanks for raising the question. I'm not a fan of a 5min timeout since 1. it's already quite long for a user to debug 2. it's still too short when downloading huge files.
Instead of a timeout, what do you think of customizing the filelock so that:

  1. it waits for 10s
  2. if it raises a timeout, print a message (INFO log?) and wait indefinitely to acquire the lock (as done currently).

This way the new behavior will be similar to the current one, while still having a correct log message for the end user. What do you think?

@edevil edevil force-pushed the filelock_timeout branch from 32bcc7d to 014856a Compare July 15, 2024 13:02
@edevil
Copy link
Contributor Author

edevil commented Jul 15, 2024

Hey @Wauplin, addressed your comments. Thanks.

Copy link
Contributor

@Wauplin Wauplin left a comment

Choose a reason for hiding this comment

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

Thanks for making the quick changes @edevil! That's a good place where to put that indeed :) I've left some minor comments. Could you also run the linters? You need to install the dev dependencies (pip install -e ".[dev]") and run make style. To be sure the changes are correct, you can run make quality. Thanks!

src/huggingface_hub/constants.py Outdated Show resolved Hide resolved
src/huggingface_hub/utils/_fixes.py Outdated Show resolved Hide resolved
src/huggingface_hub/utils/_fixes.py Outdated Show resolved Hide resolved
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@edevil
Copy link
Contributor Author

edevil commented Jul 15, 2024

Could you also run the linters? You need to install the dev dependencies (pip install -e ".[dev]") and run make style. To be sure the changes are correct, you can run make quality. Thanks!

I did run those commands and it passed, maybe my editor changed something again on save. The failures don't seem related to this change, though. I've addressed your comments.

@edevil edevil force-pushed the filelock_timeout branch from 014856a to e82c5fe Compare July 15, 2024 14:28
File lock operations did not have an associated timeout, which could
present problems when trying to debug an issue since nothing would be
logged if we could not acquire the lock and would wait forever.
@edevil edevil force-pushed the filelock_timeout branch from e82c5fe to 7383d4c Compare July 15, 2024 14:29
Copy link
Contributor

@Wauplin Wauplin left a comment

Choose a reason for hiding this comment

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

Thanks! PR looks good to me now :)

@Wauplin
Copy link
Contributor

Wauplin commented Jul 15, 2024

Failing tests are unrelated to your PR so I'm merging it now. Thanks @edevil!

@Wauplin Wauplin merged commit de160a4 into huggingface:main Jul 15, 2024
11 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants