Class: Embulk::InputExample
- Inherits:
-
InputPlugin
- Object
- InputPlugin
- Embulk::InputExample
- Defined in:
- lib/embulk/data/bundle/embulk/input_example.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(task, schema, index, page_builder) ⇒ InputExample
constructor
A new instance of InputExample.
- #run ⇒ Object
Methods inherited from InputPlugin
Constructor Details
#initialize(task, schema, index, page_builder) ⇒ InputExample
Returns a new instance of InputExample.
26 27 28 |
# File 'lib/embulk/data/bundle/embulk/input_example.rb', line 26 def initialize(task, schema, index, page_builder) super end |
Class Method Details
.transaction(config, &control) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/embulk/data/bundle/embulk/input_example.rb', line 7 def self.transaction(config, &control) task = { 'message' => config.param('message', :string, default: nil) } threads = config.param('threads', :integer, default: 2) columns = [ Column.new(0, 'col0', :long), Column.new(1, 'col1', :double), Column.new(2, 'col2', :string), ] puts "Example input started." commit_reports = yield(task, columns, threads) puts "Example input finished. Commit reports = #{commit_reports.to_json}" return {} end |
Instance Method Details
#run ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/embulk/data/bundle/embulk/input_example.rb', line 30 def run puts "Example input thread #{@index}..." 10.times do |i| @page_builder.add([i, 10.0, "example"]) end @page_builder.finish # don't forget to call finish :-) commit_report = { } return commit_report end |