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

Delete old flow cell before adding re-demultiplexed flow cell #2593

Merged
merged 23 commits into from
Dec 8, 2023

Conversation

diitaz93
Copy link
Contributor

@diitaz93 diitaz93 commented Oct 16, 2023

Description

Part of the tasks in #2541.
In #2144 the automatic deletion of a flow cell from Housekeeper and StatusDB was removed, having to explicitly delete a flow cell before re-demultiplexing.

This PR re-adds the functionality in a slightly different way.

Changed

  • Removed Delete_flow_cell_API
  • Removed the cg demultiplex delete-flow-cell CLI command
  • No longer checks for active cases before removing stuff (Does one not always want to restart with new data?)

Before post-processing:

  • The sequencing_metrics are removed from status_db
  • The sequencing files (FASTQ, SPRING, SPRING-metadata) are removed from housekeeper and disk

How to prepare for test

  • Ssh to relevant server (depending on type of change)
  • Use stage: us
  • Paxa the environment: paxa
  • Install on stage (example for Hasta):
    bash /home/proj/production/servers/resources/hasta.scilifelab.se/update-tool-stage.sh -e S_cg -t cg -b delete-flowcell-post-processing -a

How to test

  • Finish a flow cell in stage: cg demultiplex finish flow-cell 230908_A01901_0231_BHJWJFDSX7
  • Check how many files contain the flow cell and fastq tag
  • Add an extra file to one of the samples in housekeeper with the tags [fastq, <flow_cell_id>, <sample_id>]
  • Change a sequencing_lane_metrics entry.
  • Finish the flow cell again.

Expected test outcome

  • The fastq file count is the same as before (the dummy one was removed)
  • The sequencing lane metric was changed back to the original
  • Take a screenshot and attach or copy/paste the output.

Review

  • Tests executed by
  • "Merge and deploy" approved by
    Thanks for filling in who performed the code review and the test!

This version is a

  • MAJOR - when you make incompatible API changes
  • MINOR - when you add functionality in a backwards compatible manner
  • PATCH - when you make backwards compatible bug fixes or documentation/instructions

Implementation Plan

  • Document in ...
  • Deploy this branch on ...
  • Inform to ...

@islean
Copy link
Contributor

islean commented Oct 16, 2023

Nice! Seems to already have support for filtering on the flow cell tag!

@diitaz93 diitaz93 self-assigned this Oct 16, 2023
Copy link
Contributor

@ChrOertlin ChrOertlin left a comment

Choose a reason for hiding this comment

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

Looks good. We should check with @karlnyr if this is the behaviour that we want in CG (i.e. deleting previous flow cell entries)

cg/meta/demultiplex/demux_post_processing.py Outdated Show resolved Hide resolved
@diitaz93
Copy link
Contributor Author

Looks good. We should check with @karlnyr if this is the behaviour that we want in CG (i.e. deleting previous flow cell entries)

Yes, I added this to the next refinement meeting so that @karlnyr can give me some advice on this

Copy link
Contributor

@Vince-janv Vince-janv left a comment

Choose a reason for hiding this comment

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

I like having the delete call here rather than before demultiplexing.

Here are some thoughts though:

  • Simplify delete_demux_api.delete_flow_cell to only perform what we think is useful
  • Since the call is moved after demultiplexing, it should not remove any directories.
  • It should not remove the sample sheet
  • Do we need to check active samples? (more hassle than worth)

cg/meta/demultiplex/delete_demultiplex_api.py Outdated Show resolved Hide resolved
@diitaz93
Copy link
Contributor Author

diitaz93 commented Oct 18, 2023

I like having the delete call here rather than before demultiplexing.

Here are some thoughts though:

  • Simplify delete_demux_api.delete_flow_cell to only perform what we think is useful

Wait for input from prod. This function is also called in the CLI command cg demultiplex delete-flow-cell and receives as parameters all of the desired locations for deletion.

  • Since the call is moved after demultiplexing, it should not remove any directories.

so demultiplexing_dir=False and run_dir=False

  • It should not remove the sample sheet

This one is hard, we will have to decouple the sample sheet and Housekeeper deletion if I understand correctly

  • Due to the cascade setting between metrics and flow cell we do not explicitly need to remove metrics.

I guess this is for when you want to delete the metrics but not the flow cell?

  • Do we need to check active samples? (more hassle than worth)

We do check active samples when we call delete_flow_cell

@karlnyr karlnyr self-requested a review October 23, 2023 11:45
@sonarqubecloud
Copy link

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

@diitaz93 diitaz93 requested a review from ChrOertlin October 26, 2023 13:40
@Vince-janv Vince-janv marked this pull request as ready for review December 7, 2023 10:52
@Vince-janv Vince-janv requested a review from a team as a code owner December 7, 2023 10:52
Copy link
Contributor Author

@diitaz93 diitaz93 left a comment

Choose a reason for hiding this comment

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

I really like the structure of the new delete functions. I am a bit concerned about the order of the commands store_flow_cell_data and delete_flow_cell_data in finish_flow_cell. Also, I am thinking if it would be useful to leave the CLI command for testing purposes, specially when testing the demultiplex process without invoking the finish command

cg/meta/demultiplex/housekeeper_storage_functions.py Outdated Show resolved Hide resolved
cg/meta/demultiplex/housekeeper_storage_functions.py Outdated Show resolved Hide resolved
cg/meta/demultiplex/housekeeper_storage_functions.py Outdated Show resolved Hide resolved
cg/meta/demultiplex/housekeeper_storage_functions.py Outdated Show resolved Hide resolved
cg/meta/demultiplex/demux_post_processing.py Outdated Show resolved Hide resolved
cg/meta/demultiplex/demux_post_processing.py Outdated Show resolved Hide resolved
cg/meta/demultiplex/demux_post_processing.py Outdated Show resolved Hide resolved
cg/cli/demultiplex/demux.py Show resolved Hide resolved
Copy link
Contributor

@karlnyr karlnyr left a comment

Choose a reason for hiding this comment

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

Cool beans 🔥

cg/meta/demultiplex/demux_post_processing.py Outdated Show resolved Hide resolved
cg/meta/demultiplex/demux_post_processing.py Outdated Show resolved Hide resolved
cg/meta/demultiplex/status_db_storage_functions.py Outdated Show resolved Hide resolved
tests/store_helpers.py Outdated Show resolved Hide resolved
cg/cli/demultiplex/demux.py Show resolved Hide resolved
Copy link

sonarqubecloud bot commented Dec 8, 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

Copy link
Contributor

@karlnyr karlnyr left a comment

Choose a reason for hiding this comment

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

Clip it and ship it. Time for vacation 🌴

@Vince-janv
Copy link
Contributor

Before re-finishing

Screenshot 2023-12-08 at 10 19 48 Screenshot 2023-12-08 at 10 22 32

After re-finishing

Screenshot 2023-12-08 at 10 41 22 Screenshot 2023-12-08 at 10 41 40

@Vince-janv
Copy link
Contributor

Finishing from scratch (flow cell not added previously) also worked

@Vince-janv Vince-janv merged commit e53a094 into master Dec 8, 2023
9 checks passed
@Vince-janv Vince-janv deleted the delete-flowcell-post-processing branch December 8, 2023 09:56
@Vince-janv
Copy link
Contributor

Deployed in stage and production

@diitaz93 diitaz93 mentioned this pull request Dec 8, 2023
5 tasks
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.

5 participants