Betrieb: Verbindungsdatei, Summen mit Abgleich vor dem Schreiben, Laufhistorie
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
# --limit=N only the first N source rows
|
||||
# --verbose log level debug, --quiet only warnings (default info)
|
||||
# --lock=FILE exclusive lock for the whole script, exit 3 when another run holds it
|
||||
# --history=FILE one json line per pipeline run (DataPipeline.history)
|
||||
# --name=value any other option: DataPipeline.params[:name] and passed on to the script
|
||||
#
|
||||
# exit code: 0 ok, 1 aborted, 2 finished with rejected rows, 3 locked by another run
|
||||
@@ -33,6 +34,7 @@ parser = OptionParser.new do |opts|
|
||||
opts.on('--verbose') { options[:settings][:log_level] = Logger::DEBUG }
|
||||
opts.on('--quiet') { options[:settings][:log_level] = Logger::WARN }
|
||||
opts.on('--lock=FILE', String) { |v| options[:lock] = v }
|
||||
opts.on('--history=FILE', String) { |v| options[:settings][:history] = v }
|
||||
end
|
||||
|
||||
# own options for the parser, everything else (also --name=value of the script) goes to the script
|
||||
@@ -40,9 +42,9 @@ own = []
|
||||
args = []
|
||||
argv = ARGV.dup
|
||||
while (arg = argv.shift)
|
||||
if arg.match?(/\A--(from|till|param|dry-run|limit|verbose|quiet|lock)(=|\z)/)
|
||||
if arg.match?(/\A--(from|till|param|dry-run|limit|verbose|quiet|lock|history)(=|\z)/)
|
||||
own << arg
|
||||
own << argv.shift if %w[--param --limit --from --till].include?(arg)
|
||||
own << argv.shift if %w[--param --limit --from --till --lock --history].include?(arg)
|
||||
else
|
||||
args << arg
|
||||
end
|
||||
@@ -54,7 +56,7 @@ DataPipeline.params.merge!(DataPipeline.parse_params(args)) { |_key, own_value,
|
||||
abort parser.help if script.nil?
|
||||
abort "etl: #{script} not found\n\n#{parser.help}" unless File.exist?(script)
|
||||
|
||||
DataPipeline.settings(options[:settings])
|
||||
DataPipeline.settings(options[:settings].merge(name: File.basename(script, '.rb')))
|
||||
|
||||
begin
|
||||
script_lock = DataPipeline::Lock.new(options[:lock]).acquire if options[:lock] # held until the process ends
|
||||
|
||||
Reference in New Issue
Block a user