-
Notifications
You must be signed in to change notification settings - Fork 96
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
Fix for config file locking #1719
Conversation
kessler-frost
commented
Jul 4, 2023
•
edited
Loading
edited
- I have added the tests to cover my changes.
- I have updated the documentation and CHANGELOG accordingly.
- I have read the CONTRIBUTING document.
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
Closes #1670. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## develop #1719 +/- ##
===========================================
- Coverage 88.20% 86.28% -1.93%
===========================================
Files 191 191
Lines 8218 8217 -1
Branches 151 151
===========================================
- Hits 7249 7090 -159
- Misses 864 1022 +158
Partials 105 105
*This pull request uses carry forward flags. Click here to find out more. |
By the way, not that it needs to be done in this PR, but there's one other section in the codebase that relies on the OS-dependent covalent/covalent_ui/api/main.py Lines 73 to 75 in 691f0eb
Maybe it'll be possible to replace that call too at some point. |
Yep that's on my radar. Thanks @arosen93 ! |
@arosen93 Do you mind helping me out a bit with this one, can you check whether this solution works on your side on the slurm cluster (where there was the NFS based system) for which covalent was halting earlier? Thanks a lot! |
Certainly! I'll check in the AM here. |
@kessler-frost: I reran my typical test (#1697). A few notes.
Traceback (most recent call last):
File "/pscratch/sd/r/rosen/test.py", line 1, in <module>
import covalent
File "/global/common/software/matgen/rosen/miniconda/envs/test/lib/python3.10/site-packages/covalent/__init__.py", line 26, in <module>
from . import executor, leptons # nopycln: import
File "/global/common/software/matgen/rosen/miniconda/envs/test/lib/python3.10/site-packages/covalent/executor/__init__.py", line 33, in <module>
from .._shared_files import logger
File "/global/common/software/matgen/rosen/miniconda/envs/test/lib/python3.10/site-packages/covalent/_shared_files/logger.py", line 34, in <module>
log_level = get_config("sdk.log_level").upper()
File "/global/common/software/matgen/rosen/miniconda/envs/test/lib/python3.10/site-packages/covalent/_shared_files/config.py", line 244, in get_config
cm = ConfigManager()
File "/global/common/software/matgen/rosen/miniconda/envs/test/lib/python3.10/site-packages/covalent/_shared_files/config.py", line 56, in __init__
self.update_config()
File "/global/common/software/matgen/rosen/miniconda/envs/test/lib/python3.10/site-packages/covalent/_shared_files/config.py", line 113, in update_config
with filelock.FileLock(f"{self.config_file}.lock", timeout=1):
File "/global/common/software/matgen/rosen/miniconda/envs/test/lib/python3.10/site-packages/filelock/_api.py", line 255, in __enter__
self.acquire()
File "/global/common/software/matgen/rosen/miniconda/envs/test/lib/python3.10/site-packages/filelock/_api.py", line 222, in acquire
raise Timeout(lock_filename) # noqa: TRY301
filelock._error.Timeout: The file lock '/global/homes/r/rosen/.config/covalent/covalent.conf.lock' could not be acquired. The reason the lock can't be acquired is because the default More importantly, because there's no stalling and a proper error is raised, at least it is telling the user to do something about it. In this case, the user has to just update their So, in summary, I think this solution is better and worth merging because:
Just make sure If you're curious, I also tried |
Thanks a lot @arosen93 ! I'll clean this one up and get this merged. |
Great! Thanks for addressing this :) |
So, I wanted to try out covalent on Windows on my end as well and after spending quite a lot of time on setting things up, it turns out there's more work involved in making this work for Windows than I expected. So, I guess I'll tackle handling that support in this PR. Will still check whether this is working with multiple processes trying to edit the config file simultaneously. |
def set_winsize(fd, row, col, xpix=0, ypix=0):
winsize = struct.pack("HHHH", row, col, xpix, ypix)
fcntl.ioctl(fd, termios.TIOCSWINSZ, winsize) The above |