Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bartlomiejdanek/13f998019c667c305f69358337dba589 to your computer and use it in GitHub Desktop.
Save bartlomiejdanek/13f998019c667c305f69358337dba589 to your computer and use it in GitHub Desktop.
backfill import
class ImportDateStatsFromSparkExportBackfill < ImportDateStatsFromSparkExport
FROM_DATE = Date.new(2016, 6, 1)
TO_DATE = Date.new(2017, 1, 18)
private
def process_location(location)
(FROM_DATE..TO_DATE).each do |date|
$backfill_date = date
Rails.logger.info "===> Importing for #{$backfill_date}"
super
end
end
end
class SparkExportWrapperBackfill < SparkExportWrapper
FILE_DATE_FORMAT = "%Y_%m_%d".freeze
private
def resource_key
@resource_key = "#{ENV.fetch('SPARK_EXPORT_PATH')}/backfill/#{market_uid}_#{$backfill_date.strftime(FILE_DATE_FORMAT)}.json"
Rails.logger.info "===> Resource key #{@resource_key}"
@resource_key
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment