Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feed imports log exceptions #91

Merged
merged 2 commits into from
May 29, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions app/workers/feed_eater_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,23 @@ def perform(feed_onestop_ids = [])
logger.info "5. Creating GTFS artifact: #{feed_onestop_id}"
run_python('./lib/feedeater/artifact.py', "--log #{log_file_path} #{feed_onestop_id}")
# TODO: upload GTFS artifact to S3
# what happens with a human-readable index.html?
rescue
logger.error $!
logger.error $!.backtrace
rescue Exception => e
# NOTE: we're catching all exceptions, including Interrupt, SignalException, and SyntaxError
exception_log = "\n#{e}\n#{e.backtrace}\n"
logger.error exception_log
feed_import.update(success: false)
Raven.capture_exception(e) if defined?(Raven)
else
feed.has_been_fetched_and_imported!(on_feed_import: feed_import)
ensure
# Report
if File.exist?(log_file_path)
import_log = File.open(log_file_path, 'r').read
else
import_log = nil
import_log = ''
end
if exception_log.present?
import_log << exception_log
end
if File.exist?(validation_report_path)
validation_report = File.open(validation_report_path, 'r').read
Expand Down