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

fix: Fix race condition when creating lock directory #2225

Merged
merged 3 commits into from Apr 28, 2023

Conversation

sirno
Copy link
Contributor

@sirno sirno commented Apr 20, 2023

Description

This PR makes two changes:

  1. when --nolock is set, it will avoid creating a lock directory
  2. when multiple instances of snakemake are running there is a race condition on the os.mkdir call. Switching to os.makedirs and setting exist_ok=True will simply avoid raising an exception in this case.

QC

  • The PR contains a test case for the changes or the changes are already covered by an existing test case.
  • The documentation (docs/) is updated to reflect the changes or this is not necessary (e.g. if the change does neither modify the language nor the behavior or functionalities of Snakemake).

@sirno
Copy link
Contributor Author

sirno commented Apr 20, 2023

Removing the conditions and using os.makedirs(path, exist_ok=True) which is perfectly able to deal with concurrency is probably best.

@sonarcloud
Copy link

sonarcloud bot commented Apr 28, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@johanneskoester johanneskoester merged commit 66ea4d1 into snakemake:main Apr 28, 2023
8 checks passed
johanneskoester pushed a commit that referenced this pull request Apr 28, 2023
🤖 I have created a release *beep* *boop*
---


##
[7.25.2](v7.25.1...v7.25.2)
(2023-04-28)


### Bug Fixes

* Fix inconsistencies between detailed summary and normal summary
([#2218](#2218))
([d903123](d903123))
* Fix race condition when creating lock directory
([#2225](#2225))
([66ea4d1](66ea4d1))
* quote paths given to singularity in order to ensure that it does not
fail when paths contain whitespace
([#2190](#2190))
([a572fb7](a572fb7))


### Documentation

* added changelog info for >v7.19.1 parsing error of "hh:mm:ss" time
format in runtime resource
([#2189](#2189))
([2889f38](2889f38))
* update misc/vim/Readme with info for packer.nvim
([#2095](#2095))
([32166a7](32166a7))
* Update workflow syntax with priority directive
([#2188](#2188))
([af10db5](af10db5))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

None yet

2 participants