-
Notifications
You must be signed in to change notification settings - Fork 667
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
Transfer of fasteners
dependency to filelock
#4800
Transfer of fasteners
dependency to filelock
#4800
Conversation
changes fasteners to filelock dependency
changes fasteners to filelock dependency
changes in the action the fasteners dependency to filelock
adjusted input fasteners to filelock
changed fasteners to filelock
changed fasteners to filelock
changed fasteners to filelock
fasteners
dependency to fielock
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #4800 +/- ##
===========================================
- Coverage 93.66% 93.62% -0.05%
===========================================
Files 177 189 +12
Lines 21795 22861 +1066
Branches 3067 3067
===========================================
+ Hits 20414 21403 +989
- Misses 929 1006 +77
Partials 452 452 ☔ View full report in Codecov by Sentry. |
test _read_offsets adjustment
modification of test_offset_lock_created to adjust to new dependency
returned the warning and read_offsets for tests
required removal of asser_equal to not get the error, since now the files, dont't end with lock and the removal of the end would be a duplicate of the other assert_equal
@yuxuanzhuang I would ping you since you worked on the and if they require modification. Other than that the only problem that I encounter now is the Azure failing, due to Windows runners |
fasteners
dependency to fielock
fasteners
dependency to filelock
changed read offsets from True to False, retained the warning
changed and to or pytest warning in test
@IAlibay I would probably ping you in this PR to get your opinion, due to the problem with |
The issue is that Refer to the following line of code: When the lock file cannot be written in Windows, instead of raising a In contrast, on UNIX systems https://github.com/tox-dev/filelock/blob/57f488ff8fdc2193572efe102408fb63cfefe4e4/src/filelock/_unix.py#L42, if the file cannot be written, the operation fails immediately, raising an appropriate exception. Not sure why platforms are implemented differently though. |
test path
test path modification
moved back
add skip exception for azure
Hello @talagayev! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2025-01-11 15:59:37 UTC |
small black adjustments
Sorry for the late reply and not working on the PR, was mainly on holidays and afterwards working on an publication. @yuxuanzhuang I adjusted now the two pytests for Currently the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My comments have been addressed. I have one non-blocking question/suggestion. Thanks!!
# Acquire the lock | ||
lock.acquire() | ||
|
||
time.sleep(5) # wait 5 seconds before checking if the file is locked |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you choose 5 seconds? Could 1s be sufficient — the less time we spend in a test, the better.
Add a comment why delay is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was debating if to have the sleep
overall or not. @yuxuanzhuang suggested 10 seconds, I thought 5 seconds would be the optimum, but yes for tests speed it makes sense to reduce it. Overall now that I see I think that the time.sleep()
is overall redundant here, since @yuxuanzhuang meant it in a different sense. So I would tend to remove it overall, since it is not necessary to have it in the test and just makes the test 5 seconds longer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not exactly the same test as I suggested.
One possible approach could be to spawn a file lock in a separate process for 10 seconds and then verify that the read_offsets function takes more than 10 seconds to complete, indicating it’s waiting for the lock to be released.
I think it’s fine to revert to the original test that simply verifies the creation of the offset lock file.
The other part of the PR looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not exactly the same test as I suggested.
One possible approach could be to spawn a file lock in a separate process for 10 seconds and then verify that the read_offsets function takes more than 10 seconds to complete, indicating it’s waiting for the lock to be released.
I think it’s fine to revert to the original test that simply verifies the creation of the offset lock file.
The other part of the PR looks good to me.
@yuxuanzhuang yes somehow I think I tried it first before the holidays with the separate process, but had troubles implementing it, since I had the case that the tests ran indefinetly and after the holidays the idea of the 10 seconds kinda got lost overtime, which is why the pytest looks different than what you had in mind.
As for reverting you mean reverting back to the current version of the test in the develop
branch:
mdanalysis/testsuite/MDAnalysisTests/coordinates/test_xdr.py
Lines 1016 to 1019 in 263bbe6
def test_offset_lock_created(self): | |
assert os.path.exists( | |
XDR.offsets_filename(self.filename, ending="lock") | |
) |
or any iteration from the previous commits in this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The one in the develop
branch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yuxuanzhuang hm, now the problem appears again regardin the ending="lock"
which is not present and thus leads to an error and by removing the ending="lock"
it just checks that the file exists but not that it is locked.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m not sure, but the test was originally checking the existence of lock file for self.filename
, whereas it should have been testing self.traj
instead. The test passed previously more as a side effect of directly reading offsets from self.filename
in the other test.
Nice, thank you @orbeckst, the only thing I am not sure about, would be the |
# Acquire the lock | ||
lock.acquire() | ||
|
||
time.sleep(5) # wait 5 seconds before checking if the file is locked |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not exactly the same test as I suggested.
One possible approach could be to spawn a file lock in a separate process for 10 seconds and then verify that the read_offsets function takes more than 10 seconds to complete, indicating it’s waiting for the lock to be released.
I think it’s fine to revert to the original test that simply verifies the creation of the offset lock file.
The other part of the PR looks good to me.
remove sleep
reverted to pytest in develop
check without lock
return ending="lock"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears that the lock file only exists when it is actively locked on Windows machines.
quite an interesting case that it behaves differently on Windows compared to the other systems 🤔 |
@orbeckst Let me know you need to have another look at this PR, otherwise, I think it is good to get merged. Extra things need to be done:
|
All ok from my side. Please do the follow-up issues. |
@yuxuanzhuang I could raise the Issue for the User Guide, but for the |
Thanks @talagayev! I will raise issues in both locations. |
Perfect, thank you @yuxuanzhuang with helping with the PR and thank you @orbeckst for looking into the PR :) |
@yuxuanzhuang the Userguide Issue would be quite a fast and straightforward PR. The question would be, should I quickly do it tomorrow or would it be more reasonable to keep it for now in case of GSOC, since I have a feeling that there are not so many beginner friendly PRs left for newcomers currently and the parallelization ones that are not tackled are the ones, that I already tried tackling locally and had struggles to find a solution to get them parallelized, so those would probably be complicated for beginners 🤔 |
Now please - we shouldn't sit on anything that deal with dependencies, especially when it's a non-optional one. |
Ah I see @yuxuanzhuang already created a PR for it, so all good :) |
Fixes #4797
Changes made in this Pull Request:
fasteners
dependency fromXDR.py
and all installation filesfilelock
as an replacement dependency offasteners
PR Checklist
Developers certificate of origin
📚 Documentation preview 📚: https://mdanalysis--4800.org.readthedocs.build/en/4800/