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

perf: cached os.pathconf() call in _record_path() #1920

Merged
merged 1 commit into from Oct 27, 2022

Conversation

roshnipatel
Copy link
Contributor

Description

The value of os.pathconf(self._incomplete_path, "PC_NAME_MAX") is cached in an attribute Persistence._max_len -- this avoids repeatedly querying the operating system for the same configuration information every time marked_incomplete() is called on a file/job output. (Note: this will dramatically speed up Snakemake DAG building on compute clusters where os.pathconf() is slow to return and the number of files checked for incompleteness is very large.)

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).

@roshnipatel roshnipatel changed the title Cached os.pathconf() call in _record_path() perf: cached os.pathconf() call in _record_path() Oct 18, 2022
@sonarcloud
Copy link

sonarcloud bot commented Oct 18, 2022

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

Copy link
Contributor

@johanneskoester johanneskoester left a comment

Choose a reason for hiding this comment

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

Good catch!

@johanneskoester johanneskoester merged commit 551badb into snakemake:main Oct 27, 2022
johanneskoester pushed a commit that referenced this pull request Oct 27, 2022
🤖 I have created a release *beep* *boop*
---


##
[7.17.0](v7.16.2...v7.17.0)
(2022-10-27)


### Features

* allow to define the cache mode per rule (this enables to exclude
software envs from the caching hash value, which can be handy e.g. for
download rules where the software version does not affect the result)
([#1933](#1933))
([715e618](715e618))


### Performance Improvements

* cached os.pathconf() call in _record_path()
([#1920](#1920))
([551badb](551badb))

---
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>
jakevc pushed a commit to jakevc/snakemake that referenced this pull request Nov 3, 2022
### Description

The value of `os.pathconf(self._incomplete_path, "PC_NAME_MAX")` is
cached in an attribute `Persistence._max_len` -- this avoids repeatedly
querying the operating system for the same configuration information
every time `marked_incomplete()` is called on a file/job output. (Note:
this will dramatically speed up Snakemake DAG building on compute
clusters where `os.pathconf()` is slow to return and the number of files
checked for incompleteness is very large.)

### QC
<!-- Make sure that you can tick the boxes below. -->

* [X] The PR contains a test case for the changes or the changes are
already covered by an existing test case.
* [X] 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).
jakevc pushed a commit to jakevc/snakemake that referenced this pull request Nov 3, 2022
🤖 I have created a release *beep* *boop*
---


##
[7.17.0](snakemake/snakemake@v7.16.2...v7.17.0)
(2022-10-27)


### Features

* allow to define the cache mode per rule (this enables to exclude
software envs from the caching hash value, which can be handy e.g. for
download rules where the software version does not affect the result)
([snakemake#1933](snakemake#1933))
([715e618](snakemake@715e618))


### Performance Improvements

* cached os.pathconf() call in _record_path()
([snakemake#1920](snakemake#1920))
([551badb](snakemake@551badb))

---
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