delayed_job_dashboard 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -32,7 +32,7 @@ Since the DJ Workers run in a completely different process, there is no practica
32
32
  connect to those threads and interupt them
33
33
  === Can I manipulate pending jobs?
34
34
  Until there's a practical security model for the dashboard, it won't facilitate being a backdoor for
35
- hackers to mess with your application. Until then, <tt>rails console</tt> is your fried.
35
+ hackers to mess with your application. Until then, <tt>rails console</tt> is your friend.
36
36
  === What do the states mean? DJ doesn't have those states...
37
37
  The dashboard tries to give a view into the different records in your delayed_jobs table
38
38
  * running: records with a "locked_by", indicating a worker has reserved it and it is running
@@ -8,39 +8,54 @@ class DelayedJobsController < ActionController::Base
8
8
  @job = Delayed::Job.find(params[:id])
9
9
  render :layout =>nil
10
10
  rescue ActiveRecord::RecordNotFound => rnf
11
- render :text =>"Not found, maybe it finished?"
12
- return
13
-
14
- #handle Exception => e
15
- # puts e
16
- #rescue
17
- # # render :text =>"Not found, maybe it finished?"
18
- # # return
11
+ render :text => "Not found, maybe it finished?"
19
12
  end
20
13
  end
21
14
  def counts
22
- @wip_counts = Delayed::Job.where("locked_by is not null").length
23
- @failing_counts = Delayed::Job.where("attempts > 1").length
24
- @overdue_counts = Delayed::Job.where("run_at < ?", Time.now).length
25
- @future_counts = Delayed::Job.where("run_at >= ?", Time.now).length
15
+ @wip_counts = wip_jobs.count
16
+ @failing_counts = failing_jobs.count
17
+ @overdue_counts = overdue_jobs.count
18
+ @future_counts = future_jobs.count
26
19
  end
27
20
 
28
21
  def wip
29
- @jobs = Delayed::Job.where("locked_by is not null")
22
+ @jobs = wip_jobs
30
23
  render :layout =>nil
31
24
  end
32
25
  def failing
33
- @jobs = Delayed::Job.where("attempts > 1")
26
+ @jobs = failing_jobs
34
27
  render :layout =>nil
35
-
36
28
  end
37
29
  def overdue
38
- @jobs = Delayed::Job.where("run_at < ?", Time.now)
30
+ @jobs = overdue_jobs
39
31
  render :layout =>nil
40
32
  end
41
33
  def future
42
- @jobs = Delayed::Job.where("run_at >= ?", Time.now)
34
+ @jobs = future_jobs
43
35
  render :layout =>nil
36
+ end
37
+
38
+ private
44
39
 
40
+ def wip_jobs
41
+ Delayed::Job.
42
+ where("locked_by is not null").
43
+ where("attempts < ?", Delayed::Worker.max_attempts)
44
+ end
45
+ def failing_jobs
46
+ Delayed::Job.
47
+ where("attempts >= 1").
48
+ where("locked_by is null").
49
+ where("failed_at is not null")
50
+ end
51
+ def overdue_jobs
52
+ Delayed::Job.
53
+ where("run_at < ?", Time.now).
54
+ where("locked_by is null").
55
+ where("failed_at is null")
56
+ end
57
+ def future_jobs
58
+ Delayed::Job.
59
+ where("run_at >= ?", Time.now)
45
60
  end
46
- end
61
+ end
@@ -4,6 +4,7 @@
4
4
  %table.label_top
5
5
  %thead
6
6
  %tr
7
+ %th Priority
7
8
  %th Name
8
9
  %th Attempts
9
10
  %th Run at
@@ -13,11 +14,10 @@
13
14
  %tbody
14
15
  - @jobs.each do |job|
15
16
  %tr
17
+ %td= job.priority
16
18
  %td= link_to "#{job.name} ##{job.id}", "javascript:open_job('#{delayed_job_dashboard.delayed_job_path(job)}')"
17
19
  %td
18
20
  = job.attempts
19
21
  %td= job.run_at
20
22
  %td= job.created_at
21
23
  %td= job.updated_at
22
-
23
-
@@ -4,6 +4,7 @@
4
4
  %table.label_top
5
5
  %thead
6
6
  %tr
7
+ %th Priority
7
8
  %th Name
8
9
  %th Run at
9
10
  %th created
@@ -11,6 +12,7 @@
11
12
  %tbody
12
13
  - @jobs.each do |job|
13
14
  %tr
15
+ %td= job.priority
14
16
  %td= link_to "#{job.name} ##{job.id}", "javascript:open_job('#{delayed_job_dashboard.delayed_job_path(job)}')"
15
17
  %td
16
18
  = job.run_at
@@ -18,5 +20,3 @@
18
20
  = time_ago_in_words(job.run_at)
19
21
  )
20
22
  %td= job.created_at
21
-
22
-
@@ -4,6 +4,7 @@
4
4
  %table.label_top
5
5
  %thead
6
6
  %tr
7
+ %th Priority
7
8
  %th Name
8
9
  %th Run at
9
10
  %th created
@@ -11,6 +12,7 @@
11
12
  %tbody
12
13
  - @jobs.each do |job|
13
14
  %tr
15
+ %td= job.priority
14
16
  %td= link_to "#{job.name} ##{job.id}", "javascript:open_job('#{delayed_job_dashboard.delayed_job_path(job)}')"
15
17
  %td
16
18
  = job.run_at
@@ -19,5 +21,3 @@
19
21
  ago
20
22
  )
21
23
  %td= job.created_at
22
-
23
-
@@ -6,6 +6,9 @@
6
6
  %tr
7
7
  %th Name
8
8
  %td= @job.name
9
+ %tr
10
+ %th Priority
11
+ %td= @job.priority
9
12
  %tr
10
13
  %th Attempts
11
14
  %td= @job.attempts
@@ -4,6 +4,7 @@
4
4
  %table.label_top
5
5
  %thead
6
6
  %tr
7
+ %th Priority
7
8
  %th Name
8
9
  %th Attempts
9
10
  %th Age
@@ -13,10 +14,10 @@
13
14
  %tbody
14
15
  - @jobs.each do |job|
15
16
  %tr
17
+ %td= job.priority
16
18
  %td= link_to "#{job.name} ##{job.id}", "javascript:open_job('#{delayed_job_dashboard.delayed_job_path(job)}')"
17
19
  %td
18
20
  = job.attempts
19
21
  %td= time_ago_in_words(job.locked_at)
20
22
  %td= job.locked_by
21
23
  %td= job.created_at
22
-
@@ -1,3 +1,3 @@
1
1
  module DelayedJobDashboard
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delayed_job_dashboard
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 1
10
- version: 0.2.1
9
+ - 2
10
+ version: 0.2.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Ben Johnson
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-11 00:00:00 Z
18
+ date: 2012-06-17 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rails
@@ -23,7 +23,7 @@ dependencies:
23
23
  requirement: &id001 !ruby/object:Gem::Requirement
24
24
  none: false
25
25
  requirements:
26
- - - ~>
26
+ - - ">="
27
27
  - !ruby/object:Gem::Version
28
28
  hash: 3
29
29
  segments:
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  requirements: []
169
169
 
170
170
  rubyforge_project:
171
- rubygems_version: 1.8.9
171
+ rubygems_version: 1.8.24
172
172
  signing_key:
173
173
  specification_version: 3
174
174
  summary: A dashboard for delayed_job.