dj_mon 0.0.6 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +11 -6
- data/app/assets/javascripts/dj_mon.js +2 -2
- data/app/assets/stylesheets/dj_mon.css +6 -5
- data/app/controllers/dj_mon/dj_reports_controller.rb +4 -0
- data/app/models/dj_mon/dj_report.rb +20 -9
- data/app/views/dj_mon/dj_reports/index.html.haml +26 -27
- data/app/views/layouts/dj_mon.html.haml +51 -4
- data/config/routes.rb +1 -0
- metadata +1 -1
data/README.md
CHANGED
@@ -16,6 +16,9 @@ Or install it yourself as:
|
|
16
16
|
|
17
17
|
$ gem install dj_mon
|
18
18
|
|
19
|
+
## Note
|
20
|
+
Supports only `activerecord` for now.
|
21
|
+
|
19
22
|
## Usage
|
20
23
|
|
21
24
|
If you are using Rails =< 3.1, or if `config.assets.initialize_on_precompile` is set to false, then add this to `config/environments/production.rb`.
|
@@ -32,13 +35,15 @@ This uses http basic auth for authentication. Set the credentials in an initiali
|
|
32
35
|
YourApp::Application.config.dj_mon.password = "password"
|
33
36
|
|
34
37
|
If the credentials are not set, then the username and password are assumed to be the above mentioned.
|
35
|
-
|
38
|
+
|
36
39
|
Now visit `http://localhost:3000/dj_mon` and profit!
|
37
40
|
|
38
|
-
##
|
39
|
-
*
|
40
|
-
*
|
41
|
-
*
|
41
|
+
## Demo
|
42
|
+
* Source [DJ Mon](https://github.com/akshayrawat/dj_mon)
|
43
|
+
* URL: [Demo](http://dj-mon-demo.herokuapp.com/)
|
44
|
+
* Username: `dj_mon`
|
45
|
+
* Password: `password`
|
46
|
+
|
42
47
|
|
43
48
|
## ROADMAP
|
44
49
|
* Delete failed or queued jobs
|
@@ -53,4 +58,4 @@ Now visit `http://localhost:3000/dj_mon` and profit!
|
|
53
58
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
54
59
|
3. Commit your changes (`git commit -am 'Added some feature'`)
|
55
60
|
4. Push to the branch (`git push origin my-new-feature`)
|
56
|
-
5. Create new Pull Request
|
61
|
+
5. Create new Pull Request
|
@@ -29,8 +29,8 @@ $(function(){
|
|
29
29
|
});
|
30
30
|
|
31
31
|
$('a[rel=modal]').live('click', function(){
|
32
|
-
var template = $('
|
33
|
-
var output = Mustache.render(template, {
|
32
|
+
var template = $($(this).attr('href')).html();
|
33
|
+
var output = Mustache.render(template, { content: $(this).data('content') });
|
34
34
|
$(output).appendTo($('body')).show();
|
35
35
|
});
|
36
36
|
|
@@ -4,16 +4,16 @@ body {
|
|
4
4
|
padding: 90px;
|
5
5
|
}
|
6
6
|
|
7
|
-
table
|
7
|
+
table#jobs-table td, table#jobs-table th {
|
8
8
|
text-align: center;
|
9
9
|
}
|
10
10
|
|
11
|
-
table
|
11
|
+
table#jobs-table td.date, table#jobs-table th.date {
|
12
12
|
text-align: left;
|
13
13
|
}
|
14
14
|
|
15
|
-
table
|
16
|
-
font-size:
|
15
|
+
table#jobs-table td.date {
|
16
|
+
font-size: 80%;
|
17
17
|
}
|
18
18
|
|
19
19
|
.centered {
|
@@ -24,6 +24,7 @@ code.block {
|
|
24
24
|
display: block;
|
25
25
|
word-wrap: break-word;
|
26
26
|
}
|
27
|
+
|
27
28
|
#dj-counts-view {
|
28
29
|
position: relative;
|
29
30
|
top: 12px;
|
@@ -33,4 +34,4 @@ code.block {
|
|
33
34
|
#dj-counts-view .badge {
|
34
35
|
float: right;
|
35
36
|
margin: 0 2px;
|
36
|
-
}
|
37
|
+
}
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module DjMon
|
2
2
|
class DjReport
|
3
|
+
|
3
4
|
attr_accessor :delayed_job
|
4
|
-
|
5
|
+
|
5
6
|
def initialize delayed_job
|
6
7
|
self.delayed_job = delayed_job
|
7
8
|
end
|
@@ -12,12 +13,12 @@ module DjMon
|
|
12
13
|
payload: delayed_job.payload_object.object.to_yaml,
|
13
14
|
priority: delayed_job.priority,
|
14
15
|
attempts: delayed_job.attempts,
|
15
|
-
queue: delayed_job.queue,
|
16
|
+
queue: delayed_job.queue || "global",
|
16
17
|
last_error_summary: delayed_job.last_error.to_s.truncate(30),
|
17
18
|
last_error: delayed_job.last_error,
|
18
|
-
failed_at:
|
19
|
-
run_at:
|
20
|
-
created_at:
|
19
|
+
failed_at: l_datetime(delayed_job.failed_at),
|
20
|
+
run_at: l_datetime(delayed_job.run_at),
|
21
|
+
created_at: l_datetime(delayed_job.created_at)
|
21
22
|
}
|
22
23
|
end
|
23
24
|
|
@@ -32,7 +33,7 @@ module DjMon
|
|
32
33
|
end
|
33
34
|
|
34
35
|
def active
|
35
|
-
Delayed::Job.where('delayed_jobs.locked_by IS NOT NULL')
|
36
|
+
Delayed::Job.where('delayed_jobs.failed_at IS NULL AND delayed_jobs.locked_by IS NOT NULL')
|
36
37
|
end
|
37
38
|
|
38
39
|
def queued
|
@@ -67,12 +68,22 @@ module DjMon
|
|
67
68
|
}
|
68
69
|
end
|
69
70
|
|
71
|
+
def settings
|
72
|
+
{
|
73
|
+
destroy_failed_jobs: Delayed::Worker.destroy_failed_jobs,
|
74
|
+
sleep_delay: Delayed::Worker.sleep_delay,
|
75
|
+
max_attempts: Delayed::Worker.max_attempts,
|
76
|
+
max_run_time: Delayed::Worker.max_run_time,
|
77
|
+
read_ahead: Delayed::Worker.read_ahead,
|
78
|
+
delay_jobs: Delayed::Worker.delay_jobs
|
79
|
+
}
|
80
|
+
end
|
70
81
|
end
|
71
82
|
|
72
83
|
private
|
73
|
-
|
74
|
-
def l_date date
|
84
|
+
def l_datetime date
|
75
85
|
date.present? ? I18n.l(date) : ""
|
76
86
|
end
|
77
87
|
end
|
78
|
-
|
88
|
+
|
89
|
+
end
|
@@ -1,34 +1,32 @@
|
|
1
|
-
%
|
2
|
-
|
3
|
-
.
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
%li
|
12
|
-
= link_to "Active", "#active", "data-toggle" => "tab"
|
1
|
+
%p.lead Delayed Jobs
|
2
|
+
%ul.nav.nav-tabs
|
3
|
+
%li.active
|
4
|
+
= link_to "All", "#all", "data-toggle" => "tab"
|
5
|
+
%li
|
6
|
+
= link_to "Failed", "#failed", "data-toggle" => "tab"
|
7
|
+
%li
|
8
|
+
= link_to "Queued", "#queued", "data-toggle" => "tab"
|
9
|
+
%li
|
10
|
+
= link_to "Active", "#active", "data-toggle" => "tab"
|
13
11
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
12
|
+
.tab-content
|
13
|
+
.tab-pane#all.active{ 'data-url' => all_dj_reports_url }
|
14
|
+
.tab-pane#failed{ 'data-url'=> failed_dj_reports_url }
|
15
|
+
.tab-pane#active{ 'data-url'=> active_dj_reports_url }
|
16
|
+
.tab-pane#queued{ 'data-url'=> queued_dj_reports_url }
|
19
17
|
|
20
18
|
%script#dj_reports_template{ :type=> "text/x-handlebars-template" }
|
21
|
-
%table.table.table-striped
|
19
|
+
%table.table.table-striped#jobs-table
|
22
20
|
%thead
|
23
21
|
%tr
|
22
|
+
%th
|
23
|
+
Queue
|
24
24
|
%th
|
25
25
|
ID
|
26
26
|
%th
|
27
27
|
Priority
|
28
28
|
%th
|
29
29
|
Attempts
|
30
|
-
%th
|
31
|
-
Queue
|
32
30
|
%th
|
33
31
|
Last Error
|
34
32
|
%th.date
|
@@ -40,6 +38,9 @@
|
|
40
38
|
%tbody
|
41
39
|
{{#.}}
|
42
40
|
%tr
|
41
|
+
%td
|
42
|
+
.label.label-info
|
43
|
+
{{queue}}
|
43
44
|
%td
|
44
45
|
<a href="#" data-content="<code class='block'>{{payload}}</code>" rel='popover' title='Payload'> {{id}} </a>
|
45
46
|
%td
|
@@ -47,19 +48,17 @@
|
|
47
48
|
%td
|
48
49
|
{{attempts}}
|
49
50
|
%td
|
50
|
-
{{
|
51
|
-
%td
|
52
|
-
<a href="#" data-content="{{last_error}}" rel='modal' title='Last Error'> {{last_error_summary}} </a>
|
51
|
+
<a href="#last_error_template" data-content="{{last_error}}" rel='modal' title='Last Error'> {{last_error_summary}} </a>
|
53
52
|
%td.date
|
54
53
|
{{failed_at}}
|
55
54
|
%td.date
|
56
|
-
{{
|
55
|
+
{{run_at}}
|
57
56
|
%td.date
|
58
57
|
{{created_at}}
|
59
58
|
{{/.}}
|
60
59
|
|
61
60
|
%script#last_error_template{ :type=> "text/x-handlebars-template" }
|
62
|
-
.modal.hide
|
61
|
+
.modal.hide
|
63
62
|
.modal-header
|
64
63
|
%button{ type: "button", class: "close", 'data-dismiss' => "modal" }
|
65
64
|
×
|
@@ -67,6 +66,6 @@
|
|
67
66
|
Last Error
|
68
67
|
.modal-body
|
69
68
|
%code
|
70
|
-
{{
|
69
|
+
{{content}}
|
71
70
|
.modal-footer
|
72
|
-
= link_to "Close", '#', class: 'btn btn-primary', 'data-dismiss'=> 'modal'
|
71
|
+
= link_to "Close", '#', class: 'btn btn-primary', 'data-dismiss'=> 'modal'
|
@@ -11,6 +11,9 @@
|
|
11
11
|
.container
|
12
12
|
.pull-left
|
13
13
|
= link_to "DJ Mon", dj_reports_url, class: "brand"
|
14
|
+
.pull-right
|
15
|
+
= link_to "Settings", "#dj_settings_template", rel: 'modal', 'data-content'=> "#{DjMon::DjReport.settings.to_json}", id: 'settings', class: 'btn btn-primary btn-mini'
|
16
|
+
|
14
17
|
.pull-right
|
15
18
|
#dj-counts-view
|
16
19
|
|
@@ -21,9 +24,53 @@
|
|
21
24
|
= javascript_include_tag "dj_mon.js"
|
22
25
|
|
23
26
|
%script#dj_counts_template{ :type=> "text/x-handlebars-template" }
|
24
|
-
%span.badge
|
25
|
-
{{active}} active
|
26
|
-
%span.badge.badge-info
|
27
|
+
%span.badge
|
27
28
|
{{queued}} queued
|
28
|
-
%span.badge.badge-
|
29
|
+
%span.badge.badge-info
|
30
|
+
{{active}} active
|
31
|
+
%span.badge.badge-warning
|
29
32
|
{{failed}} failed
|
33
|
+
|
34
|
+
%script#dj_settings_template{ :type=> "text/x-handlebars-template" }
|
35
|
+
.modal.hide
|
36
|
+
.modal-header
|
37
|
+
%button{ type: "button", class: "close", 'data-dismiss' => "modal" }
|
38
|
+
×
|
39
|
+
%h3
|
40
|
+
Delayed Job Settings
|
41
|
+
.modal-body
|
42
|
+
%table.table.table-bordered.table-striped
|
43
|
+
%tr
|
44
|
+
%td
|
45
|
+
Destroy failed jobs:
|
46
|
+
%td
|
47
|
+
<code>{{content.destroy_failed_jobs}}</code>
|
48
|
+
%tr
|
49
|
+
%td
|
50
|
+
Sleep delay:
|
51
|
+
%td
|
52
|
+
<code>{{content.sleep_delay}}</code> seconds
|
53
|
+
%tr
|
54
|
+
%td
|
55
|
+
Max attempts:
|
56
|
+
%td
|
57
|
+
<code>{{content.max_attempts}}</code>
|
58
|
+
%tr
|
59
|
+
%td
|
60
|
+
Max run time:
|
61
|
+
%td
|
62
|
+
<code>{{content.max_run_time}}</code> seconds
|
63
|
+
%tr
|
64
|
+
%td
|
65
|
+
Read ahead:
|
66
|
+
%td
|
67
|
+
<code>{{content.read_ahead}}</code>
|
68
|
+
%tr
|
69
|
+
%td
|
70
|
+
Delay Jobs:
|
71
|
+
%td
|
72
|
+
<code>{{content.delay_jobs}}</code>
|
73
|
+
|
74
|
+
.modal-footer
|
75
|
+
= link_to "Close", '#', class: 'btn btn-primary', 'data-dismiss'=> 'modal'
|
76
|
+
|
data/config/routes.rb
CHANGED