Class: BulkImports::Tracker

Inherits:
ApplicationRecord show all
Defined in:
app/models/bulk_imports/tracker.rb

Constant Summary collapse

DEFAULT_PAGE_SIZE =
500

Constants inherited from ApplicationRecord

ApplicationRecord::MAX_PLUCK

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationRecord

cached_column_list, #create_or_load_association, declarative_enum, default_select_columns, id_in, id_not_in, iid_in, pluck_primary_key, primary_key_in, #readable_by?, safe_ensure_unique, safe_find_or_create_by, safe_find_or_create_by!, #to_ability_name, underscore, where_exists, where_not_exists, with_fast_read_statement_timeout, without_order

Methods included from SensitiveSerializableHash

#serializable_hash

Class Method Details

.stage_running?(entity_id, stage) ⇒ Boolean

Returns:

  • (Boolean)

30
31
32
33
34
# File 'app/models/bulk_imports/tracker.rb', line 30

def self.stage_running?(entity_id, stage)
  where(stage: stage, bulk_import_entity_id: entity_id)
    .with_status(:created, :enqueued, :started)
    .exists?
end

Instance Method Details

#pipeline_classObject


36
37
38
39
40
41
42
# File 'app/models/bulk_imports/tracker.rb', line 36

def pipeline_class
  unless entity.pipeline_exists?(pipeline_name)
    raise BulkImports::Error, "'#{pipeline_name}' is not a valid BulkImport Pipeline"
  end

  pipeline_name.constantize
end