resque_admin-scheduler 1.1.8 → 1.1.9
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.
- checksums.yaml +4 -4
- data/lib/resque_admin-scheduler.rb +1 -1
- data/lib/resque_admin/scheduler.rb +8 -8
- data/lib/resque_admin/scheduler/cli.rb +2 -2
- data/lib/resque_admin/scheduler/delaying_extensions.rb +1 -1
- data/lib/resque_admin/scheduler/locking.rb +2 -2
- data/lib/resque_admin/scheduler/logger_builder.rb +2 -2
- data/lib/resque_admin/scheduler/scheduling_extensions.rb +2 -2
- data/lib/resque_admin/scheduler/server.rb +1 -1
- data/lib/resque_admin/scheduler/server/views/delayed.erb +4 -4
- data/lib/resque_admin/scheduler/server/views/delayed_timestamp.erb +2 -2
- data/lib/resque_admin/scheduler/tasks.rb +1 -1
- data/lib/resque_admin/scheduler/util.rb +2 -2
- data/lib/resque_admin/scheduler/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4341967f67cfc4638d942ce67b7bfe29928a4ad7
|
4
|
+
data.tar.gz: bd42aa66e6e63267470f9be00975e33ed658c604
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a72dd346482b9e532e24f38ede61cbcfc44602efaa95a9f76fe3f9f90ca041c218fdd4737584df91685384ccb2b0c892f9f58ce8c4f973d4d7ebee3150909ced
|
7
|
+
data.tar.gz: 4f7d9b5c7e39093cf5789bf2e52cc75dffaa488d429a2bf3eda98ac4f669c34bc70c978c83b76045134102675c39213f49be0fffc771d776e8b820bfd3f4c70a
|
@@ -9,10 +9,10 @@ require_relative 'scheduler/failure_handler'
|
|
9
9
|
|
10
10
|
module ResqueAdmin
|
11
11
|
module Scheduler
|
12
|
-
autoload :Cli, '
|
13
|
-
autoload :Extension, '
|
14
|
-
autoload :Util, '
|
15
|
-
autoload :VERSION, '
|
12
|
+
autoload :Cli, 'resque_admin/scheduler/cli'
|
13
|
+
autoload :Extension, 'resque_admin/scheduler/extension'
|
14
|
+
autoload :Util, 'resque_admin/scheduler/util'
|
15
|
+
autoload :VERSION, 'resque_admin/scheduler/version'
|
16
16
|
|
17
17
|
private
|
18
18
|
|
@@ -38,8 +38,8 @@ module ResqueAdmin
|
|
38
38
|
# trap signals
|
39
39
|
register_signal_handlers
|
40
40
|
|
41
|
-
# Quote from the
|
42
|
-
# Fix buffering so we can `rake
|
41
|
+
# Quote from the resque_admin/worker.
|
42
|
+
# Fix buffering so we can `rake resque_admin:scheduler > scheduler.log` and
|
43
43
|
# get output from the child in there.
|
44
44
|
$stdout.sync = true
|
45
45
|
$stderr.sync = true
|
@@ -238,7 +238,7 @@ module ResqueAdmin
|
|
238
238
|
job_config[:queue] ||
|
239
239
|
ResqueAdmin.queue_from_class(klass)
|
240
240
|
# Support custom job classes like those that inherit from
|
241
|
-
# ResqueAdmin::JobWithStatus (
|
241
|
+
# ResqueAdmin::JobWithStatus (resque_admin-status)
|
242
242
|
job_klass = job_config['custom_job_class']
|
243
243
|
if job_klass && job_klass != 'ResqueAdmin::Job'
|
244
244
|
# The custom job class API must offer a static "scheduled" method. If
|
@@ -440,7 +440,7 @@ module ResqueAdmin
|
|
440
440
|
end
|
441
441
|
|
442
442
|
def internal_name
|
443
|
-
"
|
443
|
+
"resque_admin-scheduler-#{ResqueAdmin::Scheduler::VERSION}"
|
444
444
|
end
|
445
445
|
end
|
446
446
|
end
|
@@ -20,9 +20,9 @@ module ResqueAdmin
|
|
20
20
|
|
21
21
|
class Cli
|
22
22
|
BANNER = <<-EOF.gsub(/ {6}/, '')
|
23
|
-
Usage:
|
23
|
+
Usage: resque_admin-scheduler [options]
|
24
24
|
|
25
|
-
Runs a
|
25
|
+
Runs a resque_admin scheduler process directly (rather than via rake).
|
26
26
|
|
27
27
|
EOF
|
28
28
|
OPTIONS = [
|
@@ -25,7 +25,7 @@ module ResqueAdmin
|
|
25
25
|
return false unless plugin.run_before_schedule_hooks(klass, *args)
|
26
26
|
|
27
27
|
if ResqueAdmin.inline? || timestamp.to_i < Time.now.to_i
|
28
|
-
# Just create the job and let
|
28
|
+
# Just create the job and let resque_admin perform it right away with
|
29
29
|
# inline. If the class is a custom job class, call self#scheduled
|
30
30
|
# on it. This allows you to do things like
|
31
31
|
# ResqueAdmin.enqueue_at(timestamp, CustomJobClass, :opt1 => val1).
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# ### Locking the scheduler process
|
4
4
|
#
|
5
|
-
# There are two places in
|
5
|
+
# There are two places in resque_admin-scheduler that need to be synchonized in order
|
6
6
|
# to be able to run redundant scheduler processes while ensuring jobs don't get
|
7
7
|
# queued multiple times when the master process changes.
|
8
8
|
#
|
@@ -23,7 +23,7 @@
|
|
23
23
|
# should remain the master as long as it can rather than a simple SETNX which
|
24
24
|
# would result in the master roll being passed around frequently.
|
25
25
|
#
|
26
|
-
# Locking Scheme: Each
|
26
|
+
# Locking Scheme: Each resque_admin-scheduler process attempts to get the master lock
|
27
27
|
# via SETNX. Once obtained, it sets the expiration for 3 minutes
|
28
28
|
# (configurable). The master process continually updates the timeout on the
|
29
29
|
# lock key to be 3 minutes in the future in it's loop(s) (see `run`) and when
|
@@ -51,7 +51,7 @@ module ResqueAdmin
|
|
51
51
|
|
52
52
|
def text_formatter
|
53
53
|
proc do |severity, datetime, _progname, msg|
|
54
|
-
"
|
54
|
+
"resque_admin-scheduler: [#{severity}] #{datetime.iso8601}: #{msg}\n"
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
@@ -59,7 +59,7 @@ module ResqueAdmin
|
|
59
59
|
proc do |severity, datetime, progname, msg|
|
60
60
|
require 'json'
|
61
61
|
JSON.dump(
|
62
|
-
name: '
|
62
|
+
name: 'resque_admin-scheduler',
|
63
63
|
progname: progname,
|
64
64
|
level: severity,
|
65
65
|
timestamp: datetime.iso8601,
|
@@ -19,7 +19,7 @@ module ResqueAdmin
|
|
19
19
|
# Hash keys can be anything and are used to describe and reference
|
20
20
|
# the scheduled job. If the "class" argument is missing, the key
|
21
21
|
# is used implicitly as "class" argument - in the "MakeTea" example,
|
22
|
-
# "MakeTea" is used both as job name and
|
22
|
+
# "MakeTea" is used both as job name and resque_admin worker class.
|
23
23
|
#
|
24
24
|
# Any jobs that were in the old schedule, but are not
|
25
25
|
# present in the new schedule, will be removed.
|
@@ -30,7 +30,7 @@ module ResqueAdmin
|
|
30
30
|
# usage for valid syntax. If :cron is present it will take precedence
|
31
31
|
# over :every.
|
32
32
|
#
|
33
|
-
# :class must be a
|
33
|
+
# :class must be a resque_admin worker class. If it is missing, the job name
|
34
34
|
# (hash key) will be used as :class.
|
35
35
|
#
|
36
36
|
# :args can be any yaml which will be converted to a ruby literal and
|
@@ -66,7 +66,7 @@ module ResqueAdmin
|
|
66
66
|
config_args = config['args'] || config[:args] || {}
|
67
67
|
config_args = config_args.merge(submitted_args)
|
68
68
|
|
69
|
-
# Insert the args hash into config and queue the
|
69
|
+
# Insert the args hash into config and queue the resque_admin job
|
70
70
|
config = config.merge('args' => config_args)
|
71
71
|
ResqueAdmin::Scheduler.enqueue_from_config(config)
|
72
72
|
redirect u('/overview')
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<h1>Delayed Jobs</h1>
|
2
|
-
<%- size =
|
2
|
+
<%- size = resque_admin.delayed_queue_schedule_size %>
|
3
3
|
|
4
4
|
<%= scheduler_view :search_form, layout: false %>
|
5
5
|
|
@@ -25,7 +25,7 @@
|
|
25
25
|
<th>Args</th>
|
26
26
|
<th>All schedules</th>
|
27
27
|
</tr>
|
28
|
-
<%
|
28
|
+
<% resque_admin.delayed_queue_peek(start, 20).each do |timestamp| %>
|
29
29
|
<tr>
|
30
30
|
<td>
|
31
31
|
<form action="<%= u "/delayed/queue_now" %>" method="post">
|
@@ -34,8 +34,8 @@
|
|
34
34
|
</form>
|
35
35
|
</td>
|
36
36
|
<td><a href="<%= u "delayed/#{timestamp}" %>"><%= format_time(Time.at(timestamp)) %></a></td>
|
37
|
-
<td><%= delayed_timestamp_size =
|
38
|
-
<% job =
|
37
|
+
<td><%= delayed_timestamp_size = resque_admin.delayed_timestamp_size(timestamp) %></td>
|
38
|
+
<% job = resque_admin.delayed_timestamp_peek(timestamp, 0, 1).first %>
|
39
39
|
<td>
|
40
40
|
<% if job && delayed_timestamp_size == 1 %>
|
41
41
|
<%= h(job['class']) %>
|
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
<h1>Delayed jobs scheduled for <%= format_time(Time.at(timestamp)) %></h1>
|
4
4
|
|
5
|
-
<p class='sub'>Showing <%= start = params[:start].to_i %> to <%= start + 20 %> of <b><%=size =
|
5
|
+
<p class='sub'>Showing <%= start = params[:start].to_i %> to <%= start + 20 %> of <b><%=size = resque_admin.delayed_timestamp_size(timestamp)%></b> jobs</p>
|
6
6
|
|
7
7
|
<table class='jobs'>
|
8
8
|
<tr>
|
9
9
|
<th>Class</th>
|
10
10
|
<th>Args</th>
|
11
11
|
</tr>
|
12
|
-
<% jobs =
|
12
|
+
<% jobs = resque_admin.delayed_timestamp_peek(timestamp, start, 20) %>
|
13
13
|
<% jobs.each do |job| %>
|
14
14
|
<tr>
|
15
15
|
<td class='class'><%= job['class'] %></td>
|
@@ -3,10 +3,10 @@
|
|
3
3
|
module ResqueAdmin
|
4
4
|
module Scheduler
|
5
5
|
class Util
|
6
|
-
# In order to upgrade to
|
6
|
+
# In order to upgrade to resque_admin(1.25) which has deprecated following
|
7
7
|
# methods, we just added these usefull helpers back to use in ResqueAdmin
|
8
8
|
# Scheduler. refer to:
|
9
|
-
# https://github.com/
|
9
|
+
# https://github.com/resque_admin/resque_admin-scheduler/pull/273
|
10
10
|
|
11
11
|
def self.constantize(camel_cased_word)
|
12
12
|
camel_cased_word = camel_cased_word.to_s
|