Sha256: c2649e628982c904bcce3afe5548e4b408645dae559b95ab386bda8106f6b64e

Contents?: true

Size: 614 Bytes

Versions: 3

Compression:

Stored size: 614 Bytes

Contents

# -*- coding: utf-8 -*-
require 'rubygems'
require 'keystone'
require "optparse"


class SampleBatch
  include Keystone::Batch::Base
  logger_name :l

  # 実行時に--helpでオプション一覧
  def main
    has_option = {}
    opts = option_parser
    opts.on("-v value") do |v|
      has_option[:v] = v
    end
    opts.on("-w who") do |v|
      has_option[:w] = v
    end

    execute() do
      begin
        sleep 10
        l.info "batch process01"
        l.info "who=#{has_option[:w]}"
        sleep 4
      rescue => e
        l.error e
      end
    end
  end
end

batch = SapmleBatch.new
batch.main

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
keystone-0.0.32 example/batch_sample.rb
keystone-0.0.31 example/batch_sample.rb
keystone-0.0.30 example/batch_sample.rb