<< | Index | >>
Experiment
#!/usr/bin/env ruby19 $: << File.expand_path('../lib', File.dirname(__FILE__)) p "A" require 'drb' p "B" require 'oddb/persistence/odba' p "C" require 'odba/18_19_loading_compatibility' p "D" $project_path, url, _ = ARGV $project_path ||= '/var/www/oddb.org' url ||= 'druby://localhost:10000' p "E" count = ODBA.cache.count(ODDB::Business::Company) p count exit
Result
masa@masa ~/ywesee/ch.oddb.org $ ruby1.9 bin/migrate "A" "B" ERROR: relation "object" already exists ERROR: relation "prefetchable_index" already exists ERROR: relation "extent_index" already exists ERROR: relation "object_connection" already exists ERROR: relation "target_id_index" already exists ERROR: relation "collection" already exists /usr/lib64/ruby/site_ruby/1.9.1/odba/marshal.rb:15:in `load': undefined class/module ODDB::Business::GrantDownload (ArgumentError) from /usr/lib64/ruby/site_ruby/1.9.1/odba/marshal.rb:15:in `load' from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:588:in `restore' from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:313:in `block in fetch_or_restore' from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:308:in `call' from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:308:in `fetch_or_do' from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:312:in `fetch_or_restore' from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:62:in `block in bulk_restore' from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:59:in `each' from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:59:in `bulk_restore' from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:53:in `bulk_fetch' from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:255:in `fetch_collection' from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:592:in `restore' from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:313:in `block in fetch_or_restore' from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:308:in `call' from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:308:in `fetch_or_do' from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:312:in `fetch_or_restore' from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:299:in `block in fetch_named' from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:308:in `call' from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:308:in `fetch_or_do' from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:291:in `fetch_named' from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:346:in `indices' from /usr/lib64/ruby/site_ruby/1.9.1/odba/cache.rb:434:in `setup' from /home/masa/ywesee/ch.oddb.org/lib/oddb/persistence/odba.rb:32:in `<module:ODDB>' from /home/masa/ywesee/ch.oddb.org/lib/oddb/persistence/odba.rb:25:in `<top (required)>' from bin/migrate:8:in `require' from bin/migrate:8:in `<main>'
Note
Next
grep search
masa@masa ~/ywesee $ grep -r GrantDownload ch.oddb.org masa@masa ~/ywesee $ grep -r GrantDownload oddb masa@masa ~/ywesee $ grep -r GrantDownload oddb.org masa@masa ~/ywesee $ grep -r GrantDownload ch.oddb masa@masa ~/ywesee $ grep -r GrantDownload de.oddb.org/lib de.oddb.org/lib/oddb/business/grant_download.rb:# ODDB::Business::GrantDownload -- de.oddb.org -- 18.11.2010 -- mhatakeyama@ywesee.com de.oddb.org/lib/oddb/business/grant_download.rb: class GrantDownload < Model de.oddb.org/lib/oddb/html/state/global.rb: if email && file && user = ODDB::Business::GrantDownload.find_by_email(email) de.oddb.org/lib/oddb/persistence/odba/business/grant_download.rb:# ODDB::Business::GrantDownload -- de.oddb.org -- 18.11.2010 -- mhatakeyama@ywesee.com de.oddb.org/lib/oddb/persistence/odba/business/grant_download.rb: class GrantDownload < Model de.oddb.org/lib/oddb/util/server.rb: unless user = ODDB::Business::GrantDownload.find_by_email(email) de.oddb.org/lib/oddb/util/server.rb: user = ODDB::Business::GrantDownload.new(email) de.oddb.org/lib/oddb/util/server.rb: if user = ODDB::Business::GrantDownload.find_by_email(email)
Note
Experiment
masa@masa ~/ywesee/ch.oddb.org $ ruby1.9 -I ../de.oddb.org/lib bin/migrate /usr/lib64/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi.rb:300:in `block in load_driver': Unable to load driver 'pg' (underlying error: wrong constant name pg) (DBI::InterfaceError) from /usr/lib64/ruby/1.9.1/monitor.rb:201:in `mon_synchronize' from /usr/lib64/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi.rb:242:in `load_driver' from /usr/lib64/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi.rb:160:in `_get_full_driver' from /usr/lib64/ruby/gems/1.9.1/gems/dbi-0.4.5/lib/dbi.rb:145:in `connect' from /usr/lib64/ruby/site_ruby/1.9.1/odba/connection_pool.rb:60:in `block in _connect' from /usr/lib64/ruby/site_ruby/1.9.1/odba/connection_pool.rb:59:in `times' from /usr/lib64/ruby/site_ruby/1.9.1/odba/connection_pool.rb:59:in `_connect' from /usr/lib64/ruby/site_ruby/1.9.1/odba/connection_pool.rb:56:in `block in connect' from <internal:prelude>:10:in `synchronize' from /usr/lib64/ruby/site_ruby/1.9.1/odba/connection_pool.rb:56:in `connect' from /usr/lib64/ruby/site_ruby/1.9.1/odba/connection_pool.rb:19:in `initialize' from /home/masa/ywesee/de.oddb.org/lib/oddb/persistence/odba.rb:29:in `new' from /home/masa/ywesee/de.oddb.org/lib/oddb/persistence/odba.rb:29:in `<module:ODDB>' from /home/masa/ywesee/de.oddb.org/lib/oddb/persistence/odba.rb:24:in `<top (required)>' from bin/migrate:6:in `require' from bin/migrate:6:in `<main>'
Note
Next
Question
Experiment
ch.oddb.org/lib/oddb/persistence/odba.rb
module ODDB module Persistence module ODBA end end print "config.db_name=" p config.db_name ODBA.storage.dbi = ODBA::ConnectionPool.new("DBI:Pg:#{@config.db_name}", @config.db_user, @config.db_auth) p "A" ODBA.cache.setup p "B" end
Result
masa@masa ~/ywesee/ch.oddb.org $ ruby1.9 bin/migrate config.db_name="oddb" "A"
Note
Experiment (delete data in 'oddb' table)
masa@masa ~/ywesee/ch.oddb.org $ sudo -u postgres dropdb oddb masa@masa ~/ywesee/ch.oddb.org $ sudo -u postgres createdb -E UTF8 -T template0 oddb
Run ch.oddb.org/bin/migrate
masa@masa ~/ywesee/ch.oddb.org $ ruby1.9 bin/migrate . NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "object_pkey" for table "object" NOTICE: CREATE TABLE / UNIQUE will create implicit index "object_name_key" for table "object" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "object_connection_pkey" for table "object_connection" NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "collection_pkey" for table "collection" bin/migrate tried to import data from ch.oddb.org at druby://localhost:10000 but could not connect. Exiting.
Note
Experiment
Run oddb.org/bin/oddbd (server_url: druby://localhost:10000 (default value))
Run ch.oddb.org/bin/migrate
masa@masa ~/ywesee/ch.oddb.org $ ruby1.9 bin/migrate .
Result
masa@masa ~/ywesee/ch.oddb.org $ ruby1.9 bin/migrate . ERROR: relation "object" already exists ERROR: relation "prefetchable_index" already exists ERROR: relation "extent_index" already exists ERROR: relation "object_connection" already exists ERROR: relation "target_id_index" already exists ERROR: relation "collection" already exists ERROR: relation "target_id_oddb_business_company_name" already exists ERROR: relation "target_id_oddb_business_invoice_yus_name" already exists ERROR: relation "target_id_oddb_business_invoice_id" already exists ERROR: relation "target_id_oddb_drugs_atc_code" already exists ERROR: relation "target_id_oddb_drugs_atc_level_and_code" already exists ERROR: relation "target_id_oddb_drugs_atc_name" already exists ERROR: relation "target_id_oddb_drugs_galenicform_description" already exists ERROR: relation "target_id_oddb_drugs_galenicform_code" already exists ERROR: relation "target_id_oddb_drugs_galenicgroup_name" already exists ERROR: relation "target_id_oddb_drugs_substance_name" already exists ERROR: relation "target_id_oddb_drugs_substance_code" already exists ERROR: relation "target_id_oddb_drugs_package_code" already exists ERROR: relation "target_id_oddb_drugs_package_atc" already exists ERROR: relation "target_id_oddb_drugs_package_name" already exists ERROR: relation "target_id_oddb_drugs_package_substance" already exists ERROR: relation "target_id_oddb_drugs_package_company" already exists ERROR: relation "target_id_oddb_drugs_package_product" already exists ERROR: relation "target_id_oddb_drugs_product_name" already exists ERROR: relation "target_id_oddb_drugs_sequence_code" already exists ERROR: relation "target_id_oddb_drugs_sequence_fachinfo_indications_de" already exists ERROR: relation "target_id_oddb_drugs_sequence_product" already exists ERROR: relation "target_id_oddb_drugs_substancegroup_name" already exists ERROR: relation "target_id_oddb_drugs_unit_name" already exists ERROR: relation "target_id_oddb_regulatory_authority_name" already exists ERROR: relation "target_id_oddb_regulatory_registration_code" already exists ERROR: relation "target_id_oddb_text_document_source" already exists (druby://localhost:10000) /usr/lib64/ruby/site_ruby/1.8/odba/marshal.rb:15:in `load': undefined class/module ODDB::RootUser (ArgumentError) from (druby://localhost:10000) /usr/lib64/ruby/site_ruby/1.8/odba/marshal.rb:15:in `load' from (druby://localhost:10000) /usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:246:in `fetch_collection' from (druby://localhost:10000) /usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:244:in `each' from (druby://localhost:10000) /usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:244:in `fetch_collection' from (druby://localhost:10000) /usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:620:in `restore' from (druby://localhost:10000) /usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:336:in `fetch_or_restore' from (druby://localhost:10000) /usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:330:in `call' from (druby://localhost:10000) /usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:330:in `fetch_or_do' from (druby://localhost:10000) /usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:335:in `fetch_or_restore' from (druby://localhost:10000) /usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:628:in `restore_object' from (druby://localhost:10000) /usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:589:in `load_object' from (druby://localhost:10000) /usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:232:in `fetch' from (druby://localhost:10000) /usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:330:in `call' from (druby://localhost:10000) /usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:330:in `fetch_or_do' from (druby://localhost:10000) /usr/lib64/ruby/site_ruby/1.8/odba/cache.rb:231:in `fetch' from (druby://localhost:10000) /usr/lib64/ruby/site_ruby/1.8/odba/stub.rb:51:in `odba_instance' from (druby://localhost:10000) /usr/lib64/ruby/site_ruby/1.8/odba/stub.rb:141:in `method_missing' from (druby://localhost:10000) /usr/lib64/ruby/site_ruby/1.8/odba/stub.rb:160:in `[]' from (druby://localhost:10000) /home/masa/ywesee/oddb.org/src/util/oddbapp.rb:151:in `admin' from bin/migrate:71:in `<main>'
Note
Search RootUser definition
masa@masa ~/ywesee/ch.oddb.org $ grep -r RootUser ../oddb.org/src ../oddb.org/src/state/admin/login.rb: ['org.oddb.RootUser', State::Admin::Root], ../oddb.org/src/util/validator.rb: 'login|org.oddb.RootUser', ../oddb.org/src/view/drugs/atcchooser.rb: if(@session.user.allowed?('login', 'org.oddb.RootUser')) ../oddb.org/src/view/drugs/resultlist.rb:class RootUser < View::Drugs::User; end
Note
Experiment
server = DRb::DRbObject.new(nil, url) begin p "A" server.admin "self.class" p "B" rescue DRb::DRbConnError puts <<-EOS #$0 tried to import data from ch.oddb.org at #{url} but could not connect. Exiting. EOS exit -1 end p "C" exit
Result
masa@masa ~/ywesee/ch.oddb.org $ ruby1.9 bin/migrate . "A" (druby://localhost:10000) /usr/lib64/ruby/site_ruby/1.8/odba/marshal.rb:15:in `load': undefined class/module ODDB::RootUser (ArgumentError) from (druby://localhost:10000) /usr/lib64/ruby/site_ruby/1.8/odba/marshal.rb:15:in `load' ...
Note
Hypothesis
Experiment
begin #server.admin "self.class" server.company_count rescue DRb::DRbConnError
Run oddb.org/bin/oddbd
Run ch.oddb.org/bin/migrate
masa@masa ~/ywesee/ch.oddb.org $ ruby1.9 bin/migrate . ... (druby://localhost:10000) /usr/lib64/ruby/1.8/delegate.rb:158:in `method_missing': undefined method `remote_each_atc_class' for #<ODDB::App:0x7fd2de033938> (NoMethodError)
Note
Experiment
#server.remote_each_atc_class do |atc| server.each_atc_class do |atc|
Run oddb.org/bin/oddbd
Run ch.oddb.org/bin/migrate
Result
masa@masa ~/ywesee/ch.oddb.org $ ruby1.9 bin/migrate . ... (druby://localhost:39748) bin/migrate:448:in `block in <main>': undefined method `en' for #<DRb::DRbUnknown:0x00000001c9e3d8> (NoMethodError) from (druby://localhost:39748) /usr/lib64/ruby/1.9.1/drb/drb.rb:1558:in `call' from (druby://localhost:39748) /usr/lib64/ruby/1.9.1/drb/drb.rb:1558:in `perform_without_block' from (druby://localhost:39748) /usr/lib64/ruby/1.9.1/drb/drb.rb:1518:in `perform' from (druby://localhost:39748) /usr/lib64/ruby/1.9.1/drb/drb.rb:1592:in `block (2 levels) in main_loop' from (druby://localhost:39748) /usr/lib64/ruby/1.9.1/drb/drb.rb:1588:in `loop' from (druby://localhost:39748) /usr/lib64/ruby/1.9.1/drb/drb.rb:1588:in `block in main_loop' from (druby://localhost:10000) /usr/lib64/ruby/1.8/drb/invokemethod.rb:10:in `block_yield' from (druby://localhost:10000) /usr/lib64/ruby/1.8/drb/invokemethod.rb:17:in `perform_with_block' from (druby://localhost:10000) /home/masa/ywesee/oddb.org/src/util/oddbapp.rb:588:in `each_value' from (druby://localhost:10000) /home/masa/ywesee/oddb.org/src/util/oddbapp.rb:588:in `each_atc_class' from bin/migrate:447:in `<main>'
Consideration
Next
Experiment
#server.remote_each_atc_class do |atc| server.each_atc_class do |atc| unless atc.en.to_s.empty? migrate_atc ODDB::Remote::Drugs::Atc.new url, atc end end
Run oddb.org/bin/oddbd
Result
masa@masa ~/ywesee/ch.oddb.org $ ruby1.9 -I lib bin/migrate . ... (druby://localhost:56200) bin/migrate:448:in `block in <main>': undefined method `en' for #<DRb::DRbUnknown:0x0000000268c930> (NoMethodError) from (druby://localhost:56200) /usr/lib64/ruby/1.9.1/drb/drb.rb:1558:in `call' from (druby://localhost:56200) /usr/lib64/ruby/1.9.1/drb/drb.rb:1558:in `perform_without_block' from (druby://localhost:56200) /usr/lib64/ruby/1.9.1/drb/drb.rb:1518:in `perform' from (druby://localhost:56200) /usr/lib64/ruby/1.9.1/drb/drb.rb:1592:in `block (2 levels) in main_loop' from (druby://localhost:56200) /usr/lib64/ruby/1.9.1/drb/drb.rb:1588:in `loop' from (druby://localhost:56200) /usr/lib64/ruby/1.9.1/drb/drb.rb:1588:in `block in main_loop' from (druby://localhost:10000) /usr/lib64/ruby/1.8/drb/invokemethod.rb:10:in `block_yield' from (druby://localhost:10000) /usr/lib64/ruby/1.8/drb/invokemethod.rb:17:in `perform_with_block' from (druby://localhost:10000) /home/masa/ywesee/oddb.org/src/util/oddbapp.rb:588:in `each_value' from (druby://localhost:10000) /home/masa/ywesee/oddb.org/src/util/oddbapp.rb:588:in `each_atc_class' from bin/migrate:447:in `<main>'
Note
Experiment
oddb.org/src/util/oddbapp.rb#each_atc_class
def each_atc_class(&block) @atc_classes.values.each do |x| p x.en.to_s end
server.each_atc_class do |atc| p atc.en =begin unless atc.en.to_s.empty? migrate_atc ODDB::Remote::Drugs::Atc.new url, atc end =end end
Run oddb.org/bin/oddbd
Run ch.oddb.org/bin/migrate
Result (on the console of ch.oddb.org/bin/migrate)
... "Iproniazide" "Irinotecan" "Adrenalone" "Iproclozide" "Corticosteroide, Kombinationen mit anderen Mitteln" "Thrombin" "Methylthiouracil" "Hamamelisrindenextrakt, Kombinationen"
Result (on the console of oddb.org/bin/oddbd)
masa@masa ~/ywesee/ch.oddb.org $ ruby1.9 bin/migrate . ... (druby://localhost:34080) bin/migrate:449:in `block in <main>': undefined method `en' for #<DRb::DRbUnknown:0x00000001a25548> (NoMethodError) from (druby://localhost:34080) /usr/lib64/ruby/1.9.1/drb/drb.rb:1558:in `call' from (druby://localhost:34080) /usr/lib64/ruby/1.9.1/drb/drb.rb:1558:in `perform_without_block' from (druby://localhost:34080) /usr/lib64/ruby/1.9.1/drb/drb.rb:1518:in `perform' from (druby://localhost:34080) /usr/lib64/ruby/1.9.1/drb/drb.rb:1592:in `block (2 levels) in main_loop' from (druby://localhost:34080) /usr/lib64/ruby/1.9.1/drb/drb.rb:1588:in `loop' from (druby://localhost:34080) /usr/lib64/ruby/1.9.1/drb/drb.rb:1588:in `block in main_loop' from (druby://localhost:10000) /usr/lib64/ruby/1.8/drb/invokemethod.rb:10:in `block_yield' from (druby://localhost:10000) /usr/lib64/ruby/1.8/drb/invokemethod.rb:17:in `perform_with_block' from (druby://localhost:10000) /home/masa/ywesee/oddb.org/src/util/oddbapp.rb:592:in `each_value' from (druby://localhost:10000) /home/masa/ywesee/oddb.org/src/util/oddbapp.rb:592:in `each_atc_class' from bin/migrate:448:in `<main>'
Note
Question
Reference
Experiment
oddb.org/src/util/oddbapp.rb
def atc_values @atc_classes.values[0] end
ch.oddb.org/bin/migrate
atc_values=server.atc_values p atc_values.class
Run oddb.org/bin/oddbd
Run ch.oddb.org/bin/migrate
Result
masa@masa ~/ywesee/ch.oddb.org $ ruby1.9 bin/migrate . DRb::DRbUnknown
Note
Experiment (call by reference through drb)
oddb.org/src/util/oddbapp.rb
def atc_values @atc_classes.values[0].extend(DRb::DRbUndumped) end
ch.oddb.org/bin/migrate
atc_values=server.atc_values p atc_values.class p atc_values.en
Run oddb.org/bin/oddbd
Run ch.oddb.org/bin/migrate
Result
masa@masa ~/ywesee/ch.oddb.org $ ruby1.9 bin/migrate . DRb::DRbObject "Propylthiouracil"
Note
Experiment
oddb.org/src/util/oddbapp.rb#each_atc_class
def each_atc_class(&block) #@atc_classes.each_value(&block) @atc_classes.extend(DRb::DRbUndumped).each_value(&block) end
#server.remote_each_atc_class do |atc| server.each_atc_class do |atc| unless atc.en.to_s.empty? migrate_atc ODDB::Remote::Drugs::Atc.new url, atc end end exit
Result
TypeError: can't convert String into Integer when updating index 'oddb_drugs_atc_level_and_code' with a ODDB::Drugs::Atc ["/usr/lib64/ruby/site_ruby/1.9.1/odba/index.rb:301:in `[]'", "/usr/lib64/ruby/site_ruby/1.9.1/odba/index.rb:301:in `block in current_ids'", "/usr/lib64/ruby/site_ruby/1.9.1/odba/index.rb:299:in `collect'", "/usr/lib64/ruby/site_ruby/1.9.1/odba/index.rb:299:in `current_ids'"] [...] TypeError: can't convert String into Integer when updating index 'oddb_drugs_atc_level_and_code' with a ODDB::Drugs::Atc ["/usr/lib64/ruby/site_ruby/1.9.1/odba/index.rb:301:in `[]'", "/usr/lib64/ruby/site_ruby/1.9.1/odba/index.rb:301:in `block in current_ids'", "/usr/lib64/ruby/site_ruby/1.9.1/odba/index.rb:299:in `collect'", "/usr/lib64/ruby/site_ruby/1.9.1/odba/index.rb:299:in `current_ids'"] [...] TypeError: can't convert String into Integer when updating index 'oddb_drugs_atc_level_and_code' with a ODDB::Drugs::Atc ["/usr/lib64/ruby/site_ruby/1.9.1/odba/index.rb:301:in `[]'", "/usr/lib64/ruby/site_ruby/1.9.1/odba/index.rb:301:in `block in current_ids'", "/usr/lib64/ruby/site_ruby/1.9.1/odba/index.rb:299:in `collect'", "/usr/lib64/ruby/site_ruby/1.9.1/odba/index.rb:299:in `current_ids'"] [...] ...
Notes
Memo