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

1284 show theorem and proof attempt state #1312

Merged
merged 19 commits into from
May 4, 2015

Conversation

eugenk
Copy link
Member

@eugenk eugenk commented Apr 9, 2015

This shall fix #1284. It also adds retry functionality to failed proof attempts.

The branch of this pull request is based on:

The first commit of this branch is:
Move state helper to own module and generalize it. 33f017c

@eugenk eugenk force-pushed the 1284-show_theorem_and_proof_attempt_state branch from 4ea99c7 to 85d4852 Compare April 10, 2015 06:53
@eugenk eugenk force-pushed the 1284-show_theorem_and_proof_attempt_state branch 6 times, most recently from 1268e62 to be139c0 Compare April 14, 2015 13:51
@eugenk eugenk force-pushed the 1284-show_theorem_and_proof_attempt_state branch 3 times, most recently from ccfd9f7 to 21ca583 Compare April 28, 2015 06:14
@eugenk
Copy link
Member Author

eugenk commented Apr 28, 2015

I rebased this on staging.

@tillmo
Copy link
Member

tillmo commented Apr 28, 2015

when trying this with legacy data, I get an error in app/views/proof_attempts/index.html.haml, line 26:

NoMethodError at /test/Family/FamilyBase/Ax1_19/proof_attempts
undefined method `gsub' for nil:NilClass

Details at https://gist.github.com/tillmo/7a3bcb2b74c96fbc718b

@eugenk
Copy link
Member Author

eugenk commented Apr 28, 2015

That's odd. I can't find any occurrence of gsub in that line (app/controllers/application_controller.rb, line 67).

@eugenk
Copy link
Member Author

eugenk commented Apr 28, 2015

I can't reproduce this error using data that I created on staging.ontohub.org. This branch is a little older than staging. Could you open the rails console and execute the following, please:

Theorem.find_with_locid('/test/Family//FamilyBase//Ax1_19').proof_attempts.each { |pa| puts pa.inspect; puts }

What is being printed to the console?

@tillmo
Copy link
Member

tillmo commented Apr 28, 2015

sorry, that line was the botton of the stack trace. The top is app/controllers/application_controller.rb, line 67

@tillmo
Copy link
Member

tillmo commented Apr 28, 2015

Here is the console output:

[1] pry(main)> Theorem.find_with_locid('/test/Family//FamilyBase//Ax1_19').proof_attempts.each { |pa| puts pa.inspect; puts }
  Theorem Load (0.7ms)  SELECT "sentences".* FROM "sentences" WHERE "sentences"."imported" = 'f' AND "sentences"."type" IN ('Theorem') AND "sentences"."locid" = '/test/Family//FamilyBase//Ax1_19' LIMIT 1
  ProofAttempt Load (0.4ms)  SELECT "proof_attempts".* FROM "proof_attempts" WHERE "proof_attempts"."sentence_id" = 1405
#<ProofAttempt id: 39, proof_status_id: "UNK", time_taken: 0, sentence_id: 1405, created_at: "2015-03-22 09:32:06", updated_at: "2015-03-22 09:32:06", number: 1, prover_id: 6, state: "pending", state_updated_at: nil, last_error: nil, proof_attempt_configuration_id: nil, locid: nil>

#<ProofAttempt id: 65, proof_status_id: "THM", time_taken: 0, sentence_id: 1405, created_at: "2015-04-28 06:01:05", updated_at: "2015-04-28 06:01:07", number: 2, prover_id: 13, state: "done", state_updated_at: "2015-04-28 06:01:07", last_error: nil, proof_attempt_configuration_id: 16, locid: "/test/Family//FamilyBase//Ax1_19//proof-attempt-2">

=> [#<ProofAttempt id: 39, proof_status_id: "UNK", time_taken: 0, sentence_id: 1405, created_at: "2015-03-22 09:32:06", updated_at: "2015-03-22 09:32:06", number: 1, prover_id: 6, state: "pending", state_updated_at: nil, last_error: nil, proof_attempt_configuration_id: nil, locid: nil>,
 #<ProofAttempt id: 65, proof_status_id: "THM", time_taken: 0, sentence_id: 1405, created_at: "2015-04-28 06:01:05", updated_at: "2015-04-28 06:01:07", number: 2, prover_id: 13, state: "done", state_updated_at: "2015-04-28 06:01:07", last_error: nil, proof_attempt_configuration_id: 16, locid: "/test/Family//FamilyBase//Ax1_19//proof-attempt-2">]
[2] pry(main)> 

@eugenk
Copy link
Member Author

eugenk commented Apr 28, 2015

Please run rake data:migrate and check if the problem still exists.

@tillmo
Copy link
Member

tillmo commented Apr 28, 2015

I get

[2] pry(main)> quit
till@mark:~/web2.0/ontohub$ rake data:migrate
==  AddStateToProofAttemptsAndTheorems: migrating =============================
==  AddStateToProofAttemptsAndTheorems: migrated (0.0714s) ====================

==  CreateProofAttemptConfigurations: migrating ===============================
==  CreateProofAttemptConfigurations: migrated (0.4015s) ======================

==  AddLocIdToProofAttempt: migrating =========================================
==  AddLocIdToProofAttempt: migrated (0.1622s) ================================

==  AddLocIdToProofAttemptConfiguration: migrating ============================
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

undefined method `locid' for nil:NilClass/home/till/web2.0/ontohub/app/models/proof_attempt_configuration.rb:32:in `generate_locid'
/home/till/web2.0/ontohub/db/data/20150325061425_add_loc_id_to_proof_attempt_configuration.rb:5:in `block in up'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/relation/batches.rb:21:in `block (2 levels) in find_each'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/relation/batches.rb:21:in `each'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/relation/batches.rb:21:in `block in find_each'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/relation/batches.rb:72:in `find_in_batches'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/relation/batches.rb:20:in `find_each'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/querying.rb:8:in `find_each'
/home/till/web2.0/ontohub/db/data/20150325061425_add_loc_id_to_proof_attempt_configuration.rb:3:in `up'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/migration.rb:410:in `block (2 levels) in migrate'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/migration.rb:410:in `block in migrate'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/connection_pool.rb:129:in `with_connection'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/migration.rb:389:in `migrate'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/migration.rb:528:in `migrate'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/migration.rb:720:in `block (2 levels) in migrate'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/migration.rb:775:in `call'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/migration.rb:775:in `block in ddl_transaction'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/transactions.rb:208:in `transaction'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/migration.rb:775:in `ddl_transaction'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/migration.rb:719:in `block in migrate'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/migration.rb:700:in `each'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/migration.rb:700:in `migrate'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/migration.rb:570:in `up'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/migration.rb:551:in `migrate'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/data_migrate-1.2.0/tasks/databases.rake:221:in `block (2 levels) in <top (required)>'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/bin/ruby_executable_hooks:15:in `eval'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/bin/ruby_executable_hooks:15:in `<main>'
NoMethodError: undefined method `locid' for nil:NilClass
/home/till/web2.0/ontohub/app/models/proof_attempt_configuration.rb:32:in `generate_locid'
/home/till/web2.0/ontohub/db/data/20150325061425_add_loc_id_to_proof_attempt_configuration.rb:5:in `block in up'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/relation/batches.rb:21:in `block (2 levels) in find_each'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/relation/batches.rb:21:in `each'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/relation/batches.rb:21:in `block in find_each'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/relation/batches.rb:72:in `find_in_batches'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/relation/batches.rb:20:in `find_each'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/querying.rb:8:in `find_each'
/home/till/web2.0/ontohub/db/data/20150325061425_add_loc_id_to_proof_attempt_configuration.rb:3:in `up'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/migration.rb:410:in `block (2 levels) in migrate'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/migration.rb:410:in `block in migrate'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/connection_pool.rb:129:in `with_connection'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/migration.rb:389:in `migrate'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/migration.rb:528:in `migrate'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/migration.rb:720:in `block (2 levels) in migrate'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/migration.rb:775:in `call'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/migration.rb:775:in `block in ddl_transaction'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/transactions.rb:208:in `transaction'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/migration.rb:775:in `ddl_transaction'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/migration.rb:719:in `block in migrate'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/migration.rb:700:in `each'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/migration.rb:700:in `migrate'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/migration.rb:570:in `up'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/activerecord-3.2.21/lib/active_record/migration.rb:551:in `migrate'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/gems/data_migrate-1.2.0/tasks/databases.rake:221:in `block (2 levels) in <top (required)>'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/bin/ruby_executable_hooks:15:in `eval'
/home/till/.rvm/gems/ruby-2.1.5@ontohub/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => data:migrate
(See full trace by running task with --trace)

@eugenk
Copy link
Member Author

eugenk commented Apr 28, 2015

Alright. It seems like I need to redo the data migrations rather sooner than later.
I will create another pull request today that fixes the data migrations and needs to be merged before the review here can continue.

@tillmo
Copy link
Member

tillmo commented Apr 28, 2015

maybe the problem has been caused by the fact that I was not disciplined enough to run the data migrations each time, and therefore db and data migrations have been exectued in wrong order?

@eugenk
Copy link
Member Author

eugenk commented Apr 28, 2015

Even if that caused the problem, this should not happen. I'm fixing the data migrations right now.

@eugenk
Copy link
Member Author

eugenk commented Apr 29, 2015

#1335 should fix the migration problem.

@tillmo
Copy link
Member

tillmo commented May 3, 2015

OK, my problem has been solved by #1335 (although it still occurs here, but I assume that I can safely ignore that).

@@ -13,9 +13,6 @@ class OntologiesController < InheritedResources::Base

respond_to :html, except: %i(show)

before_filter :check_write_permission, except: [:index, :show, :oops_state]
before_filter :check_read_permissions
Copy link
Member

Choose a reason for hiding this comment

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

why are these before_filters removed?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is odd. It should not have happened. I probably messed something up with my editor without noticing it. This change is removed (by commit amend) in 318de55.

@eugenk eugenk force-pushed the 1284-show_theorem_and_proof_attempt_state branch from 21ca583 to 41543d0 Compare May 3, 2015 17:38
@eugenk
Copy link
Member Author

eugenk commented May 3, 2015

I just rebased this on staging and amended the odd commit removing the before filters.

@eugenk eugenk force-pushed the 1284-show_theorem_and_proof_attempt_state branch from 41543d0 to f4e0204 Compare May 3, 2015 17:46
@eugenk
Copy link
Member Author

eugenk commented May 3, 2015

Rebased again. I made a mistake in the last rebase. The amended commit is now 06cbff1.

@tillmo
Copy link
Member

tillmo commented May 3, 2015

👍

eugenk added a commit that referenced this pull request May 4, 2015
…empt_state

1284 show theorem and proof attempt state
@eugenk eugenk merged commit fcefed1 into staging May 4, 2015
@eugenk eugenk deleted the 1284-show_theorem_and_proof_attempt_state branch May 4, 2015 04:51
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.

Show theorem/proof attempt state
2 participants