resque-job_history 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +28 -0
- data/lib/resque-job_history.rb +7 -0
- data/lib/resque/job_history_server.rb +189 -0
- data/lib/resque/plugins/job_history.rb +63 -0
- data/lib/resque/plugins/job_history/cleaner.rb +92 -0
- data/lib/resque/plugins/job_history/history_base.rb +61 -0
- data/lib/resque/plugins/job_history/history_list.rb +88 -0
- data/lib/resque/plugins/job_history/job.rb +144 -0
- data/lib/resque/plugins/job_history/job_list.rb +90 -0
- data/lib/resque/plugins/version.rb +7 -0
- data/lib/resque/server/public/job_history.css +29 -0
- data/lib/resque/server/views/_job_class_pagination.erb +67 -0
- data/lib/resque/server/views/_job_pagination.erb +71 -0
- data/lib/resque/server/views/_jobs_list.erb +55 -0
- data/lib/resque/server/views/job_class_details.erb +98 -0
- data/lib/resque/server/views/job_details.erb +74 -0
- data/lib/resque/server/views/job_history.erb +114 -0
- data/lib/tasks/resque-job_history_tasks.rake +4 -0
- metadata +148 -0
@@ -0,0 +1,55 @@
|
|
1
|
+
<% if history_list.num_jobs > 0 %>
|
2
|
+
<h1><%= description %></h1>
|
3
|
+
|
4
|
+
<% jobs = history_list.paged_jobs(page_num, page_size) %>
|
5
|
+
<%= erb(File.read(Resque::JobHistoryServer.erb_path("_job_pagination.erb")),
|
6
|
+
locals: { history_list: history_list,
|
7
|
+
class_name: class_name,
|
8
|
+
page_num: page_num,
|
9
|
+
page_size: page_size,
|
10
|
+
primary_type: primary_type,
|
11
|
+
secondary_type: secondary_type,
|
12
|
+
secondary_page_num: secondary_page_num,
|
13
|
+
secondary_page_size: secondary_page_size }) %>
|
14
|
+
|
15
|
+
<table>
|
16
|
+
<tr>
|
17
|
+
<th>Started</th>
|
18
|
+
<th>Duration</th>
|
19
|
+
<th>Parameters</th>
|
20
|
+
<th>Error</th>
|
21
|
+
</tr>
|
22
|
+
<% jobs.each do |job_details| %>
|
23
|
+
<tr>
|
24
|
+
<td>
|
25
|
+
<a href="job_details?class_name=<%= job_details.class_name %>&job_id=<%= job_details.job_id %>">
|
26
|
+
<%= time_ago_in_words(job_details.start_time) %> ago
|
27
|
+
(<%= job_details.start_time %>)
|
28
|
+
</a>
|
29
|
+
</td>
|
30
|
+
<td>
|
31
|
+
<%= distance_of_time_in_words(job_details.start_time, (job_details.end_time || Time.now)) %>
|
32
|
+
<% if job_details.finished? %>
|
33
|
+
(<%= job_details.end_time %>)
|
34
|
+
<% end %>
|
35
|
+
</td>
|
36
|
+
<td>
|
37
|
+
<pre><code><%= "".html_safe + job_details.args.to_yaml %></code></pre>
|
38
|
+
</td>
|
39
|
+
<td>
|
40
|
+
<%= job_details.error %>
|
41
|
+
</td>
|
42
|
+
</tr>
|
43
|
+
<% end %>
|
44
|
+
</table>
|
45
|
+
|
46
|
+
<%= erb(File.read(Resque::JobHistoryServer.erb_path("_job_pagination.erb")),
|
47
|
+
locals: { history_list: history_list,
|
48
|
+
class_name: class_name,
|
49
|
+
page_num: page_num,
|
50
|
+
page_size: page_size,
|
51
|
+
primary_type: primary_type,
|
52
|
+
secondary_type: secondary_type,
|
53
|
+
secondary_page_num: secondary_page_num,
|
54
|
+
secondary_page_size: secondary_page_size }) %>
|
55
|
+
<% end %>
|
@@ -0,0 +1,98 @@
|
|
1
|
+
<link href="job_history/public/job_history.css" media="screen" rel="stylesheet" type="text/css">
|
2
|
+
|
3
|
+
<h1><%= @job_class_name %></h1>
|
4
|
+
|
5
|
+
<% job_list = Resque::Plugins::JobHistory::JobList.new %>
|
6
|
+
<% history = Resque::Plugins::JobHistory::HistoryBase.new(@job_class_name) %>
|
7
|
+
<% class_info = job_list.job_class_summary(@job_class_name) %>
|
8
|
+
|
9
|
+
<a href="<%= u("job history") %>">
|
10
|
+
Job History
|
11
|
+
</a>
|
12
|
+
|
13
|
+
<table>
|
14
|
+
<tr>
|
15
|
+
<td>
|
16
|
+
Running jobs
|
17
|
+
</td>
|
18
|
+
<td>
|
19
|
+
<%= class_info[:running_jobs].to_i %>
|
20
|
+
</td>
|
21
|
+
</tr>
|
22
|
+
<tr>
|
23
|
+
<td>
|
24
|
+
Total jobs run
|
25
|
+
</td>
|
26
|
+
<td>
|
27
|
+
<%= class_info[:total_run_jobs].to_i %>
|
28
|
+
</td>
|
29
|
+
</tr>
|
30
|
+
<tr>
|
31
|
+
<td>
|
32
|
+
Total jobs finished
|
33
|
+
</td>
|
34
|
+
<td>
|
35
|
+
<%= class_info[:total_finished_jobs].to_i %>
|
36
|
+
</td>
|
37
|
+
</tr>
|
38
|
+
<tr>
|
39
|
+
<td>
|
40
|
+
Total jobs in history
|
41
|
+
</td>
|
42
|
+
<td>
|
43
|
+
<%= class_info[:finished_jobs].to_i %>
|
44
|
+
</td>
|
45
|
+
</tr>
|
46
|
+
<tr>
|
47
|
+
<td>
|
48
|
+
Maximum number of consecutive jobs seen
|
49
|
+
</td>
|
50
|
+
<td>
|
51
|
+
<%= class_info[:max_running_jobs].to_i %>
|
52
|
+
</td>
|
53
|
+
</tr>
|
54
|
+
<tr>
|
55
|
+
<td>
|
56
|
+
Is still valid job
|
57
|
+
</td>
|
58
|
+
<td>
|
59
|
+
<%= class_info[:class_name_valid] %>
|
60
|
+
</td>
|
61
|
+
</tr>
|
62
|
+
</table>
|
63
|
+
|
64
|
+
<%=
|
65
|
+
erb(
|
66
|
+
File.read(Resque::JobHistoryServer.erb_path("_jobs_list.erb")),
|
67
|
+
locals: { history_list: history.running_list,
|
68
|
+
description: "Running Jobs",
|
69
|
+
class_name: @job_class_name,
|
70
|
+
page_num: @running_page_num,
|
71
|
+
page_size: @running_page_size,
|
72
|
+
primary_type: "running",
|
73
|
+
secondary_type: "finished",
|
74
|
+
secondary_page_num: @finished_page_num,
|
75
|
+
secondary_page_size: @finished_page_size }
|
76
|
+
)
|
77
|
+
%>
|
78
|
+
|
79
|
+
<%=
|
80
|
+
erb(
|
81
|
+
File.read(Resque::JobHistoryServer.erb_path("_jobs_list.erb")),
|
82
|
+
locals: { history_list: history.finished_list,
|
83
|
+
description: "Finished Jobs",
|
84
|
+
class_name: @job_class_name,
|
85
|
+
page_num: @finished_page_num,
|
86
|
+
page_size: @finished_page_size,
|
87
|
+
primary_type: "finished",
|
88
|
+
secondary_type: "running",
|
89
|
+
secondary_page_num: @running_page_num,
|
90
|
+
secondary_page_size: @running_page_size }
|
91
|
+
)
|
92
|
+
%>
|
93
|
+
|
94
|
+
<br/>
|
95
|
+
|
96
|
+
<form method="POST" action="purge_class?<%= { class_name: @job_class_name }.to_param %>">
|
97
|
+
<input type="submit" name="" value="Purge all histories for <%= @job_class_name %>"/>
|
98
|
+
</form>
|
@@ -0,0 +1,74 @@
|
|
1
|
+
<link href="job_history/public/job_history.css" media="screen" rel="stylesheet" type="text/css">
|
2
|
+
|
3
|
+
<h1>
|
4
|
+
<%= @job_class_name %>
|
5
|
+
</h1>
|
6
|
+
|
7
|
+
<% job_details = Resque::Plugins::JobHistory::Job.new(@job_class_name, @job_id) %>
|
8
|
+
|
9
|
+
<a href="<%= u("job history") %>">
|
10
|
+
Job History
|
11
|
+
</a>
|
12
|
+
|
|
13
|
+
<a href="job_class_details?<%= { class_name: @job_class_name }.to_param %>">
|
14
|
+
<%= @job_class_name %>
|
15
|
+
</a>
|
16
|
+
|
17
|
+
<table>
|
18
|
+
<tr>
|
19
|
+
<td>
|
20
|
+
Started
|
21
|
+
</td>
|
22
|
+
<td>
|
23
|
+
<%= time_ago_in_words(job_details.start_time) %> ago
|
24
|
+
(<%= job_details.start_time %>)
|
25
|
+
</td>
|
26
|
+
</tr>
|
27
|
+
<tr>
|
28
|
+
<td>
|
29
|
+
Duration
|
30
|
+
</td>
|
31
|
+
<td>
|
32
|
+
<%= distance_of_time_in_words(job_details.start_time, (job_details.end_time || Time.now)) %>
|
33
|
+
<% if job_details.finished? %>
|
34
|
+
(<%= job_details.end_time %>)
|
35
|
+
<% end %>
|
36
|
+
</td>
|
37
|
+
</tr>
|
38
|
+
<tr>
|
39
|
+
<td>
|
40
|
+
Params
|
41
|
+
</td>
|
42
|
+
<td>
|
43
|
+
<pre><code><%= "".html_safe + job_details.args.to_yaml %></code></pre>
|
44
|
+
</td>
|
45
|
+
</tr>
|
46
|
+
<% unless job_details.succeeded? %>
|
47
|
+
<tr>
|
48
|
+
<td>
|
49
|
+
Error
|
50
|
+
</td>
|
51
|
+
<td>
|
52
|
+
<%= job_details.error %>
|
53
|
+
</td>
|
54
|
+
</tr>
|
55
|
+
<% end %>
|
56
|
+
</table>
|
57
|
+
|
58
|
+
<br/>
|
59
|
+
|
60
|
+
<% unless job_details.finished? %>
|
61
|
+
<form method="POST" action="cancel_job?<%= { class_name: @job_class_name, job_id: @job_id }.to_param %>">
|
62
|
+
<input type="submit" name="" value="Job is not running - Cancel job"/>
|
63
|
+
</form>
|
64
|
+
<% end %>
|
65
|
+
|
66
|
+
<form method="POST" action="delete_job?<%= { class_name: @job_class_name, job_id: @job_id }.to_param %>">
|
67
|
+
<input type="submit" name="" value="Delete this run"/>
|
68
|
+
</form>
|
69
|
+
|
70
|
+
<% if Resque::Plugins::JobHistory::HistoryBase.new(@job_class_name).class_name_valid?() %>
|
71
|
+
<form method="POST" action="retry_job?<%= { class_name: @job_class_name, job_id: @job_id }.to_param %>">
|
72
|
+
<input type="submit" name="" value="Retry this run"/>
|
73
|
+
</form>
|
74
|
+
<% end %>
|
@@ -0,0 +1,114 @@
|
|
1
|
+
<link href="job_history/public/job_history.css" media="screen" rel="stylesheet" type="text/css">
|
2
|
+
|
3
|
+
<h1>Job Classes</h1>
|
4
|
+
|
5
|
+
<% job_list = Resque::Plugins::JobHistory::JobList.new %>
|
6
|
+
<%= erb(File.read(Resque::JobHistoryServer.erb_path("_job_class_pagination.erb")),
|
7
|
+
locals: { job_list: job_list, page_num: @page_num, page_size: @page_size }) %>
|
8
|
+
|
9
|
+
<table>
|
10
|
+
<tr>
|
11
|
+
<th><a href="job%20history?<%= { sort: "class_name",
|
12
|
+
page_size: @page_size,
|
13
|
+
page_num: @page_num,
|
14
|
+
order: job_list.
|
15
|
+
order_param("class_name", @sort_by, @sort_order) }.to_param %>">
|
16
|
+
Class name
|
17
|
+
</a></th>
|
18
|
+
<th><a href="job%20history?<%= { sort: "running_jobs",
|
19
|
+
page_size: @page_size,
|
20
|
+
page_num: @page_num,
|
21
|
+
order: job_list.
|
22
|
+
order_param("running_jobs", @sort_by, @sort_order) }.to_param %>">
|
23
|
+
Running
|
24
|
+
</a></th>
|
25
|
+
<th><a href="job%20history?<%= { sort: "total_finished_jobs",
|
26
|
+
page_size: @page_size,
|
27
|
+
page_num: @page_num,
|
28
|
+
order: job_list.
|
29
|
+
order_param("total_finished_jobs", @sort_by, @sort_order) }.to_param %>">
|
30
|
+
Finished
|
31
|
+
</a></th>
|
32
|
+
<th><a href="job%20history?<%= { sort: "max_running_jobs",
|
33
|
+
page_size: @page_size,
|
34
|
+
page_num: @page_num,
|
35
|
+
order: job_list.
|
36
|
+
order_param("max_running_jobs", @sort_by, @sort_order) }.to_param %>">
|
37
|
+
Max Running
|
38
|
+
</a></th>
|
39
|
+
<th><a href="job%20history?<%= { sort: "start_time",
|
40
|
+
page_size: @page_size,
|
41
|
+
page_num: @page_num,
|
42
|
+
order: job_list.
|
43
|
+
order_param("start_time", @sort_by, @sort_order) }.to_param %>">
|
44
|
+
Last Run Start
|
45
|
+
</a></th>
|
46
|
+
<th><a href="job%20history?<%= { sort: "durration",
|
47
|
+
page_size: @page_size,
|
48
|
+
page_num: @page_num,
|
49
|
+
order: job_list.
|
50
|
+
order_param("durration", @sort_by, @sort_order) }.to_param %>">
|
51
|
+
Last Run Duration
|
52
|
+
</a></th>
|
53
|
+
<th><a href="job%20history?<%= { sort: "success",
|
54
|
+
page_size: @page_size,
|
55
|
+
page_num: @page_num,
|
56
|
+
order: job_list.
|
57
|
+
order_param("success", @sort_by, @sort_order) }.to_param %>">
|
58
|
+
Last Run successful
|
59
|
+
</a></th>
|
60
|
+
</tr>
|
61
|
+
|
62
|
+
<% job_list.job_summaries(@sort_by, @sort_order, @page_num, @page_size).each do |class_info| %>
|
63
|
+
<tr>
|
64
|
+
<td>
|
65
|
+
<a href="job%20history/job_class_details?class_name=<%= class_info[:class_name] %>">
|
66
|
+
<%= class_info[:class_name] %>
|
67
|
+
</a>
|
68
|
+
</td>
|
69
|
+
<td>
|
70
|
+
<%= class_info[:running_jobs].to_i %>
|
71
|
+
</td>
|
72
|
+
<td>
|
73
|
+
<%= class_info[:total_finished_jobs].to_i %>
|
74
|
+
</td>
|
75
|
+
<td>
|
76
|
+
<%= class_info[:max_running_jobs].to_i %>
|
77
|
+
</td>
|
78
|
+
<td>
|
79
|
+
<% if class_info[:last_run] && class_info[:last_run].start_time %>
|
80
|
+
<%= time_ago_in_words(class_info[:last_run].start_time) %> ago
|
81
|
+
(<%= class_info[:last_run].start_time %>)
|
82
|
+
<% end %>
|
83
|
+
</td>
|
84
|
+
<td>
|
85
|
+
<% if class_info[:last_run] %>
|
86
|
+
<% if class_info[:last_run].finished? %>
|
87
|
+
<%= distance_of_time_in_words(class_info[:last_run].start_time, class_info[:last_run].end_time) %>
|
88
|
+
(<%= class_info[:last_run].end_time %>)
|
89
|
+
<% else %>
|
90
|
+
Still running...
|
91
|
+
<% end %>
|
92
|
+
<% end %>
|
93
|
+
</td>
|
94
|
+
<td>
|
95
|
+
<% if class_info[:last_run] && class_info[:last_run].error %>
|
96
|
+
No
|
97
|
+
<% else %>
|
98
|
+
Yes
|
99
|
+
<% end %>
|
100
|
+
</td>
|
101
|
+
</tr>
|
102
|
+
<% end %>
|
103
|
+
</table>
|
104
|
+
|
105
|
+
<%= erb(File.read(Resque::JobHistoryServer.erb_path("_job_class_pagination.erb")),
|
106
|
+
locals: { job_list: job_list, page_num: @page_num, page_size: @page_size }) %>
|
107
|
+
|
108
|
+
<br/>
|
109
|
+
|
110
|
+
<div>
|
111
|
+
<form method="POST" action="job%20history/purge_all">
|
112
|
+
<input type="submit" name="" value="Purge all histories"/>
|
113
|
+
</form>
|
114
|
+
</div>
|
metadata
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: resque-job_history
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- RealNobody
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-09-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: resque
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.25'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.25'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: redis-namespace
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: redis
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sqlite3
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec-rails
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: Keeps a history of run jobs by job.
|
98
|
+
email:
|
99
|
+
- RealNobody1@cox.net
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- MIT-LICENSE
|
105
|
+
- README.rdoc
|
106
|
+
- Rakefile
|
107
|
+
- lib/resque-job_history.rb
|
108
|
+
- lib/resque/job_history_server.rb
|
109
|
+
- lib/resque/plugins/job_history.rb
|
110
|
+
- lib/resque/plugins/job_history/cleaner.rb
|
111
|
+
- lib/resque/plugins/job_history/history_base.rb
|
112
|
+
- lib/resque/plugins/job_history/history_list.rb
|
113
|
+
- lib/resque/plugins/job_history/job.rb
|
114
|
+
- lib/resque/plugins/job_history/job_list.rb
|
115
|
+
- lib/resque/plugins/version.rb
|
116
|
+
- lib/resque/server/public/job_history.css
|
117
|
+
- lib/resque/server/views/_job_class_pagination.erb
|
118
|
+
- lib/resque/server/views/_job_pagination.erb
|
119
|
+
- lib/resque/server/views/_jobs_list.erb
|
120
|
+
- lib/resque/server/views/job_class_details.erb
|
121
|
+
- lib/resque/server/views/job_details.erb
|
122
|
+
- lib/resque/server/views/job_history.erb
|
123
|
+
- lib/tasks/resque-job_history_tasks.rake
|
124
|
+
homepage: https://github.com/RealNobody
|
125
|
+
licenses:
|
126
|
+
- MIT
|
127
|
+
metadata: {}
|
128
|
+
post_install_message:
|
129
|
+
rdoc_options: []
|
130
|
+
require_paths:
|
131
|
+
- lib
|
132
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
requirements: []
|
143
|
+
rubyforge_project:
|
144
|
+
rubygems_version: 2.5.1
|
145
|
+
signing_key:
|
146
|
+
specification_version: 4
|
147
|
+
summary: Keeps a history of run jobs by job.
|
148
|
+
test_files: []
|