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 sequence files from file storage via sequence run page #1468

Merged
merged 20 commits into from
Mar 9, 2023

Conversation

ksierks
Copy link
Contributor

@ksierks ksierks commented Feb 14, 2023

Description of changes

Added functionality to delete sequence files from file storage (local, Azure, and AWS) when removing a sequence run.

image

Related issue

#1125

Checklist

Things for the developer to confirm they've done before the PR should be accepted:

  • CHANGELOG.md (and UPGRADING.md if necessary) updated with information for new change.
  • Tests added (or description of how to test) for any new features.
  • [ ] User documentation updated for UI or technical changes.

@@ -257,7 +268,7 @@ public void appendToFile(Path target, SequenceFile file) throws IOException {
try (FileChannel out = FileChannel.open(target, StandardOpenOption.CREATE, StandardOpenOption.APPEND,
StandardOpenOption.WRITE)) {
try (FileChannel in = new FileInputStream(iridaTemporaryFile.getFile().toFile()).getChannel()) {
for (long p = 0, l = in.size(); p < l;) {
for (long p = 0, l = in.size(); p < l; ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyForIteratorPadCheck> reported by reviewdog 🐶
';' is followed by whitespace.

@@ -151,7 +164,7 @@ public void appendToFile(Path target, SequenceFile file) throws IOException {
try (FileChannel out = FileChannel.open(target, StandardOpenOption.CREATE, StandardOpenOption.APPEND,
StandardOpenOption.WRITE)) {
try (FileChannel in = FileChannel.open(file.getFile(), StandardOpenOption.READ)) {
for (long p = 0, l = in.size(); p < l;) {
for (long p = 0, l = in.size(); p < l; ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyForIteratorPadCheck> reported by reviewdog 🐶
';' is followed by whitespace.

@@ -234,7 +243,7 @@ public void appendToFile(Path target, SequenceFile file) throws IOException {
try (FileChannel out = FileChannel.open(target, StandardOpenOption.CREATE, StandardOpenOption.APPEND,
StandardOpenOption.WRITE)) {
try (FileChannel in = new FileInputStream(iridaTemporaryFile.getFile().toFile()).getChannel()) {
for (long p = 0, l = in.size(); p < l;) {
for (long p = 0, l = in.size(); p < l; ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 [checkstyle] <com.puppycrawl.tools.checkstyle.checks.whitespace.EmptyForIteratorPadCheck> reported by reviewdog 🐶
';' is followed by whitespace.

@ksierks ksierks changed the title Delete sequence files from file system - Sequence Runs Delete sequence files from file system via sequence run page Feb 16, 2023
@ksierks ksierks marked this pull request as ready for review February 20, 2023 15:13
@ksierks ksierks requested review from ericenns, apetkau and JeffreyThiessen and removed request for apetkau and JeffreyThiessen February 20, 2023 15:14
@ksierks ksierks changed the title Delete sequence files from file system via sequence run page Delete sequence files from file storage via sequence run page Feb 20, 2023
Copy link
Member

@JeffreyThiessen JeffreyThiessen left a comment

Choose a reason for hiding this comment

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

2 notes:

  1. When removing a run via the admin sequencing run screen, only the unzipped files are deleted, and the gzipped files remain. This can be seen by running ls /tmp/irida/sequence-files/*/* Is this intended behaviour?

  2. A bug occurs when removing a run via the admin sequencing run screen, when sequencing files have manually been removed.

Here 1 file has been deleted
image

Then the run gets removed via the admin sequencing run screen, then go back to the project to see this
image

I found it easiest to test these cases by removing all the files in /tmp/irida/sequence-files/ and /tmp/irida/output-files/ , and start irida with a new db each time

@ksierks
Copy link
Contributor Author

ksierks commented Feb 21, 2023

2 notes:

  1. When removing a run via the admin sequencing run screen, only the unzipped files are deleted, and the gzipped files remain. This can be seen by running ls /tmp/irida/sequence-files/*/* Is this intended behaviour?
  2. A bug occurs when removing a run via the admin sequencing run screen, when sequencing files have manually been removed.

Here 1 file has been deleted image

Then the run gets removed via the admin sequencing run screen, then go back to the project to see this image

I found it easiest to test these cases by removing all the files in /tmp/irida/sequence-files/ and /tmp/irida/output-files/ , and start irida with a new db each time

Thanks for the review, Jeff.

  1. Please see 655f175.
  2. I'm not introducing this bug in this PR. I believe it exists in development. When the file is removed from the sample, so is the sequencing object. When the sequencing object is removed it breaks the link to the sequencing run. Will address this in a future PR.

@ksierks ksierks requested a review from deepsidhu85 February 27, 2023 16:10
Copy link
Contributor

@deepsidhu85 deepsidhu85 left a comment

Choose a reason for hiding this comment

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

The code is looking good just one thing below for now. I still need to test it out

@ksierks ksierks requested a review from deepsidhu85 February 28, 2023 14:29
Copy link
Contributor

@deepsidhu85 deepsidhu85 left a comment

Choose a reason for hiding this comment

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

This is looking good..seems to be working as expected. Just a few small things below

Copy link
Member

@JeffreyThiessen JeffreyThiessen left a comment

Choose a reason for hiding this comment

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

Please see 655f175.
I'm not introducing this bug in this PR. I believe it exists in development. When the file is removed from the sample, so is the sequencing object. When the sequencing object is removed it breaks the link to the sequencing run. Will address this in a future PR.

I confirmed it's happening in development too. It only leaves the sample on the page, the underlying files are all removed correctly.

Code looks great too.

@ericenns ericenns removed their request for review March 9, 2023 20:20
@deepsidhu85 deepsidhu85 merged commit 7c54a65 into development Mar 9, 2023
@ericenns ericenns deleted the filesystem-cleanup-sequence-runs branch April 14, 2023 16:39
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.

3 participants