Class: Que::View::DSL

Inherits:
Object
  • Object
show all
Defined in:
lib/que/view/dsl.rb

Overview

rubocop: disable Metrics/ClassLength

Instance Method Summary collapse

Instance Method Details

#delete_failing_jobsObject



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_jobObject



70
71
72
# File 'lib/que/view/dsl.rb', line 70

def delete_job(...)
  execute(delete_jobs_sql(lock_job_sql(...)))
end

#delete_scheduled_jobsObject



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_statsObject



7
8
9
# File 'lib/que/view/dsl.rb', line 7

def fetch_dashboard_stats
  execute(fetch_dashboard_stats_sql)
end

#fetch_expired_jobsObject



54
55
56
# File 'lib/que/view/dsl.rb', line 54

def fetch_expired_jobs(...)
  execute(fetch_expired_jobs_sql(...))
end

#fetch_failing_jobsObject



42
43
44
# File 'lib/que/view/dsl.rb', line 42

def fetch_failing_jobs(...)
  execute(fetch_failing_jobs_sql(...))
end

#fetch_finished_jobsObject



50
51
52
# File 'lib/que/view/dsl.rb', line 50

def fetch_finished_jobs(...)
  execute(fetch_finished_jobs_sql(...))
end

#fetch_jobObject



58
59
60
# File 'lib/que/view/dsl.rb', line 58

def fetch_job(...)
  execute(fetch_job_sql(...))
end

#fetch_job_namesObject



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_lockersObject



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_metricsObject



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_namesObject



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_jobsObject



38
39
40
# File 'lib/que/view/dsl.rb', line 38

def fetch_running_jobs
  Que.job_states
end

#fetch_scheduled_jobsObject



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