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

Prevent Overwriting of Existing Sample Sheets (#3915) #4012

Merged
merged 3 commits into from
Dec 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion cg/apps/demultiplex/sample_sheet/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from cg.apps.demultiplex.sample_sheet.sample_sheet_creator import SampleSheetCreator
from cg.apps.demultiplex.sample_sheet.sample_sheet_validator import SampleSheetValidator
from cg.apps.demultiplex.sample_sheet.utils import (
delete_sample_sheet_from_housekeeper,
add_and_include_sample_sheet_path_to_housekeeper,
delete_sample_sheet_from_housekeeper,
)
from cg.apps.housekeeper.hk import HousekeeperAPI
from cg.apps.lims import LimsAPI
Expand Down Expand Up @@ -160,6 +160,16 @@ def _use_sample_sheet_from_housekeeper(
"would have copied it to sequencing run directory"
)
return

try:
if sample_sheet_path.samefile(run_directory_data.sample_sheet_path):
LOG.info(
"Sample sheet from Housekeeper already matches the target location. Skipping."
ahdamin marked this conversation as resolved.
Show resolved Hide resolved
)
return
except FileNotFoundError:
LOG.warning("Sample sheet or target path does not exist.")
ahdamin marked this conversation as resolved.
Show resolved Hide resolved

LOG.info("Sample sheet from Housekeeper is valid. Copying it to sequencing run directory")
link_or_overwrite_file(src=sample_sheet_path, dst=run_directory_data.sample_sheet_path)

Expand Down
Loading