Exception: DataMiner::Run::Skip

Inherits:
Exception
  • Object
show all
Defined in:
lib/data_miner/run.rb

Overview

Raise this exception to skip the current run without causing it to fail.

Examples:

Avoid running certain data miner scripts too often (because they take too long).

class FlightSegment < ActiveRecord::Base
  data_miner do
    [...]
    process "don't run this more than once an hour" do
      if (last_ran_at = data_miner_runs.first(:order => 'created_at DESC').try(:created_at)) and (Time.now.utc - last_ran_at) < 3600
        raise DataMiner::Run::Skip
      end
    end
    [...]
  end
end