Class: DataMiner::Run
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- DataMiner::Run
- Includes:
- AASM
- Defined in:
- lib/data_miner/run.rb,
lib/data_miner/run/column_statistic.rb
Overview
A record of what happened when you ran a data miner script.
To create the table, use DataMiner::Run.auto_upgrade!
, possibly in db/seeds.rb
or a database migration.
Defined Under Namespace
Classes: ColumnStatistic, Skip
Constant Summary collapse
- INITIAL_STATE =
:limbo
Class Method Summary collapse
-
.clear_locks(model_names = DataMiner.model_names) ⇒ nil
If a previous run died and you have manually enabled locking, you may find yourself getting
LockMethod::Locked
exceptions.
Instance Method Summary collapse
-
#final_column_statistics(column_name) ⇒ ColumnStatistic
Get the column statistics for a particular column after this run finished.
-
#initial_column_statistics(column_name) ⇒ ColumnStatistic
Get the column statistics for a particular column before this run started.
Class Method Details
.clear_locks(model_names = DataMiner.model_names) ⇒ nil
Starting in 2.1.0, runs are no longer locked by default. This method remains in case you want to re-apply locking.
If a previous run died and you have manually enabled locking, you may find yourself getting LockMethod::Locked
exceptions.
24 25 26 27 28 29 30 31 32 |
# File 'lib/data_miner/run.rb', line 24 def clear_locks(model_names = DataMiner.model_names) return unless defined?(::LockMethod) model_names.each do |model_name| dummy = new dummy.model_name = model_name dummy.lock_method_clear :start end nil end |
Instance Method Details
#final_column_statistics(column_name) ⇒ ColumnStatistic
Get the column statistics for a particular column after this run finished.
128 129 130 |
# File 'lib/data_miner/run.rb', line 128 def final_column_statistics(column_name) column_statistics.where(:column_name => column_name.to_s).last end |
#initial_column_statistics(column_name) ⇒ ColumnStatistic
Get the column statistics for a particular column before this run started.
119 120 121 |
# File 'lib/data_miner/run.rb', line 119 def initial_column_statistics(column_name) column_statistics.where(:column_name => column_name.to_s).first end |