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

WORK IN PROGRESS - Show genotype parsing status to users #472

Open
wants to merge 29 commits into
base: master
Choose a base branch
from

Conversation

tsujigiri
Copy link
Collaborator

No description provided.

@@ -0,0 +1,48 @@
RSpec.describe Preparsing do
Copy link
Collaborator

Choose a reason for hiding this comment

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

Block has too many lines. [37/25]
Missing magic comment # frozen_string_literal: true.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@@ -134,5 +129,8 @@ def perform(genotype_id)

Parsing.perform_async(genotype.id)
end
rescue
Copy link
Collaborator

Choose a reason for hiding this comment

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

Avoid rescuing without specifying an error class.

@@ -1,18 +1,52 @@
# frozen_string_literal: true
# TODO: Add test cases for different filetypes.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add an empty line after magic comments.

@@ -1,5 +1,5 @@
# frozen_string_literal: true
RSpec.feature 'Delete a genotype', sidekiq: :inline do
RSpec.feature 'Delete a genotype', :js, sidekiq: :inline do
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add an empty line after magic comments.

@@ -0,0 +1,5 @@
class AddParseStatusToGenotypes < ActiveRecord::Migration
Copy link
Collaborator

Choose a reason for hiding this comment

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

Missing magic comment # frozen_string_literal: true.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@@ -0,0 +1,11 @@
module UsersHelper
Copy link
Collaborator

Choose a reason for hiding this comment

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

Missing magic comment # frozen_string_literal: true.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@@ -0,0 +1,48 @@
RSpec.describe Preparsing do
Copy link
Collaborator

Choose a reason for hiding this comment

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

Block has too many lines. [37/25]
Missing magic comment # frozen_string_literal: true.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added the comment and changed the rubocop config to make it ignore block length in the spec directory.

@@ -134,5 +129,8 @@ def perform(genotype_id)

Parsing.perform_async(genotype.id)
end
rescue
Copy link
Collaborator

Choose a reason for hiding this comment

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

Avoid rescuing without specifying an error class.

@@ -1,18 +1,52 @@
# frozen_string_literal: true
# TODO: Add test cases for different filetypes.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add an empty line after magic comments.

@@ -1,5 +1,5 @@
# frozen_string_literal: true
RSpec.feature 'Delete a genotype', sidekiq: :inline do
RSpec.feature 'Delete a genotype', :js, sidekiq: :inline do
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add an empty line after magic comments.

@@ -0,0 +1,5 @@
class AddParseStatusToGenotypes < ActiveRecord::Migration
Copy link
Collaborator

Choose a reason for hiding this comment

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

Missing magic comment # frozen_string_literal: true.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@@ -0,0 +1,11 @@
module UsersHelper
Copy link
Collaborator

Choose a reason for hiding this comment

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

Missing magic comment # frozen_string_literal: true.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

else
UserMailer.parsing_error(genotype.user_id).deliver_later
logger.info "file is not ok, sending email"
system("rm #{Rails.root}/public/data/#{genotype.fs_filename}")
Genotype.find_by_id(genotype.id).delete
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I could use some feedback on this. If we delete the genotype on error, we cannot show the status to the user. What do we want to do as an alternative?

a) We could just not delete it.
b) We could delete it after a period of time and tell the user on the genotypes tab in their settings that we do.
c) Still delete it.
d) Any other ideas?

Copy link
Member

Choose a reason for hiding this comment

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

What would the status display on error? Just nothing, or an 'error' thing? Ideally I'd like to delete it but we're not particularly low on space

Copy link
Collaborator Author

@tsujigiri tsujigiri Jan 4, 2018

Choose a reason for hiding this comment

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

So far it says "error". I was thinking of adding more information, since sometimes we know what went wrong. We also have the emails we send in some cases but not others. We could make it one email and put the same state/error message in there.

Choose a reason for hiding this comment

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

Regarding this.. I'm not 100% familiar with how the genotypes are set up in the database, but is it possible to:
Delete the genotype file
Delete most of the genotype data in the db, but leave behind the status field value and any other bare necessities required for displaying status to the user?

Copy link
Member

Choose a reason for hiding this comment

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

Yep, that should be easily possible. The files themselves are attached to the Genotype model through paperclip. The code for our model is here.

With paperclip you can just set the genotype attribute of a Genotype object to nil and save the object. This should delete the file while keeping the model:

@genotype = Genotype.find(1)
@genotype.genotype = nil
@genotype.save

@AndrewJDR
Copy link

Just curious... what is currently holding this up? It'd be really nice to have this!

I'm thinking about just merging it into my local copy... is it functionally in pretty good shape?

@tsujigiri
Copy link
Collaborator Author

What's holding this up is time constraints on my part and I think making decisions. See these comments. Feel free to continue working on this. It would be a great help!

@philippbayer @gedankenstuecke Or what do you think?

@gedankenstuecke
Copy link
Member

Oh, totally agree, all contributions are welcome! 👍

@philippbayer
Copy link
Member

All contributions are good! To continue the old thread, how about for now we delete the genotyping, finish this, and then decide what to do with the errors?

@gedankenstuecke
Copy link
Member

You mean deleting the files themselves or just the objects and re-parsing them?

@tsujigiri
Copy link
Collaborator Author

So far we completely delete the Genotype records, if parsing fails. This doesn't work well with showing their error status in the list of the user's uploaded genotypes. Keeping the files also isn't useful, I guess, so one way of dealing with this would be to keep the records, delete the file, and filter by success status in all other places.

@gedankenstuecke
Copy link
Member

Ah, my bad. I'm too jet lagged for this. I was mentally still at the zip/gzip/etc. issue and how to work with the files we already have that are acting up. 😂

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