Class: Que::View::DSL
- Inherits:
-
Object
- Object
- Que::View::DSL
- Defined in:
- lib/que/view/dsl.rb
Overview
rubocop: disable Metrics/ClassLength
Instance Method Summary collapse
- #delete_failing_jobs ⇒ Object
- #delete_job ⇒ Object
- #delete_scheduled_jobs ⇒ Object
- #fetch_dashboard_stats ⇒ Object
- #fetch_expired_jobs ⇒ Object
- #fetch_failing_jobs ⇒ Object
- #fetch_finished_jobs ⇒ Object
- #fetch_job ⇒ Object
- #fetch_job_names ⇒ Object
- #fetch_que_lockers ⇒ Object
- #fetch_queue_latencies(queue_names) ⇒ Object
- #fetch_queue_metrics ⇒ Object
- #fetch_queue_names ⇒ Object
- #fetch_running_jobs ⇒ Object
- #fetch_scheduled_jobs ⇒ Object
- #reschedule_failing_jobs(time) ⇒ Object
- #reschedule_job(job_id, time) ⇒ Object
- #reschedule_scheduled_jobs(time) ⇒ Object
Instance Method Details
#delete_failing_jobs ⇒ Object
62 63 64 |
# File 'lib/que/view/dsl.rb', line 62 def delete_failing_jobs execute(delete_jobs_sql(lock_failing_jobs_sql)) end |
#delete_job ⇒ Object
70 71 72 |
# File 'lib/que/view/dsl.rb', line 70 def delete_job(...) execute(delete_jobs_sql(lock_job_sql(...))) end |
#delete_scheduled_jobs ⇒ Object
66 67 68 |
# File 'lib/que/view/dsl.rb', line 66 def delete_scheduled_jobs execute(delete_jobs_sql(lock_scheduled_jobs_sql)) end |
#fetch_dashboard_stats ⇒ Object
7 8 9 |
# File 'lib/que/view/dsl.rb', line 7 def fetch_dashboard_stats execute(fetch_dashboard_stats_sql) end |
#fetch_expired_jobs ⇒ Object
54 55 56 |
# File 'lib/que/view/dsl.rb', line 54 def fetch_expired_jobs(...) execute(fetch_expired_jobs_sql(...)) end |
#fetch_failing_jobs ⇒ Object
42 43 44 |
# File 'lib/que/view/dsl.rb', line 42 def fetch_failing_jobs(...) execute(fetch_failing_jobs_sql(...)) end |
#fetch_finished_jobs ⇒ Object
50 51 52 |
# File 'lib/que/view/dsl.rb', line 50 def fetch_finished_jobs(...) execute(fetch_finished_jobs_sql(...)) end |
#fetch_job ⇒ Object
58 59 60 |
# File 'lib/que/view/dsl.rb', line 58 def fetch_job(...) execute(fetch_job_sql(...)) end |
#fetch_job_names ⇒ Object
32 33 34 35 36 |
# File 'lib/que/view/dsl.rb', line 32 def fetch_job_names(...) execute(fetch_job_names_sql(...)).map { |jobs_data| ["#{jobs_data[:job_name]} (#{jobs_data[:count_all]})", jobs_data[:job_name]] } end |
#fetch_que_lockers ⇒ Object
11 12 13 |
# File 'lib/que/view/dsl.rb', line 11 def fetch_que_lockers execute(fetch_que_lockers_sql) end |
#fetch_queue_latencies(queue_names) ⇒ Object
22 23 24 |
# File 'lib/que/view/dsl.rb', line 22 def fetch_queue_latencies(queue_names) queue_names.index_with { |queue_name| execute(fetch_queue_oldest_job_sql(queue_name)).dig(0, :enqueued_at) } end |
#fetch_queue_metrics ⇒ Object
15 16 17 18 19 20 |
# File 'lib/que/view/dsl.rb', line 15 def fetch_queue_metrics execute(fetch_queue_metrics_sql).each_with_object({}) { |element, acc| acc[element[:queue_name].to_sym] ||= basis_queue_stats acc[element[:queue_name].to_sym][element[:status].to_sym] = element[:count_all] } end |
#fetch_queue_names ⇒ Object
26 27 28 29 30 |
# File 'lib/que/view/dsl.rb', line 26 def fetch_queue_names execute(fetch_queue_names_sql).map { |queues_data| ["#{queues_data[:queue_name]} (#{queues_data[:count_all]})", queues_data[:queue_name]] } end |
#fetch_running_jobs ⇒ Object
38 39 40 |
# File 'lib/que/view/dsl.rb', line 38 def fetch_running_jobs Que.job_states end |
#fetch_scheduled_jobs ⇒ Object
46 47 48 |
# File 'lib/que/view/dsl.rb', line 46 def fetch_scheduled_jobs(...) execute(fetch_scheduled_jobs_sql(...)) end |
#reschedule_failing_jobs(time) ⇒ Object
78 79 80 |
# File 'lib/que/view/dsl.rb', line 78 def reschedule_failing_jobs(time) execute(reschedule_jobs_sql(lock_failing_jobs_sql, time)) end |
#reschedule_job(job_id, time) ⇒ Object
82 83 84 |
# File 'lib/que/view/dsl.rb', line 82 def reschedule_job(job_id, time) execute(reschedule_jobs_sql(lock_job_sql(job_id), time)) end |
#reschedule_scheduled_jobs(time) ⇒ Object
74 75 76 |
# File 'lib/que/view/dsl.rb', line 74 def reschedule_scheduled_jobs(time) execute(reschedule_jobs_sql(lock_scheduled_jobs_sql, time)) end |