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:) ⇒ BaseJob
Returns a new instance of BaseJob.
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/kiba/extend/jobs/base_job.rb', line 23
def initialize(files:, transformer:)
@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.transform_values { |v| [v].flatten })
@transformer = transformer
end
|
Instance Attribute Details
#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
#context ⇒ Object
39
|
# File 'lib/kiba/extend/jobs/base_job.rb', line 39
def context = @context ||= Kiba::Context.new(control)
|
#control ⇒ Object
37
|
# File 'lib/kiba/extend/jobs/base_job.rb', line 37
def control = @control ||= Kiba::Control.new
|
#run ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/kiba/extend/jobs/base_job.rb', line 41
def run
report_run_start %i[source lookup].each do |type|
handle_requirements(type)
end
assemble_control Kiba.run(control)
set_row_count_instance_variables
report_run_end 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
|