Sha256: 43879649f521468af2a2b6d486d43246efb885805e7258bd966fa5b734fe126c

Contents?: true

Size: 1.19 KB

Versions: 13

Compression:

Stored size: 1.19 KB

Contents

$:.unshift('lib')

require 'rubygems'
require 'ruote/engine'
require 'ruote/worker'
require 'ruote/part/storage_participant'
require 'ruote/storage/hash_storage'
require 'ruote/storage/fs_storage'
require 'ruote/log/test_logger'

#opts = { 's_logger' => [ 'ruote/log/test_logger', 'Ruote::TestLogger' ] }
opts = {}

storage = if ARGV.include?('--fs')
  #FileUtils.rm_rf('work_mega') if ARGV.include?('-e')
  Ruote::FsStorage.new('work_mega', opts)
else
  Ruote::HashStorage.new(opts)
end

p storage.class

if ARGV.include?('-e')
  #
  # engine and worker
  #

  puts "... engine + worker ..."

  engine = Ruote::Engine.new(Ruote::Worker.new(storage))

  engine.register_participant 'alpha', Ruote::StorageParticipant

  start = Time.now

  pdef = Ruote.process_definition :name => 'mega' do
    #echo '/${f:index}/'
    alpha :unless => '${f:index} == 2000'
  end

  wfid = nil

  (1..2000).to_a.each_with_index do |i|
    wfid = engine.launch(pdef, 'index' => i)
  end

  puts "took #{Time.now - start} seconds to launch"

  #engine.context.worker.run_thread.join
  engine.wait_for(wfid)

else
  #
  # pure worker
  #

  puts "... standalone worker ..."

  worker = Ruote::Worker.new(storage)
  worker.run

end

Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
ruote-maestrodev-2.2.1 test/bm/mega.rb
ruote-2.2.0 test/bm/mega.rb
ruote-2.1.11 test/bm/mega.rb
ruote-2.1.10 test/bm/mega.rb
ruote-2.1.9 test/bm/mega.rb
ruote-2.1.8 test/bm/mega.rb
ruote-2.1.7 test/bm/mega.rb
ruote-2.1.6 test/bm/mega.rb
ruote-2.1.5 test/bm/mega.rb
ruote-2.1.4 test/bm/mega.rb
ruote-2.1.3 test/bm/mega.rb
ruote-2.1.2 test/bm/mega.rb
ruote-2.1.1 test/bm/mega.rb