Skip to content

Instantly share code, notes, and snippets.

@madmax
Created October 6, 2011 12:43
Show Gist options
  • Save madmax/1267308 to your computer and use it in GitHub Desktop.
Save madmax/1267308 to your computer and use it in GitHub Desktop.
class TopicWorker < Resque::JobWithStatus
#extend Resque::Plugins::Retry
#@retry_limit = 0
#@retry_delay = 60
@queue = :low
attr_accessor :options
def perform
self.options = options.reverse_merge(:until_time => Time.current).symbolize_keys
self.options[:since_time] = options[:since_time].to_time
self.options[:until_time] = options[:until_time].to_time
setup_logger
extract
after_extract
transform
after_transform
load
after_load
after_perform
end
def setup_logger
Rails.logger = Resque::Logger.new("#{Rails.root}/log/etl.log", self)
end
def extract
end
def transform
end
def load
end
def after_extract
TopicEvent.trigger(:after_extract, options)
end
def after_transform
TopicEvent.trigger(:after_transform, options)
end
def after_load
TopicEvent.trigger(:after_load, options)
end
def after_perform
TopicEvent.trigger(:after_perform, options)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment