view · edit · sidebar · attach · print · history

20111117-debug-composition-package-oddb_org

<< | Index | >>


  1. Debug Package#compositions '+' link
  2. Replace pointer link in a report email
  3. Replace pointer link of new fachinfo
  4. Make a link in the chapter of 'Zulassungsinhaberin'
  5. Test ODBA.prefetch all objects

Goal/Estimate/Evaluation
  • Debug '+' link button package oddb.org / 100% / 100%
  • Replace pointer link / 100% / 100%
  • Update kindle ebook / 100% / 100%
  • Check prefetch and speed / 70%
Milestones
  1. Package '+' link
  2. Some pointer links in an email
  3. new_fachinfo pointer link
  4. ODBA prefetch cache test
  5. Setup script for ruby 1.9.3

Commit


Debug Package#compositions '+' link

Commit

Replace pointer link in a report email

Email

Replace

Commit

Replace pointer link of new fachinfo

Task

  • Replace new_fachinfo url link with one without pointer

Replace

Updates

  • src/state/admin/root.rb
 def new_fachinfo
    #if((pointer = @session.user_input(:pointer)) && (registration = pointer.resolve(@session)))
    if(reg = @session.user_input(:reg) and registration = @session.app.registration(reg))
      _new_fachinfo(registration)
    end
 end
  • src/view/additional_information.rb
      def fachinfo(model, session=@session, css='square infos')
        if(link = _fachinfo(model, css))
          link
        elsif(!model.has_fachinfo? && @session.allowed?('edit', model))
          link = HtmlGrid::Link.new(:fachinfo_create, model, @session, self)
          #ptr = model.is_a?(Registration) ?  model.pointer : model.registration.pointer
          reg = model.is_a?(Registration) ?  model.iksnr : model.registration.iksnr
          #args = {:pointer => ptr, :chapter => 'composition'}
          args = [:reg => reg, :chapter => 'composition']
          link.href = @lookandfeel._event_url(:new_fachinfo, args)
          link.css_class = 'square create-infos'
          link
        end
      end

Error

error in SBSM::Session#to_html: /de/gcc/new_fachinfo/reg/61322/chapter/composition
ArgumentError
wrong number of arguments (2 for 1)
/usr/lib64/ruby/1.8/delegate.rb:183:in `respond_to?'
/usr/lib64/ruby/1.8/delegate.rb:183:in `respond_to?'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/value.rb:33:in `init'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/component.rb:138:in `initialize'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/namedcomponent.rb:34:in `initialize'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:70:in `new'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:70:in `create'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:284:in `compose_component'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:209:in `compose'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:203:in `each'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:203:in `compose'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:55:in `init'
/home/masa/ywesee/oddb.org/src/view/drugs/fachinfo.rb:278:in `init'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/component.rb:138:in `initialize'
/home/masa/ywesee/oddb.org/src/view/publictemplate.rb:53:in `new'
/home/masa/ywesee/oddb.org/src/view/publictemplate.rb:53:in `content'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:66:in `send'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:66:in `create'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:284:in `compose_component'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:209:in `compose'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:203:in `each'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:203:in `compose'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/composite.rb:55:in `init'
/home/masa/ywesee/oddb.org/src/view/publictemplate.rb:50:in `init'
/home/masa/ywesee/oddb.org/src/view/privatetemplate.rb:16:in `init'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/component.rb:138:in `initialize'
/usr/lib64/ruby/site_ruby/1.8/sbsm/state.rb:285:in `new'
/usr/lib64/ruby/site_ruby/1.8/sbsm/state.rb:285:in `view'
/usr/lib64/ruby/site_ruby/1.8/sbsm/state.rb:197:in `to_html'
/usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:529:in `to_html'
/usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:177:in `drb_process'
/usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:174:in `synchronize'
/usr/lib64/ruby/site_ruby/1.8/sbsm/session.rb:174:in `drb_process'
/usr/lib64/ruby/1.8/drb/drb.rb:1555:in `__send__'
/usr/lib64/ruby/1.8/drb/drb.rb:1555:in `perform_without_block'
/usr/lib64/ruby/1.8/drb/drb.rb:1515:in `perform'
/usr/lib64/ruby/1.8/drb/drb.rb:1589:in `main_loop'
/usr/lib64/ruby/1.8/drb/drb.rb:1585:in `loop'
/usr/lib64/ruby/1.8/drb/drb.rb:1585:in `main_loop'
/usr/lib64/ruby/1.8/drb/drb.rb:1581:in `start'
/usr/lib64/ruby/1.8/drb/drb.rb:1581:in `main_loop'
/usr/lib64/ruby/1.8/drb/drb.rb:1430:in `run'
/usr/lib64/ruby/1.8/drb/drb.rb:1427:in `start'
/usr/lib64/ruby/1.8/drb/drb.rb:1427:in `run'
/usr/lib64/ruby/1.8/drb/drb.rb:1347:in `initialize'
/usr/lib64/ruby/1.8/drb/drb.rb:1627:in `new'
/usr/lib64/ruby/1.8/drb/drb.rb:1627:in `start_service'
bin/oddbd:38
ODDB::View::Drugs::RootFachinfoComposite::COMPONENTS[[1, 0]] in create(company_name)
ODDB::View::Drugs::RootFachinfo::COMPONENTS[[0, 3]] in create(content)
error in SBSM::Session#http_headers: /de/gcc/new_fachinfo/reg/61322/chapter/composition
ArgumentError
wrong number of arguments (2 for 1)
/usr/lib64/ruby/1.8/delegate.rb:183:in `respond_to?'
/usr/lib64/ruby/1.8/delegate.rb:183:in `respond_to?'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/value.rb:33:in `init'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/component.rb:138:in `initialize'
/usr/lib64/ruby/site_ruby/1.8/htmlgrid/namedcomponent.rb:34:in `initialize'

Update

  • src/util/persistent.rb
      #def respond_to?(key)
      def respond_to?(key, *args)
        key != :pointer_descr
      end

Commit

Make a link in the chapter of 'Zulassungsinhaberin'

Email

Update

  • bin/decorators/just_medical_de.rb
 # encoding: utf-8
 module EBPS
   module Decorator
    module JustMedical
      def self.decorate model
        model.chapters.each_with_index do |chap, i|
          if chap.heading =~ /Zulassungsinhaberin/
            if chap.paragraphs.first.to_s =~ /AstraZeneca AG/
              table = Text::Table.new
              table.rows[0][0] = Text::LinkedParagraph.new('http:/www.astrazeneca.ch/', 'AstraZeneca AG')
              table.rows[0] << Text::Paragraph.new(chap.paragraphs.first.to_s.gsub(/AstraZeneca AG/,''))
              chap.paragraphs[0] = table
            end
          end
        end

        if codes = model.metadata['article_codes']
          size_ean13s = codes.collect do |hash| [hash[:article_size], hash[:article_dose], hash[:article_ean13]] end.compact
          unless size_ean13s.empty?
            chapter = Text::Chapter.new
            chapter.heading << 'Stammdaten'
            size_ean13s.each do |size, dose, ean13|
              reg  = ean13[4,5]
              href = "http://www.med-drugs.ch/?main=/de/just-medical/show/reg/#{reg}"
              chapter.add_paragraph Text::LinkedParagraph.new(href, model.title + " " + size.to_s + " " + dose.to_s)
            end
            model.add_chapter chapter
          end
        end
      end
    end
   end
 end
  • bin/decorators/just_medical_fr.rb
 # encoding: utf-8
 module EBPS
   module Decorator
    module JustMedical
      def self.decorate model
        model.chapters.each_with_index do |chap, i|
          if chap.heading =~ /Titulaire de l’autorisation/
            if chap.paragraphs.first.to_s =~ /AstraZeneca AG/
              table = Text::Table.new
              table.rows[0][0] = Text::LinkedParagraph.new('http:/www.astrazeneca.ch/', 'AstraZeneca AG')
              table.rows[0] << Text::Paragraph.new(chap.paragraphs.first.to_s.gsub(/AstraZeneca AG/,''))
              chap.paragraphs[0] = table
            end
          end
        end

        if codes = model.metadata['article_codes']
          size_ean13s = codes.collect do |hash| [hash[:article_size], hash[:article_dose], hash[:article_ean13]] end.compact
          unless size_ean13s.empty?
            chapter = Text::Chapter.new
            chapter.heading << 'Base des données'
            size_ean13s.each do |size, dose, ean13|
              reg  = ean13[4,5]
              href = "http://www.med-drugs.ch/?main=/fr/just-medical/show/reg/#{reg}"
              chapter.add_paragraph Text::LinkedParagraph.new(href, model.title + " " + size.to_s + " " + dose.to_s)
            end
            model.add_chapter chapter
          end
        end
      end
    end
   end
 end

Run

masa@masa ~/ywesee/ebps $ ruby1.9 -I lib bin/meddrugs.ch_de_kindle config="etc/meddrugs.ch_de_kindle.yml"

Test ODBA.prefetch all objects

Experiment

  • bin/admin
ch.oddb> ODBA.cache.prefetch

Result

/usr/lib64/ruby/site_ruby/1.8/odba/persistable.rb:340: [BUG] Segmentation fault
ruby 1.8.6 (2009-06-08) [x86_64-linux]

Abgebrochen
/usr/lib64/ruby/site_ruby/1.8/odba/marshal.rb:15: [BUG] rb_gc_mark(): unknown data type 0x16(0x7fc2897d1930) non object
ruby 1.8.6 (2009-06-08) [x86_64-linux]

Abgebrochen

Note

  • odba/persitable.rb
# A Persistable instance can be _prefetchable_. This means that the object
# can be loaded at startup by calling ODBA.cache.prefetch, and that it will 
# never expire from the Cache. The prefetch status can be controlled per 
# instance by setting the instance variable @odba_prefetch, and per class by 
# overriding the module constant ODBA_PREFETCH

Check

masa@masa ~/ywesee/oddb.org $ grep -ri odba_prefetch src/
src/model/activeagent.rb:               ODBA_PREFETCH = true
src/model/registration.rb:              ODBA_PREFETCH = true
src/model/sequence.rb:          ODBA_PREFETCH = true

Before prefetch

  • 667 MB memory is used

After prefetch

  • 1867 MB memory is used

Note

  • The cached objects are of (1867 - 667 = 1200 MB)

Experiment

  • src/model/package.rb
 class Package < PackageCommon
    ODBA_PREFETCH = true

Prefetch

  • bin/admin
ch.oddb> ODBA.cache.prefetch

Log

  2011-11-17 16:22:59: sessions:    0 - threads:    6 - memory:  284MB 
view · edit · sidebar · attach · print · history
Page last modified on November 17, 2011, at 04:23 PM