Sha256: 9b3d0fae2e01de23e601a658a7b40a7ed691c5a5ebdf38090635271aaaf5296a
Contents?: true
Size: 942 Bytes
Versions: 1
Compression:
Stored size: 942 Bytes
Contents
require 'colorize' class Chronicle::ETL::Runner def initialize(job) @job = job @job_logger = Chronicle::ETL::JobLogger.new(@job) end def run! extractor = @job.instantiate_extractor loader = @job.instantiate_loader @job_logger.start loader.start total = extractor.results_count progress_bar = Chronicle::ETL::Utils::ProgressBar.new(title: 'Running job', total: total) extractor.extract do |data, metadata| transformer = @job.instantiate_transformer(data) record = transformer.transform unless record.is_a?(Chronicle::ETL::Models::Base) raise Chronicle::ETL::InvalidTransformedRecordError, "Transformed data is not a type of Chronicle::ETL::Models" end @job_logger.log_transformation(transformer) loader.load(record) progress_bar.increment end progress_bar.finish loader.finish @job_logger.finish @job_logger.save end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
chronicle-etl-0.2.4 | lib/chronicle/etl/runner.rb |