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: issue #1882 WorkflowError: Metadata can't be created as it already exists (Windows) #1971

Merged
merged 4 commits into from Dec 6, 2022

Conversation

stanmart
Copy link
Contributor

@stanmart stanmart commented Nov 17, 2022

Description

Fixes issue #1882: WorkflowError: Metadata can't be created as it already exists (Windows)

The underlying cause of the problem is that os.rename was used to overwrite the target file. Unfortunately, it has a different behavior under Unix/Linux (overwrites target) and Windows (fails). os.replace is an alternative to os.rename that simulates the Unix behavior.

The required change is extremely small (commit 4ad1ab1) and I have also added a test case covering it (commit e12955f).

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

Fixes issue #1882:
WorkflowError: Metadata can't be created as it already exists (Windows)

Cause: os.rename fails with an exception on Windows if the target exists
Fix: os.replace is a cross-platform way to achieve the same
(cf. https://stackoverflow.com/q/8107352)
Run a simple rule twice. Used to fail on Windows.
@stanmart stanmart changed the title Fix issue #1882: WorkflowError: Metadata can't be created as it already exists (Windows) fix: issue #1882 WorkflowError: Metadata can't be created as it already exists (Windows) Nov 17, 2022
@johanneskoester
Copy link
Contributor

May I ask you to update to the latest upstream version of the main branch?

@stanmart
Copy link
Contributor Author

stanmart commented Dec 2, 2022

Sure! Though it seems to me that this branch is up to date with main unless I'm missing something.

@sonarcloud
Copy link

sonarcloud bot commented Dec 6, 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

@johanneskoester johanneskoester merged commit d4484e6 into snakemake:main Dec 6, 2022
@stanmart stanmart deleted the fix/issue1882 branch December 7, 2022 12:16
johanneskoester added a commit that referenced this pull request Dec 13, 2022
🤖 I have created a release *beep* *boop*
---


##
[7.19.0](v7.18.2...v7.19.0)
(2022-12-13)


### Features

* add keyword to gridftp remote provide to specify the number or disable
usage of multiple data stream
([#1974](#1974))
([3e6675d](3e6675d))
* provide information about temp, pipe, and service files in --summary
([#1977](#1977))
([c7c7776](c7c7776))
* native SLURM support (--slurm, see docs)
([#1015](#1015))
([c7ea059](c7ea059))


### Bug Fixes

* avoid logfile writing in case of dryrun; better hints in case of
incomplete checkpoints
([#1994](#1994))
([a022705](a022705))
* handle case where zenodo deposition does not return files
([#2004](#2004))
([b63c4a7](b63c4a7))
* issue [#1882](#1882)
WorkflowError: Metadata can't be created as it already exists (Windows)
([#1971](#1971))
([d4484e6](d4484e6))
* json validation error with markdown cells
([#1986](#1986))
([6c26f75](6c26f75))

---
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>
Co-authored-by: Johannes Köster <johannes.koester@tu-dortmund.de>
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