Sha256: 5e1da577c8b6ed21236b8eb98a79c48bac90d9a61d735f114f803d22d6dc52a0

Contents?: true

Size: 1.15 KB

Versions: 2

Compression:

Stored size: 1.15 KB

Contents

#!/usr/bin/env ruby

require 'remote_syslog_logger'
require_relative '../lib/gooddata'

DEFAULT_BRICK = 'hello_world_brick'
BRICK_PARAM_PREFIX = 'BRICK_PARAM_'

brick_type = !ARGV.empty? ? ARGV[0] : DEFAULT_BRICK

syslog_node = ENV['NODE_NAME']
log = RemoteSyslogLogger.new(syslog_node, 514, :program => brick_type)

log.info "action=#{brick_type}_execution status=init"

begin
  brick_pipeline = GoodData::Bricks::Pipeline.send("#{brick_type}_pipeline")
  params = ENV.select { |k,| k.to_s.match(/^#{BRICK_PARAM_PREFIX}.*/) }.map { |k, v| [k.slice(BRICK_PARAM_PREFIX.length..-1), v] }.to_h
  commit_hash = ENV['GOODDATA_RUBY_COMMIT'] || ''
  params['gooddata_ruby_commit'] = commit_hash
  params['log_directory'] = ENV['LOG_DIRECTORY'] || '/tmp/'
  log.info "action=#{brick_type}_execution status=start commit_hash=#{commit_hash}"
  @brick_result = brick_pipeline.call(params)
  log.info "action=#{brick_type}_execution status=finished"
rescue NoMethodError => e
  log.info "action=#{brick_type}_execution status=error Invalid brick type '#{brick_type}', #{e.message}"
  raise e
rescue => e
  log.info "action=#{brick_type}_execution status=error #{e.message}"
  raise e
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gooddata-1.3.2-java bin/run_brick.rb
gooddata-1.3.2 bin/run_brick.rb