resque-job_history 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b694b3138b29678d77992c3bd60b5a2dfeeac281
4
- data.tar.gz: 6052e79345a6d3893268547f67226498381489b7
3
+ metadata.gz: 3e5bff0c1faf1c5b7320a96c5b085e8baf35b712
4
+ data.tar.gz: 4ada6c6a3fc999730bba715e840285e1e6b9dfd1
5
5
  SHA512:
6
- metadata.gz: ede3b231cae7051dff2d3b0194a664acc49ceac54f031a6f968f21ebe90fc991778363075a375d38e18506cc909ac44143fc52dcc94bbe6b6dd3eb3723ff53c1
7
- data.tar.gz: a485d45ac90bec11610da58dd6f7b862690665bcaab7f06dd0746d5ec70d24e0c79ddc1d6af0d087678f0ed6501deea81fadaf039adc06e37167496ef2e64d28
6
+ metadata.gz: 7510483ab78cdd4571de32e388235a654d7c1afa71eac5dc28f951eca1c34401b6dcd84b6715907c24346d7579146f198a7e3b885952733d592294d68f822c1a
7
+ data.tar.gz: e75083c6ae8aaf7141ad8541127bd44368876c7e797b0b930101f5d5da0243f8f26e611a31206f341eb0c3ee4feecdf09464137ec83db213d5e1bfffa585c41f
@@ -32,6 +32,7 @@ module Resque
32
32
  job_history(base)
33
33
  class_details(base)
34
34
  job_details(base)
35
+ linear_list(base)
35
36
  end
36
37
 
37
38
  def job_history(base)
@@ -49,8 +50,8 @@ module Resque
49
50
  def job_history_params(base)
50
51
  base.class_eval do
51
52
  def set_job_history_params
52
- @sort_by = params[:sort] || "class_name"
53
- @sort_order = params[:order] || "asc"
53
+ @sort_by = params[:sort] || "start_time"
54
+ @sort_order = params[:order] || "desc"
54
55
  @page_num = (params[:page_num] || 1).to_i
55
56
  @page_size = (params[:page_size] ||
56
57
  Resque::Plugins::JobHistory::HistoryDetails.class_list_page_size).to_i
@@ -113,6 +114,18 @@ module Resque
113
114
  end
114
115
  end
115
116
 
117
+ def linear_list(base)
118
+ base.class_eval do
119
+ get "/job history/linear_history" do
120
+ @page_num = (params[:page_num] || 1).to_i
121
+ @page_size = (params[:page_size] ||
122
+ Resque::Plugins::JobHistory::HistoryDetails.linear_page_size).to_i
123
+
124
+ erb File.read(Resque::JobHistoryServer.erb_path("linear_history.erb"))
125
+ end
126
+ end
127
+ end
128
+
116
129
  def add_static_files(base)
117
130
  base.class_eval do
118
131
  get %r{job_history/public/([a-z_]+\.[a-z]+)} do
@@ -12,9 +12,14 @@ module Resque
12
12
 
13
13
  # Redis mapp:
14
14
  # job_history - a set of all of the class names of all jobs
15
+ # job_history..linear_jobs - a list of the IDs for all jobs that have run in the order
16
+ # they were started.
17
+ # job_history..total_linear_jobs - The total number of jobs added to the linear list.
18
+ # job_history..linear_job_classes - The total number of jobs added to the linear list.
15
19
  # job_history.<class_name>.max_jobs - The maximum number of jobs that have run concurrently
16
20
  # for this class.
17
- # job_history.<class_name>.total_failed_jobs - The total number of jobs that have failed
21
+ # job_history.<class_name>.total_failed_jobs - The total number of jobs that have failed.
22
+ # job_history.<class_name>.total_running_jobs - The total number of jobs that have been run.
18
23
  # job_history.<class_name>.total_finished_jobs - The maximum number of jobs that have run for
19
24
  # this class.
20
25
  # job_history.<class_name>.running_jobs - a list of the IDs for all running jobs in the order
@@ -16,12 +16,11 @@ module Resque
16
16
  job_classes.each do |class_name|
17
17
  fixup_job_keys class_name
18
18
  end
19
+ fixup_linear_keys
19
20
  end
20
21
 
21
22
  def fixup_job_keys(class_name)
22
- keys = job_keys(class_name)
23
- keys -= Resque::Plugins::JobHistory::HistoryList.new(class_name, "running").job_ids
24
- keys -= Resque::Plugins::JobHistory::HistoryList.new(class_name, "finished").job_ids
23
+ keys = unknown_job_keys(class_name)
25
24
 
26
25
  keys.each do |stranded_key|
27
26
  Resque::Plugins::JobHistory::Job.new(class_name, stranded_key).purge
@@ -29,6 +28,21 @@ module Resque
29
28
  end
30
29
  end
31
30
 
31
+ def fixup_linear_keys
32
+ details = Resque::Plugins::JobHistory::HistoryDetails.new("")
33
+ hash_key = details.linear_jobs.job_classes_key
34
+
35
+ classes = details.redis.hgetall hash_key
36
+ job_ids = details.linear_jobs.job_ids
37
+
38
+ classes.keys.each do |job_id|
39
+ next if job_ids.include?(job_id)
40
+
41
+ Resque.logger.warn("deleting missing job class - #{job_id}")
42
+ details.redis.hdel hash_key, job_id
43
+ end
44
+ end
45
+
32
46
  def purge_all_jobs
33
47
  job_classes.each do |class_name|
34
48
  purge_class class_name
@@ -52,6 +66,10 @@ module Resque
52
66
  def purge_class(class_name)
53
67
  return if similar_name?(class_name)
54
68
 
69
+ details = Resque::Plugins::JobHistory::HistoryDetails.new("class_name")
70
+ details.running_jobs.jobs.each(&:purge)
71
+ details.finished_jobs.jobs.each(&:purge)
72
+
55
73
  class_keys(class_name).each do |job_key|
56
74
  del_key(job_key, "Purging job key")
57
75
  end
@@ -75,21 +93,42 @@ module Resque
75
93
  history_base.redis.keys("#{history_base.job_history_base_key}*")
76
94
  end
77
95
 
96
+ def job_id_keys(class_name, job_ids)
97
+ job_ids.map do |job_id|
98
+ "#{Resque::Plugins::JobHistory::HistoryDetails.job_history_key}.#{class_name}.#{job_id}"
99
+ end
100
+ end
101
+
78
102
  def job_keys(class_name)
79
103
  history_base = Resque::Plugins::JobHistory::HistoryDetails.new(class_name)
80
104
 
81
- history_base.redis.keys("#{history_base.job_history_base_key}.*") - job_support_keys(history_base)
105
+ history_base.redis.keys("#{history_base.job_history_base_key}*") - job_support_keys(history_base)
82
106
  end
83
107
 
84
108
  def job_support_keys(history_base)
85
109
  ["#{history_base.job_history_base_key}.running_jobs",
86
110
  "#{history_base.job_history_base_key}.total_running_jobs",
111
+ "#{history_base.job_history_base_key}.running_job_classes",
112
+ "#{history_base.job_history_base_key}.linear_jobs",
113
+ "#{history_base.job_history_base_key}.total_linear_jobs",
114
+ "#{history_base.job_history_base_key}.linear_job_classes",
87
115
  "#{history_base.job_history_base_key}.finished_jobs",
88
116
  "#{history_base.job_history_base_key}.total_finished_jobs",
117
+ "#{history_base.job_history_base_key}.finished_job_classes",
89
118
  "#{history_base.job_history_base_key}.max_jobs",
90
119
  "#{history_base.job_history_base_key}.total_failed"]
91
120
  end
92
121
 
122
+ def unknown_job_keys(class_name)
123
+ keys = job_keys(class_name)
124
+ keys -= job_id_keys(class_name,
125
+ Resque::Plugins::JobHistory::HistoryList.new(class_name, "running").job_ids)
126
+ keys -= job_id_keys(class_name,
127
+ Resque::Plugins::JobHistory::HistoryList.new(class_name, "finished").job_ids)
128
+ keys - job_id_keys(class_name,
129
+ Resque::Plugins::JobHistory::HistoryList.new("", "linear").job_ids)
130
+ end
131
+
93
132
  def redis
94
133
  @redis ||= Resque::Plugins::JobHistory::HistoryDetails.new("").redis
95
134
  end
@@ -7,7 +7,8 @@ module Resque
7
7
  class HistoryDetails
8
8
  attr_accessor :class_name
9
9
 
10
- NAME_SPACE = "Resque::Plugins::ResqueJobHistory"
10
+ NAME_SPACE = "Resque::Plugins::ResqueJobHistory"
11
+ MAX_LINEAR_HISTORY = 500
11
12
 
12
13
  class << self
13
14
  def job_history_key
@@ -16,11 +17,34 @@ module Resque
16
17
 
17
18
  def class_list_page_size=(value)
18
19
  @class_list_page_size = value
20
+ @class_list_page_size = 1 if @class_list_page_size < 1
19
21
  end
20
22
 
21
23
  def class_list_page_size
22
24
  @class_list_page_size ||= Resque::Plugins::JobHistory::PAGE_SIZE
23
25
  end
26
+
27
+ def linear_page_size=(value)
28
+ @linear_page_size = value
29
+ @linear_page_size = 1 if @linear_page_size < 1
30
+ end
31
+
32
+ def linear_page_size
33
+ @linear_page_size ||= Resque::Plugins::JobHistory::PAGE_SIZE
34
+ end
35
+
36
+ def max_linear_jobs
37
+ @max_linear_jobs ||= MAX_LINEAR_HISTORY
38
+ end
39
+
40
+ def max_linear_jobs=(value)
41
+ @max_linear_jobs = value
42
+
43
+ return unless @max_linear_jobs.present?
44
+
45
+ @max_linear_jobs = @max_linear_jobs.to_i
46
+ @max_linear_jobs = nil if @max_linear_jobs.negative?
47
+ end
24
48
  end
25
49
 
26
50
  def initialize(class_name)
@@ -43,6 +67,11 @@ module Resque
43
67
  @finished_list ||= HistoryList.new(class_name, "finished")
44
68
  end
45
69
 
70
+ def linear_jobs
71
+ @linear_list ||= HistoryList.new("", "linear",
72
+ Resque::Plugins::JobHistory::HistoryDetails.max_linear_jobs)
73
+ end
74
+
46
75
  def max_concurrent_jobs
47
76
  redis.get(max_running_key).to_i
48
77
  end
@@ -85,11 +114,13 @@ module Resque
85
114
  end
86
115
 
87
116
  def class_history_len
88
- described_class.try(:job_history_len) || MAX_JOB_HISTORY
117
+ hist_len = described_class.try(:job_history_len) || MAX_JOB_HISTORY
118
+ hist_len.negative? ? 0 : hist_len
89
119
  end
90
120
 
91
121
  def class_page_size
92
- described_class.try(:page_size) || Resque::Plugins::JobHistory::PAGE_SIZE
122
+ pg_size = described_class.try(:page_size) || Resque::Plugins::JobHistory::PAGE_SIZE
123
+ pg_size < 1 ? 1 : pg_size
93
124
  end
94
125
 
95
126
  def total_failed_key
@@ -7,16 +7,18 @@ module Resque
7
7
  class HistoryList < HistoryDetails
8
8
  attr_accessor :list_name
9
9
 
10
- def initialize(class_name, list_name)
10
+ def initialize(class_name, list_name, list_maximum = nil)
11
11
  super(class_name)
12
12
 
13
- @list_name = list_name
13
+ @list_name = list_name
14
+ @list_maximum = list_maximum
14
15
  end
15
16
 
16
- def add_job(job_id)
17
- add_to_history
17
+ def add_job(job_id, class_name)
18
+ add_to_job_history
18
19
 
19
20
  job_count = redis.lpush(job_list_key, job_id)
21
+ save_class_information(job_id, class_name)
20
22
  redis.incr(total_jobs_key)
21
23
 
22
24
  delete_old_jobs(job_count)
@@ -24,6 +26,7 @@ module Resque
24
26
 
25
27
  def remove_job(job_id)
26
28
  redis.lrem(job_list_key, 0, job_id)
29
+ remove_job_data(job_id)
27
30
  end
28
31
 
29
32
  def paged_jobs(page_num = 1, job_page_size = nil)
@@ -38,7 +41,7 @@ module Resque
38
41
 
39
42
  def jobs(start = 0, stop = -1)
40
43
  job_ids(start, stop).map do |job_id|
41
- Resque::Plugins::JobHistory::Job.new(class_name, job_id)
44
+ Resque::Plugins::JobHistory::Job.new(job_class(job_id), job_id)
42
45
  end
43
46
  end
44
47
 
@@ -57,20 +60,37 @@ module Resque
57
60
  def latest_job
58
61
  job_id = redis.lrange(job_list_key, 0, 0).first
59
62
 
60
- Resque::Plugins::JobHistory::Job.new(class_name, job_id) if job_id
63
+ Resque::Plugins::JobHistory::Job.new(job_class(job_id), job_id) if job_id
64
+ end
65
+
66
+ def includes_job?(job_id)
67
+ job_ids.include?(job_id)
68
+ end
69
+
70
+ def job_classes_key
71
+ "#{job_history_base_key}.#{list_name}_job_classes"
61
72
  end
62
73
 
63
74
  private
64
75
 
65
- def add_to_history
76
+ def add_to_job_history
77
+ return if class_name.blank?
78
+
66
79
  redis.sadd(Resque::Plugins::JobHistory::HistoryDetails.job_history_key, class_name)
67
80
  end
68
81
 
69
- def delete_old_jobs(job_count)
70
- max_jobs = class_history_len
82
+ def max_jobs
83
+ @list_maximum ||= class_history_len
84
+ @list_maximum = 0 if @list_maximum.negative?
85
+ @list_maximum
86
+ end
71
87
 
88
+ def delete_old_jobs(job_count)
72
89
  while job_count > max_jobs
73
- Resque::Plugins::JobHistory::Job.new(class_name, redis.rpop(job_list_key)).purge
90
+ job_id = redis.rpop(job_list_key)
91
+ remove_job_data(job_id)
92
+
93
+ Resque::Plugins::JobHistory::Job.new(job_class(job_id), job_id).safe_purge
74
94
 
75
95
  job_count -= 1
76
96
  end
@@ -85,6 +105,20 @@ module Resque
85
105
  def job_list_key
86
106
  "#{job_history_base_key}.#{list_name}_jobs"
87
107
  end
108
+
109
+ def job_class(job_id)
110
+ redis.hget(job_classes_key, job_id) || class_name
111
+ end
112
+
113
+ def save_class_information(job_id, job_class_name)
114
+ return unless class_name.blank? || job_class_name != class_name
115
+
116
+ redis.hset job_classes_key, job_id, job_class_name
117
+ end
118
+
119
+ def remove_job_data(job_id)
120
+ redis.hdel(job_classes_key, job_id)
121
+ end
88
122
  end
89
123
  end
90
124
  end
@@ -47,7 +47,8 @@ module Resque
47
47
  end
48
48
 
49
49
  def start(*args)
50
- num_jobs = running_jobs.add_job(job_id)
50
+ num_jobs = running_jobs.add_job(job_id, class_name)
51
+ linear_jobs.add_job(job_id, class_name)
51
52
 
52
53
  record_job_start(*args)
53
54
  record_num_jobs(num_jobs)
@@ -56,7 +57,7 @@ module Resque
56
57
  def finish
57
58
  redis.hset(job_key, "end_time", Time.now.utc.to_s)
58
59
 
59
- finished_jobs.add_job(job_id)
60
+ finished_jobs.add_job(job_id, class_name)
60
61
  running_jobs.remove_job(job_id)
61
62
 
62
63
  reset
@@ -85,18 +86,31 @@ module Resque
85
86
  Resque.enqueue described_class, *args
86
87
  end
87
88
 
89
+ def safe_purge
90
+ return if running_jobs.includes_job?(job_id)
91
+ return if finished_jobs.includes_job?(job_id)
92
+ return if linear_jobs.includes_job?(job_id)
93
+
94
+ purge
95
+ end
96
+
88
97
  def purge
89
98
  # To keep the counts honest...
90
99
  cancel unless finished?
91
100
 
92
- running_jobs.remove_job(job_id)
93
- finished_jobs.remove_job(job_id)
101
+ remove_from_job_lists
94
102
 
95
103
  redis.del(job_key)
96
104
 
97
105
  reset
98
106
  end
99
107
 
108
+ def remove_from_job_lists
109
+ running_jobs.remove_job(job_id)
110
+ finished_jobs.remove_job(job_id)
111
+ linear_jobs.remove_job(job_id)
112
+ end
113
+
100
114
  private
101
115
 
102
116
  def record_job_start(*args)
@@ -3,7 +3,7 @@
3
3
  module Resque
4
4
  module Plugins
5
5
  module JobHistory
6
- VERSION = "0.0.5"
6
+ VERSION = "0.0.6"
7
7
  end
8
8
  end
9
9
  end
@@ -31,4 +31,8 @@
31
31
  .table_container {
32
32
  width: 100%;
33
33
  overflow-x: scroll;
34
- }
34
+ }
35
+
36
+ .job_history_error {
37
+ background-color: lightcoral;
38
+ }
@@ -21,7 +21,7 @@
21
21
  <th>Error</th>
22
22
  </tr>
23
23
  <% jobs.each do |job_details| %>
24
- <tr>
24
+ <tr<%= job_details.succeeded? ? "" : " class=\"job_history_error\"" %>>
25
25
  <td>
26
26
  <a href="job_details?class_name=<%= job_details.class_name %>&job_id=<%= job_details.job_id %>">
27
27
  <%= time_ago_in_words(job_details.start_time) %> ago
@@ -0,0 +1,57 @@
1
+ <div class="job_history_pagination_block">
2
+ <% total_pages = linear_history.num_jobs / page_size %>
3
+ <% total_pages += 1 if linear_history.num_jobs % page_size > 0 %>
4
+ <% page_num = 1 if page_num > total_pages || page_num < 1 %>
5
+ <% first_page = [1, page_num - 3].max %>
6
+ <% last_page = [total_pages, page_num + 3].min %>
7
+ <% last_page = page_num < 4 ? [total_pages, last_page + (4 - page_num)].min : last_page %>
8
+ <% first_page = page_num > total_pages - 3 ? [1, first_page + ((total_pages - page_num) - 3)].max : first_page %>
9
+
10
+ <% if total_pages > 1 %>
11
+ <div class="job_history_prev_links">
12
+ <a href="linear_history?<%= { "page_size" => page_size,
13
+ "page_num" => 1 }.to_param %>"
14
+ class="job_history_first_page"
15
+ disabled="<%= first_page > 1 %>">
16
+ &lt;&lt; First
17
+ </a>
18
+
19
+ <a href="linear_history?<%= { "page_size" => page_size,
20
+ "page_num" => [1, page_num - 1].max }.to_param %>"
21
+ class="job_history_prev_page"
22
+ disabled="<%= page_num > 1 %>">
23
+ &lt; Prev
24
+ </a>
25
+ </div>
26
+
27
+ <div class="job_history_pages">
28
+ <% (first_page..last_page).each do |page_number| %>
29
+ <% if page_number != page_num %>
30
+ <a href="linear_history?<%= { "page_size" => page_size,
31
+ "page_num" => page_number }.to_param %>"
32
+ class="job_history_page">
33
+ <%= page_number %>
34
+ </a>
35
+ <% else %>
36
+ <%= page_number %>
37
+ <% end %>
38
+ <% end %>
39
+ </div>
40
+
41
+ <div class="job_history_next_links">
42
+ <a href="linear_history?<%= { "page_size" => page_size,
43
+ "page_num" => [total_pages, page_num + 1].min }.to_param %>"
44
+ class="job_history_next_page"
45
+ disabled="<%= page_num < last_page %>">
46
+ Next &gt;
47
+ </a>
48
+
49
+ <a href="linear_history?<%= { "page_size" => page_size,
50
+ "page_num" => total_pages }.to_param %>"
51
+ class="job_history_last_page"
52
+ disabled="<%= last_page < total_pages %>">
53
+ Last &gt;&gt;
54
+ </a>
55
+ </div>
56
+ <% end %>
57
+ </div>
@@ -6,9 +6,11 @@
6
6
  <% history = Resque::Plugins::JobHistory::HistoryDetails.new(@job_class_name) %>
7
7
  <% class_info = job_list.job_class_summary(@job_class_name) %>
8
8
 
9
- <a href="<%= u("job history") %>">
10
- Job History
11
- </a>
9
+ <p>
10
+ <a href="<%= u("job history") %>">
11
+ Job History
12
+ </a>
13
+ </p>
12
14
 
13
15
  <div class="table_container">
14
16
  <table>
@@ -6,13 +6,15 @@
6
6
 
7
7
  <% job_details = Resque::Plugins::JobHistory::Job.new(@job_class_name, @job_id) %>
8
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>
9
+ <p>
10
+ <a href="<%= u("job history") %>">
11
+ Job History
12
+ </a>
13
+ |
14
+ <a href="job_class_details?<%= { class_name: @job_class_name }.to_param %>">
15
+ <%= @job_class_name %>
16
+ </a>
17
+ </p>
16
18
 
17
19
  <div class="table_container">
18
20
  <table>
@@ -45,7 +47,7 @@
45
47
  </td>
46
48
  </tr>
47
49
  <% unless job_details.succeeded? %>
48
- <tr>
50
+ <tr class="job_history_error">
49
51
  <td>
50
52
  Error
51
53
  </td>
@@ -3,6 +3,13 @@
3
3
  <h1>Job Classes</h1>
4
4
 
5
5
  <% job_list = Resque::Plugins::JobHistory::JobList.new %>
6
+
7
+ <p>
8
+ <a href="<%= u("job history/linear_history") %>">
9
+ Linear History
10
+ </a>
11
+ </p>
12
+
6
13
  <%= erb(File.read(Resque::JobHistoryServer.erb_path("_job_class_pagination.erb")),
7
14
  locals: { job_list: job_list, page_num: @page_num, page_size: @page_size }) %>
8
15
 
@@ -23,6 +30,13 @@
23
30
  order_param("running_jobs", @sort_by, @sort_order) }.to_param %>">
24
31
  Running
25
32
  </a></th>
33
+ <th><a href="job%20history?<%= { sort: "total_run_jobs",
34
+ page_size: @page_size,
35
+ page_num: @page_num,
36
+ order: job_list.
37
+ order_param("total_run_jobs", @sort_by, @sort_order) }.to_param %>">
38
+ Total Run
39
+ </a></th>
26
40
  <th><a href="job%20history?<%= { sort: "total_finished_jobs",
27
41
  page_size: @page_size,
28
42
  page_num: @page_num,
@@ -61,7 +75,7 @@
61
75
  </tr>
62
76
 
63
77
  <% job_list.job_summaries(@sort_by, @sort_order, @page_num, @page_size).each do |class_info| %>
64
- <tr>
78
+ <tr<%= class_info[:last_run] && !class_info[:last_run].succeeded? ? " class=\"job_history_error\"" : "" %>>
65
79
  <td>
66
80
  <a href="job%20history/job_class_details?class_name=<%= class_info[:class_name] %>">
67
81
  <%= class_info[:class_name] %>
@@ -70,6 +84,9 @@
70
84
  <td>
71
85
  <%= class_info[:running_jobs].to_i %>
72
86
  </td>
87
+ <td>
88
+ <%= class_info[:total_run_jobs].to_i %>
89
+ </td>
73
90
  <td>
74
91
  <%= class_info[:total_finished_jobs].to_i %>
75
92
  </td>
@@ -93,7 +110,7 @@
93
110
  <% end %>
94
111
  </td>
95
112
  <td>
96
- <% if class_info[:last_run] && class_info[:last_run].error %>
113
+ <% if class_info[:last_run] && !class_info[:last_run].succeeded? %>
97
114
  No
98
115
  <% else %>
99
116
  Yes
@@ -0,0 +1,61 @@
1
+ <link href="job_history/public/job_history.css" media="screen" rel="stylesheet" type="text/css">
2
+
3
+ <h1>Linear History</h1>
4
+
5
+ <p>
6
+ <a href="<%= u("job history") %>">
7
+ Job History
8
+ </a>
9
+ </p>
10
+
11
+ <% linear_history = Resque::Plugins::JobHistory::JobList.new.linear_jobs %>
12
+
13
+ <% if linear_history.num_jobs > 0 %>
14
+ <% jobs = linear_history.paged_jobs(@page_num, @page_size) %>
15
+ <%= erb(File.read(Resque::JobHistoryServer.erb_path("_linear_pagination.erb")),
16
+ locals: { linear_history: linear_history,
17
+ page_num: @page_num,
18
+ page_size: @page_size }) %>
19
+
20
+ <div class="table_container">
21
+ <table>
22
+ <tr>
23
+ <th>Class</th>
24
+ <th>Started</th>
25
+ <th>Duration</th>
26
+ <th>Parameters</th>
27
+ <th>Error</th>
28
+ </tr>
29
+ <% jobs.each do |job_details| %>
30
+ <tr<%= job_details.succeeded? ? "" : " class=\"job_history_error\"" %>>
31
+ <td>
32
+ <a href="job_details?class_name=<%= job_details.class_name %>&job_id=<%= job_details.job_id %>">
33
+ <%= job_details.class_name %>
34
+ </a>
35
+ </td>
36
+ <td>
37
+ <%= time_ago_in_words(job_details.start_time) %> ago
38
+ (<%= job_details.start_time %>)
39
+ </td>
40
+ <td>
41
+ <%= distance_of_time_in_words(job_details.start_time, (job_details.end_time || Time.now)) %>
42
+ <% if job_details.finished? %>
43
+ (<%= job_details.end_time %>)
44
+ <% end %>
45
+ </td>
46
+ <td>
47
+ <pre><code><%= "".html_safe + job_details.args.to_yaml %></code></pre>
48
+ </td>
49
+ <td>
50
+ <%= job_details.error %>
51
+ </td>
52
+ </tr>
53
+ <% end %>
54
+ </table>
55
+ </div>
56
+
57
+ <%= erb(File.read(Resque::JobHistoryServer.erb_path("_linear_pagination.erb")),
58
+ locals: { linear_history: linear_history,
59
+ page_num: @page_num,
60
+ page_size: @page_size }) %>
61
+ <% end %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resque-job_history
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - RealNobody
@@ -186,9 +186,11 @@ files:
186
186
  - lib/resque/server/views/_job_class_pagination.erb
187
187
  - lib/resque/server/views/_job_pagination.erb
188
188
  - lib/resque/server/views/_jobs_list.erb
189
+ - lib/resque/server/views/_linear_pagination.erb
189
190
  - lib/resque/server/views/job_class_details.erb
190
191
  - lib/resque/server/views/job_details.erb
191
192
  - lib/resque/server/views/job_history.erb
193
+ - lib/resque/server/views/linear_history.erb
192
194
  - lib/tasks/resque-job_history_tasks.rake
193
195
  homepage: https://github.com/RealNobody
194
196
  licenses: