Skip to content

Commit

Permalink
Merge pull request #774 from NREL/dirtyexit
Browse files Browse the repository at this point in the history
catch out of disk space error and other unhandled errors
  • Loading branch information
brianlball authored Aug 8, 2024
2 parents 989bf8b + 9570daf commit afd56b5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions server/app/jobs/resque_jobs/run_simulate_data_point.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,15 @@ def self.perform(data_point_id, options = {})
msg = "SKIPPING #{data_point_id} since it is #{statuses[:status]} and #{statuses[:status_message]}"
d.add_to_rails_log(msg)
end
rescue Resque::TermException => e
rescue Errno::ENOSPC, Resque::DirtyExit, Resque::TermException, Resque::PruneDeadWorkerDirtyExit => e
# Log the termination and re-enqueue attempt
d.add_to_rails_log("Worker Caught TermException: #{e.inspect}: Re-enqueueing DataPoint ID #{data_point_id}")
d.add_to_rails_log("Worker Caught Exception: #{e.inspect}: Re-enqueueing DataPoint ID #{data_point_id}")
Resque.enqueue(self, data_point_id, options)
d.add_to_rails_log("DataPoint #{data_point_id} re-enqueued.")
rescue => e
d.add_to_rails_log("Worker Caught Unhandled Exception: #{e.message}: Re-enqueueing DataPoint ID #{data_point_id}")
Resque.enqueue(self, data_point_id, options)
d.add_to_rails_log("Unhandled exception, re-enqueued DataPoint.")
end
end
end

0 comments on commit afd56b5

Please sign in to comment.