Module: InstDataShipper

Defined in:
lib/inst_data_shipper.rb,
lib/inst_data_shipper/dumper.rb,
lib/inst_data_shipper/engine.rb,
lib/inst_data_shipper/record.rb,
lib/inst_data_shipper/version.rb,
lib/inst_data_shipper/jobs/base.rb,
lib/inst_data_shipper/basic_dumper.rb,
lib/inst_data_shipper/concerns/hooks.rb,
lib/inst_data_shipper/schema_builder.rb,
lib/inst_data_shipper/destinations/s3.rb,
app/models/inst_data_shipper/dump_batch.rb,
lib/inst_data_shipper/data_sources/base.rb,
lib/inst_data_shipper/destinations/base.rb,
lib/inst_data_shipper/jobs/async_caller.rb,
lib/inst_data_shipper/destinations/speccable.rb,
lib/inst_data_shipper/destinations/hosted_data.rb,
lib/inst_data_shipper/data_sources/local_tables.rb,
lib/inst_data_shipper/data_sources/canvas_reports.rb,
lib/inst_data_shipper/destinations/concerns/chunking.rb

Defined Under Namespace

Modules: DataSources, Destinations, Hooks, Jobs, Record Classes: BasicDumper, DumpBatch, Dumper, Engine, SchemaBuilder

Constant Summary collapse

VERSION =
"0.2.3".freeze

Class Method Summary collapse

Class Method Details

.alias_destination(from, to) ⇒ Object



10
11
12
13
# File 'lib/inst_data_shipper.rb', line 10

def alias_destination(from, to)
  @destination_aliases ||= {}
  @destination_aliases[from.to_s] = to.to_s
end

.handle_suppressed_error(ex) ⇒ Object



33
34
35
36
37
38
# File 'lib/inst_data_shipper.rb', line 33

def handle_suppressed_error(ex)
  logger.error "Suppressed Error: #{ex.message}"
  logger.error ex.backtrace.join("\n")
  Raven.capture_exception(ex) if defined?(Raven)
  Sentry.capture_exception(ex) if defined?(Sentry)
end

.loggerObject



40
41
42
43
44
45
46
# File 'lib/inst_data_shipper.rb', line 40

def logger
  return @logger if defined? @logger
  # TODO Annotate logs with DumpBatch ID
  @logger = Logger.new(STDOUT)
  @logger.level = Logger::DEBUG
  @logger
end

.redis(*args, &blk) ⇒ Object



48
49
50
# File 'lib/inst_data_shipper.rb', line 48

def redis(*args, &blk)
  CanvasSync::JobBatches::Batch.redis(*args, &blk)
end

.redis_prefixObject



52
53
54
55
56
# File 'lib/inst_data_shipper.rb', line 52

def redis_prefix
  pfx = "ids"
  pfx = "#{Apartment::Tenant.current}:#{pfx}" if defined?(Apartment)
  pfx
end

.resolve_destination(destination) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/inst_data_shipper.rb', line 15

def resolve_destination(destination)
  return destination if destination.is_a?(Class)

  if destination.is_a?(String) && destination.include?("://")
    type, rest = destination.split("://", 2)
    destination = @destination_aliases[type]
  elsif destination.is_a?(Hash)
    type = destination[:type] || destination["type"]
    destination = @destination_aliases[type]
  end

  destination.constantize
end

.start_basic_dump(*args, **kwargs, &block) ⇒ Object



29
30
31
# File 'lib/inst_data_shipper.rb', line 29

def start_basic_dump(*args, **kwargs, &block)
  BasicDumper.perform_dump(*args, **kwargs, &block)
end