Class: Kiba::Extend::Jobs::BaseJob
Abstract
- Inherits:
-
Object
- Object
- Kiba::Extend::Jobs::BaseJob
show all
- Includes:
- Parser, Runner
- Defined in:
- lib/kiba/extend/jobs/base_job.rb
Overview
Abstract definition of Job and job interface
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Parser
#parse_job
Methods included from Runner
#add_config, #add_decoration, #add_destinations, #add_lookup, #add_sources, #assemble_control, #check_requirements, #destinations, #file_config, #handle_requirements, #lookups_to_memoized_methods, #parse_job_segments, #show_me_decoration, #sources, #tell_me_decoration, #transform
Methods included from Reporter
#desc_and_tags, #get_duration, #minimal_end, #minimal_start, #normal_end, #normal_start, #put_file_details, #report_run_end, #report_run_start, #row_report, #start_and_def, #start_label, #tags, #verbose_end, #verbose_start
Constructor Details
#initialize(files:, transformer:, mode: :run) ⇒ BaseJob
Returns a new instance of BaseJob.
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/kiba/extend/jobs/base_job.rb', line 27
def initialize(files:, transformer:, mode: :run)
@destination_key = files[:destination].is_a?(Symbol) ?
files[:destination] :
files[:destination].first
if caller(2, 5).join(" ")["block in handle_requirements"]
@dependency = true
end
extend DependencyJob if @dependency
@files = setup_files(files)
unless mode == :info
report_run_start handle_requirements @control = Kiba::Control.new
@context = Kiba::Context.new(control)
@transformer = transformer
assemble_control end
if mode == :run
run
set_row_count_instance_variables
report_run_end end
end
|
Instance Attribute Details
#context ⇒ Object
19
20
21
|
# File 'lib/kiba/extend/jobs/base_job.rb', line 19
def context
@context
end
|
#control ⇒ Object
19
20
21
|
# File 'lib/kiba/extend/jobs/base_job.rb', line 19
def control
@control
end
|
#files ⇒ Object
19
20
21
|
# File 'lib/kiba/extend/jobs/base_job.rb', line 19
def files
@files
end
|
#outrows ⇒ Object
19
20
21
|
# File 'lib/kiba/extend/jobs/base_job.rb', line 19
def outrows
@outrows
end
|
#srcrows ⇒ Object
19
20
21
|
# File 'lib/kiba/extend/jobs/base_job.rb', line 19
def srcrows
@srcrows
end
|
19
20
21
|
# File 'lib/kiba/extend/jobs/base_job.rb', line 19
def transformer
@transformer
end
|
Instance Method Details
#run ⇒ Object
55
56
57
58
59
60
61
62
63
|
# File 'lib/kiba/extend/jobs/base_job.rb', line 55
def run
Kiba.run(control)
rescue => err
puts "JOB FAILED: TRANSFORM ERROR IN: #{job_data.creator}"
puts "#{err.class.name}: #{err.message}"
puts "AT:"
puts err.backtrace.first(10)
exit
end
|