view · edit · sidebar · attach · print · history

20130730-debug-bbmb-ch-snapshot

<< | Index | >>


Summary

  • Debug snapshot of Mnemonic
  • Checked TestCase with ruby 1.8.6

Commits / Patches

Index / Status


Debug mnemonic snapshot

$ ls -la log/mnemonic/
total 12
drwxr-xr-x 2 bbmb bbmb 4096 Jul 30 05:48 .
drwxr-xr-x 6 bbmb bbmb   56 Jun 23 10:44 ..
-rw-r--r-- 1 bbmb bbmb  702 Jul 30 05:48 000000000001.snapshot
  def update
    @prevalence.resellers.each { |gid, reseller| 
      puts "BbmbApp::update - updating #{reseller.name}"
      #errors = []
      reseller.updates { |symbol| 
        begin 
          puts "update: #{symbol}"
          $stdout.flush
          if(values = reseller.custom_behavior.send(symbol))
            self.send(symbol, gid, values)
          end 
          puts "#{symbol} done"
          $stdout.flush
          GC.start
        rescue Exception => e
          puts e.message
          puts e.backtrace
          #errors.push(e)
        end 
      }   
      #reseller.write_exports()
      #reseller.mail_statistics()
      #reseller.notify(errors) unless errors.empty?
    }   
    @prevalence.takeSnapshot
    GC.start
  end

Snapshot creation works fine.

@prevalence.takeSnapshot works.
But @prevalence.resellers was empty.

Link

Is data empty?

ch.bbmb.globopharm> users.length
-> 1
ch.bbmb.globopharm> users['0']
-> #<BBMB::RootUser:0x7fe31f5f1798>
ch.bbmb.globopharm> users['0'].name
-> root
ch.bbmb.globopharm> resellers['0']
-> 
ch.bbmb.globopharm> resellers['0'].class
-> NilClass
ch.bbmb.globopharm> users['0'].reseller
-> #<BBMB::Reseller:0x7fe31f5f0fa0>
ch.bbmb.globopharm> users['0'].reseller.class
-> BBMB::Reseller
ch.bbmb.globopharm> users['0'].email
-> mhatakeyama@ywesee.com

Then restored data (Mnemonic log) from backup again.
Does Some process erase this log file ?

Note (for Zukunft)

bbmb.ch (v1) does not use ODBA.
LogFile(Mnemonic) is data.

by README

loading from logfile takes 10 Minutes.

1. The restart of globopharm.bbmb.ch can take up to 10 Minutes or more, so be patient.

Install flexmock for ruby-1.8.6

For test with ruby 1.8.6

Already http://rubygems.org is gone. (got error Gem::GemNotFoundException)

% sudo gem install flexmock --version 0.8.8
ERROR:  Could not find a valid gem 'flexmock' (= 0.8.8) in any repository
ERROR:  While executing gem ... (ArgumentError)
    wrong number of arguments (1 for 0)

Then,

# cat ~/.gemrc
---
:sources:
  - https://rubygems.org/

I could installed flexmock 0.8.8 against ruby 1.8.6


Re-Inject order in bbmb.ch

Re-Inject (only) in bbmb.ch.
(not :transmit:)

% grep -r ydim src 
src/custom/behavior.rb:                 target = "ydim-inject@192.168.0.xx"
src/custom/behavior.rb:                 command = '/usr/bin/ruby /usr/bin/ydim-inject'
% grep -r notify_failed_ src 
src/util/bbmbapp.rb:        reseller.notify_failed_inject(customer_id, order_vals, additional_info,
src/custom/behavior.rb:    def notify_failed_inject(customer_id, order_vals, additional_info, 

in :src/unil/bbmbapp.rb:

  ## inject_order - inject an order (e.g. from xmlconv)
  ## parameters:
  ## - reseller_short:  String                  -> BBMB::DEFAULT_FLAVOR
  ## - customer_id:     String                  -> '330108' 
  ## - order_vals:      {{article_id} => size}  -> {:article_pcode=>"1647471"} => 20, ...
  ## - additional_info: {key => val}            -> {:order_reference=>"04010596"}
  ## - commit_time:     Time
  def inject_order(reseller_short, customer_id, order_vals, 
    additional_info=nil, commit_time=nil)
    if(reseller = get_reseller_by_short_name(reseller_short))
      if(unavailable = reseller.inject_order(customer_id, order_vals, 
                                             additional_info, commit_time))
        reseller.notify_failed_inject(customer_id, order_vals, additional_info,
                                      commit_time, unavailable)
      end 
    end 
  end

Flow

0. xmlconv

  1. .PopMission in xmlconv

1. globopharm.xmlconv.bbmb.ch

etc/polling.yml in globopharm.xmlconv.bbmb.ch
postprocs:
 - - 'Bbmb'
   - 'inject'
   - 'druby://localhost:9999'
   - 'gag'
   - '221200'
  1. . Xmlconv::PostProcess::Bbmb.inject

2. bbmb.ch

  1. . Bbmb#inject_order in bbmbapp.rb
  2. . BBMB::Reseller#inject_order in reseller.rb
  3. . BBMB::Hospital#inject_order in hospital.rb
  4. . BBMB::Resller#crete_order in reseller.rb
  5. . BBMB::CustomBehavior#create_order in behavior.rb
  6. . BBMB::Order#update in order.rb

Inject via bin/admin

This is way to create only Injection.

ch.yasuhiro.bbmb.xmlconv.globopharm> transaction(661).class
-> XmlConv::Util::Transaction
ch.yasuhiro.bbmb.xmlconv.globopharm> XmlConv::PostProcess::Bbmb.inject("druby://localhost:xxxx", "gag", transaction(661))
...
...
name_short: gag
hospital: 

order: 
{:article_ean13=>"7680542300870", :article_pcode=>"1954753"} => 3
{:article_ean13=>"7680542300528", :article_pcode=>"1954724"} => 2
{:article_ean13=>"7680521100767", :article_pcode=>"1556283"} => 3
{:article_ean13=>"7680521101658", :article_pcode=>"2355693"} => 8
{:article_ean13=>"7680521101498", :article_pcode=>"1906062"} => 4
{:article_ean13=>"7680561390081", :article_pcode=>"3266023"} => 16
{:article_ean13=>"7680561390067", :article_pcode=>"3266017"} => 1
{:article_ean13=>"7680561390128", :article_pcode=>"3266052"} => 8
{:article_ean13=>"7680561390043", :article_pcode=>"3265992"} => 7
{:article_ean13=>"7680561390029", :article_pcode=>"3265963"} => 1
{:article_ean13=>"7680605740049", :article_pcode=>"4703218"} => 1
{:article_ean13=>"7680605740063", :article_pcode=>"4703224"} => 2
{:article_ean13=>"7680605740070", :article_pcode=>"4703230"} => 1
{:article_ean13=>"7680605740087", :article_pcode=>"4703247"} => 1
{:article_ean13=>"7680605740094", :article_pcode=>"4703253"} => 3
{:article_ean13=>"7680556090224", :article_pcode=>"2333289"} => 3
{:article_ean13=>"7680507580606", :article_pcode=>"1488446"} => 2
{:article_ean13=>"7680485910518", :article_pcode=>"2204936"} => 3
{:article_ean13=>"7680623310019", :article_pcode=>"5090947"} => 4
{:article_ean13=>"7680541820317", :article_pcode=>"2338832"} => 2
{:article_ean13=>"7680555680051", :article_pcode=>"2321518"} => 3
{:article_ean13=>"7680555680099", :article_pcode=>"2692031"} => 2
{:article_ean13=>"7680573270067", :article_pcode=>"3893642"} => 1
{:article_ean13=>"7680552640034", :article_pcode=>"2344235"} => 1

info: 
order_reference => xxx
order_comment => xxxxxxxx
XxXXXX XXXX
XXXXXX XXXX

If big order is given,

ch.bbmb.xmlconv.globopharm> transaction(644).class
-> XmlConv::Util::Transaction
ch.bbmb.xmlconv.globopharm> XmlConv::PostProcess::Bbmb.inject("druby://localhost:xxxx", "gag", transaction(664))
-> Array

Link

view · edit · sidebar · attach · print · history
Page last modified on June 14, 2016, at 01:25 PM