Class: Dunlop::ExecutionBatch
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Loggable
#log_state_transition, #logger, #with_nested_logger, #with_nested_logger_and_catch_failed
truncate
Class Method Details
.batch_pid_id ⇒ Object
26
27
28
|
# File 'app/models/dunlop/execution_batch.rb', line 26
def batch_pid_id
:global
end
|
.cleanup ⇒ Object
62
63
64
|
# File 'app/models/dunlop/execution_batch.rb', line 62
def cleanup
where("created_at < ?", 1.month.ago).destroy_all
end
|
.exection_required? ⇒ Boolean
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'app/models/dunlop/execution_batch.rb', line 38
def exection_required?
true
end
|
.execute_if_required ⇒ Object
34
35
36
|
# File 'app/models/dunlop/execution_batch.rb', line 34
def execute_if_required
execute if exection_required?
end
|
.latest ⇒ Object
30
31
32
|
# File 'app/models/dunlop/execution_batch.rb', line 30
def latest
where(state: :completed).order(identifier: :desc).order(created_at: :desc).first
end
|
Instance Method Details
#execute_process(options = {}) ⇒ Object
13
14
15
16
17
18
19
|
# File 'app/models/dunlop/execution_batch.rb', line 13
def execute_process(options={})
with_nested_logger_and_catch_failed do
processing!
logger.benchmark { process_steps }
completed!
end
end
|
#process_steps ⇒ Object
21
22
23
|
# File 'app/models/dunlop/execution_batch.rb', line 21
def process_steps
raise ImplementInSubclass.new(self)
end
|