resque_admin-scheduler 1.1.7 → 1.1.8
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 +2 -2
- 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: 3e5a8a61a51bbfee69f4abb2faa779f948658bce
|
4
|
+
data.tar.gz: 8f9e774b9ab0a1339274f4ca7d3de16664ab911d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 526b76d3436f2ea29b0a0d7ca0e2ed99ccca16f368e163412f3ec77290bd0578ff8c8f7e5f41f173570b507d9ec4415e44d1f00f036b6553fc628ac7d563c3d8
|
7
|
+
data.tar.gz: 743b74596da7a6d8e38486797f662fb18a124aae67f4b014973c319b3b51cf2ad54f143a1fe0bec71253fb2ffb862931a7d7bd176998296d0b464f7289c71bb8
|
@@ -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/scheduler/cli'
|
13
|
+
autoload :Extension, 'resque/scheduler/extension'
|
14
|
+
autoload :Util, 'resque/scheduler/util'
|
15
|
+
autoload :VERSION, 'resque/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/worker.
|
42
|
+
# Fix buffering so we can `rake resque: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-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-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-scheduler [options]
|
24
24
|
|
25
|
-
Runs a
|
25
|
+
Runs a resque 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 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-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-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-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-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 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 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 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.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.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.delayed_timestamp_size(timestamp) %></td>
|
38
|
+
<% job = resque.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.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.delayed_timestamp_peek(timestamp, start, 20) %>
|
13
13
|
<% jobs.each do |job| %>
|
14
14
|
<tr>
|
15
15
|
<td class='class'><%= job['class'] %></td>
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require 'resque_admin/tasks'
|
4
4
|
require 'resque_admin-scheduler'
|
5
5
|
|
6
|
-
namespace :
|
6
|
+
namespace :resque do
|
7
7
|
task :setup
|
8
8
|
|
9
9
|
def scheduler_cli
|
@@ -20,6 +20,6 @@ namespace :resque_admin do
|
|
20
20
|
|
21
21
|
task :scheduler_setup do
|
22
22
|
scheduler_cli.parse_options
|
23
|
-
Rake::Task['
|
23
|
+
Rake::Task['resque:setup'].invoke unless scheduler_cli.pre_setup
|
24
24
|
end
|
25
25
|
end
|
@@ -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(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/resque-scheduler/pull/273
|
10
10
|
|
11
11
|
def self.constantize(camel_cased_word)
|
12
12
|
camel_cased_word = camel_cased_word.to_s
|