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

1376 make ontohub org database consistent #1377

Merged
merged 7 commits into from
Jun 22, 2015

Conversation

eugenk
Copy link
Member

@eugenk eugenk commented Jun 17, 2015

This shall fix #1376.

Actually, only the first commit (Set basepath where it is nil. 671a2be) restores consistency. The other ones make sure that the data migrations pass. Since failing data migrations were the main reason of the issue, I put them into this PR as well.

Note:
The data migrations should be run manually with RAILS_ENV=production nohup rake data:migrate & to see the IDs of the failing OntologyVersions (see the third commit's message).

This way, 138 + 4350 OntologyVersions don't get a list of provers (timeout + other error).

You can find the file containing the logged failing IDs at develop.ontohub.org:~ontohub/data_migration_provers_failures

a) Hets closes the HTTP connection after a minute, which results in
timeouts. If a timeout occurs, we try again to get the provers list
twice.

b) Sometimes another error occurs (Hets response not usable).

In both cases we print the ID of the OntologVersion to know which ones
fail. This way, we can process them in another data migration.
@@ -3,7 +3,7 @@ def up
obo_ontologies = Ontology.joins(:ontology_version).
where(ontology_versions: {file_extension: '.obo'})
obo_ontologies.each do |ontology|
ontology.sentences.find_each { |s| s.set_display_text! }
ontology.sentences.select([:id, :text]).find_each(&:set_display_text!)
Copy link
Contributor

Choose a reason for hiding this comment

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

How about a fancy-string: %i(id text)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed with 7f10f65.

@@ -0,0 +1,14 @@
class SetBasepathWhereNil < ActiveRecord::Migration
def self.up
OntologyVersion.where(basepath: nil).find_each do |ov|
Copy link
Contributor

Choose a reason for hiding this comment

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

You could optimize this query by auto-loading the ontology (includes), and possibly by pre-selecting the fields.

Copy link
Member Author

Choose a reason for hiding this comment

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

With select and includes, the columns don't get updated (no matter in what order I use those two methods). So I just use includes in 232f6a3.

@0robustus1
Copy link
Contributor

Apart from my last comment: 👍

@0robustus1
Copy link
Contributor

👍

eugenk added a commit that referenced this pull request Jun 22, 2015
…consistent

1376 make ontohub org database consistent
@eugenk eugenk merged commit ea3ec87 into staging Jun 22, 2015
@eugenk eugenk deleted the 1376-make_ontohub_org_database_consistent branch June 22, 2015 06:03
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.

Make ontohub.org database consistent
2 participants