<< | Index | >>
Goal/Estimate/Evaluation:
Task
New file
Updated files
module Migel ... defaults = { ... 'admins' => [], 'mail_from' => 'update@ywesee.com', 'mail_charset' => 'utf8', 'smtp_authtype' => :plain, 'smtp_domain' => 'ywesee.com', 'smtp_pass' => nil, 'smtp_port' => 587, 'smtp_server' => 'localhost', 'smtp_user' => 'update@ywesee.com', }
--- db_user: 'postgres' db_auth: '' admins: - mhatakeyama@ywesee.com mail_from: mhatakeyama@ywesee.com smtp_domain: ywesee.com smtp_server: smtp.gmail.com smtp_user: mhatakeyama@ywesee.com smtp_pass: 'xxxx'
Run
migel> Migel::Util::Mail.notify_admins('test', ['hogehoge'])
Result
From mhatakeyama@ywesee.com To mhatakeyama@ywesee.com hogehoge
Experiment
def reported_save_all_products lines = [ sprintf("%s: %s %s#save_all_products", Time.now.strftime('%c'), Migel.config.server_name, self.class) ] #save_all_products lines.concat report rescue Exception => err lines.push(err.class.to_s, err.message, *err.backtrace) lines.concat report ensure subject = lines[0] Mail.notify_admins(subject, lines) end def report ['report'] end
Run
migel> Migel::Util::Importer.new.reported_save_all_products -> Mon Sep 19 09:49:42 2011: migel Migel::Util::Importer#save_all_productsreport
Result
Experiment
def report [ sprintf("Saved file: #{@saved_csv_file}"), sprintf("Total %5i Migelids (Saved %5i / Unsaved %5i):", migel_code_list.length, @saved_migelids, @unsaved_migelids), sprintf("Saved %5i Products:", @saved_products), sprintf("Save time length: #{@save_time_length}"), ] end
def save_all_products(file_name = 'migel_products_de.csv', lang = 'de', estimate = false) @saved_products = 0 @saved_migelids = 0 @unsaved_migelids = 0 ... CSV.open(file_name, 'w') do |writer| migel_codes.each_with_index do |migel_code, count| ... @saved_products += 1 product_flag = true end if product_flag @saved_migelids += 1 else @unsaved_migelids += 1 end time = estimate_time(start_time, total, count+1) @save_time_length = time.split(':')[1].split(' ')[0,2].join(' ') puts time if estimate end # migel_codes end # CSV end
Run
migel> Migel::Util::Importer.new.reported_save_all_products('hogehoge.csv', 'de', true)
Result
Experiment
migel> Migel::Util::Importer.new.missing_article_name_migel_code_list('de', 'missing_migel_code_list.dat')
masa@masa ~/ywesee/migel_dev $ cat missing_migel_code_list.dat 01.01.01.00.1 01.01.02.00.2 03.03.01.00.1 ... masa@masa ~/ywesee/migel_dev $ head migel_product_de.csv 01.01.01.00.1,1624501,7612479001117,AMEDA Einhandmilchpumpe mit Flexishield,Nufer AG (Medizintechnik),,32.30,43.70,1,43.70,,A,2010-08-16T00:00:00+00:00,2010-07-09T00:00:00+00:00,DE 01.01.01.00.1,4637852,,AMEDA LACT-H Zweihandpumpe,Nufer AG,,17.80,24.10,1,24.10,,,,, 01.01.01.00.1,4443763,7640109051744,ARDO AMARYLL Individuelle Handmilchpumpe,Ardo medical AG,,41.30,74.00,1,74.00,,A,2010-08-16T00:00:00+00:00,2010-03-15T00:00:00+00:00,DE 01.01.01.00.1,1930445,8710103528920,AVENT PHILIPS ISIS Milchpumpe manuell,Philips AG (Haushalt),,60.30,95.00,1,95.00,100,A,2011-02-02T00:00:00+00:00,1997-12-22T00:00:00+00:00,DE ...
Note
Note
Result
Note
suspend
Task
de.oddb.org
sort function
sort link
create a remote object
Hypothesis
Experiment
require 'drb' class Person include DRbUndumped attr_accessor :n def initialize(n) @n = n end end
require 'drb' require 'person' here = 'druby://localhost:17640' @queue = Queue.new arr = [] 10.times {|i| @queue.push(Person.new(i)) } DRb.start_service(here, @queue)
require 'drb' #require 'person' there = 'druby://localhost:17640' DRb.start_service(nil) @queue = DRbObject.new(nil, there)
Run
masa@masa ~/work/drb_error_test $ irb irb(main):001:0> require 'server' => true irb(main):002:0> @queue.length => 10
masa@masa ~/work/drb_error_test $ irb irb(main):001:0> require 'client' => true irb(main):002:0> @queue.length => 10 irb(main):003:0> q = @queue.pop => #<DRb::DRbObject:0x7fe306620200 @uri="druby://localhost:17640", @ref=69898410693460> irb(main):004:0> q.n => 0 irb(main):005:0> @queue.length => 9
irb(main):004:0> GC.start => nil
irb(main):006:0> q.n RangeError: 0x3fbddfdae01c is recycled object
Note
Experiment
#include DRbUndumped
attr_accessor :n
def initialize(n)
@n = n
end
#require 'person'
there = 'druby://localhost:17640'
DRb.start_service(nil)
@queue = DRbObject.new(nil, there)
Run
masa@masa ~/work/drb_error_test $ irb irb(main):001:0> require 'server' => true irb(main):002:0> @queue.length => 10
masa@masa ~/work/drb_error_test $ irb irb(main):001:0> require 'client' => true irb(main):002:0> @queue.length => 10 irb(main):003:0> q = @queue.pop => #<DRb::DRbUnknown:0x7fe37e4b1c98 @buf="\004\bo:\vPerson\006:\a@ni\000", @name="Person"> irb(main):004:0> q.n NoMethodError: undefined method `n' for #<DRb::DRbUnknown:0x7fe37e4b1c98> from (irb):4
Note
Experiment
require 'person'
there = 'druby://localhost:17640'
DRb.start_service(nil)
@queue = DRbObject.new(nil, there)
Run
masa@masa ~/work/drb_error_test $ irb irb(main):001:0> require 'server' => true irb(main):002:0> @queue.length => 10
masa@masa ~/work/drb_error_test $ irb irb(main):001:0> require 'client' => true irb(main):002:0> @queue.length => 10 irb(main):003:0> q = @queue.pop => #<Person:0x7f1c49df9cf8 @n=0> irb(main):004:0> q.n => 0 irb(main):005:0> @queue.length => 9
irb(main):003:0> @queue.length => 9 irb(main):004:0> GC.start => nil
irb(main):006:0> q.n => 0
Note
Reference