right_chimp 1.0.9 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +4 -0
- data/lib/right_chimp/Chimp.rb +10 -3
- data/lib/right_chimp/daemon/ChimpDaemon.rb +1 -0
- data/lib/right_chimp/exec/Executor.rb +3 -0
- data/lib/right_chimp/queue/ChimpQueue.rb +8 -0
- data/lib/right_chimp/queue/ExecutionGroup.rb +12 -2
- data/lib/right_chimp/templates/all_jobs.erb +18 -9
- data/lib/right_chimp/version.rb +1 -1
- metadata +2 -2
data/CHANGES
CHANGED
@@ -117,3 +117,7 @@ Version 1.0.9
|
|
117
117
|
-------------
|
118
118
|
* Feature: Improved support for running chimp commands on any chimp daemon port
|
119
119
|
* Feature: Added inverted hot dog stand theme
|
120
|
+
|
121
|
+
Version 1.1.0
|
122
|
+
-------------
|
123
|
+
* Feature: Add a job state called 'holding' where jobs can be held until the user queues them
|
data/lib/right_chimp/Chimp.rb
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
module Chimp
|
6
6
|
class Chimp
|
7
|
-
attr_accessor :concurrency, :delay, :retry_count, :progress, :prompt,
|
7
|
+
attr_accessor :concurrency, :delay, :retry_count, :hold, :progress, :prompt,
|
8
8
|
:quiet, :use_chimpd, :chimpd_host, :chimpd_port, :tags, :array_names,
|
9
9
|
:deployment_names, :script, :servers, :ssh, :report, :interactive, :action,
|
10
10
|
:limit_start, :limit_end, :dry_run, :group, :job_id, :verify
|
@@ -34,6 +34,7 @@ module Chimp
|
|
34
34
|
@concurrency = 1
|
35
35
|
@delay = 0
|
36
36
|
@retry_count = 0
|
37
|
+
@hold = false
|
37
38
|
@timeout = 900
|
38
39
|
|
39
40
|
@limit_start = 0
|
@@ -205,6 +206,7 @@ module Chimp
|
|
205
206
|
[ '--concurrency', '-c', GetoptLong::REQUIRED_ARGUMENT ],
|
206
207
|
[ '--delay', '-d', GetoptLong::REQUIRED_ARGUMENT ],
|
207
208
|
[ '--retry', '-y', GetoptLong::REQUIRED_ARGUMENT ],
|
209
|
+
[ '--hold', '-7', GetoptLong::NO_ARGUMENT ],
|
208
210
|
[ '--dry-run', '-n', GetoptLong::NO_ARGUMENT ],
|
209
211
|
[ '--limit', '-l', GetoptLong::REQUIRED_ARGUMENT ],
|
210
212
|
[ '--version', '-1', GetoptLong::NO_ARGUMENT ],
|
@@ -282,6 +284,8 @@ module Chimp
|
|
282
284
|
@concurrency = arg.to_i
|
283
285
|
when '--delay', '-d'
|
284
286
|
@delay = arg.to_i
|
287
|
+
when '--hold', '-7'
|
288
|
+
@hold = true
|
285
289
|
when '--retry', '-y'
|
286
290
|
@retry_count = arg.to_i
|
287
291
|
when '--limit', '-l'
|
@@ -478,7 +482,7 @@ module Chimp
|
|
478
482
|
# each server for the script until we locate it.
|
479
483
|
#
|
480
484
|
if script and template == nil
|
481
|
-
Log.debug "
|
485
|
+
Log.debug "Getting template URI..."
|
482
486
|
|
483
487
|
if not servers.empty?
|
484
488
|
for i in (0..servers.size - 1)
|
@@ -588,7 +592,7 @@ module Chimp
|
|
588
592
|
script = ::RightScript.new({ :href => script_URI, :right_script => script_data })
|
589
593
|
end
|
590
594
|
else
|
591
|
-
Log.debug "
|
595
|
+
Log.debug "Looking for script \"#{script}\""
|
592
596
|
script = st.executables.detect { |ex| ex.name =~ /#{script}/ }
|
593
597
|
end
|
594
598
|
|
@@ -721,6 +725,8 @@ module Chimp
|
|
721
725
|
if e != nil
|
722
726
|
e.dry_run = @dry_run
|
723
727
|
e.quiet = @@quiet
|
728
|
+
e.status = Executor::STATUS_HOLDING if @hold
|
729
|
+
|
724
730
|
tasks.push(e)
|
725
731
|
end
|
726
732
|
|
@@ -1164,6 +1170,7 @@ module Chimp
|
|
1164
1170
|
puts "chimpd options:"
|
1165
1171
|
puts " --chimpd=<port> send jobs to chimpd listening on <port> on localhost"
|
1166
1172
|
puts " --chimpd-wait-until-done wait until all chimpd jobs are done"
|
1173
|
+
puts " --hold create a job in chimpd without executing until requested"
|
1167
1174
|
puts
|
1168
1175
|
puts "Misc Notes:"
|
1169
1176
|
puts " * If you leave the name of a --script or --ssh command blank, chimp will prompt you"
|
@@ -473,6 +473,7 @@ module Chimp
|
|
473
473
|
|
474
474
|
count_jobs_running = queue.get_jobs_by_status(:running).size
|
475
475
|
count_jobs_queued = queue.get_jobs_by_status(:none).size
|
476
|
+
count_jobs_holding = queue.get_jobs_by_status(:holding).size
|
476
477
|
count_jobs_failed = queue.get_jobs_by_status(:error).size
|
477
478
|
count_jobs_done = queue.get_jobs_by_status(:done).size
|
478
479
|
|
@@ -11,6 +11,7 @@ module Chimp
|
|
11
11
|
attr_reader :error, :results
|
12
12
|
|
13
13
|
STATUS_NONE = :none
|
14
|
+
STATUS_HOLDING = :holding
|
14
15
|
STATUS_RUNNING = :running
|
15
16
|
STATUS_RETRYING = :retrying
|
16
17
|
STATUS_ERROR = :error
|
@@ -93,6 +94,8 @@ module Chimp
|
|
93
94
|
# This is called from the subclass with a code block to yield to
|
94
95
|
#
|
95
96
|
def run_with_retry(&block)
|
97
|
+
Log.debug "Running job '#{@job_id}' with status '#{@status}'"
|
98
|
+
|
96
99
|
@status = STATUS_RUNNING
|
97
100
|
@time_start = Time.now
|
98
101
|
Log.info self.describe_work_start unless @quiet
|
@@ -48,6 +48,13 @@ module Chimp
|
|
48
48
|
# Push a task into the queue
|
49
49
|
#
|
50
50
|
def push(g, w)
|
51
|
+
if w.exec.right_script && w.exec.right_script.kind_of?(Hash)
|
52
|
+
Log.debug "Pushing job '#{w.exec.right_script['name']}' into group '#{g}'"
|
53
|
+
if w.status == Executor::STATUS_HOLDING
|
54
|
+
Log.info "Holding job '#{w.exec.right_script['name']}'"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
51
58
|
raise "no group specified" unless g
|
52
59
|
create_group(g) if not ChimpQueue[g]
|
53
60
|
ChimpQueue[g].push(w)
|
@@ -70,6 +77,7 @@ module Chimp
|
|
70
77
|
@group.values.each do |group|
|
71
78
|
if group.ready?
|
72
79
|
r = group.shift
|
80
|
+
Log.debug "Shifting job '#{r.job_id}' from group '#{group.group_id}'"
|
73
81
|
break
|
74
82
|
end
|
75
83
|
end
|
@@ -50,9 +50,18 @@ module Chimp
|
|
50
50
|
# Take something from the queue
|
51
51
|
#
|
52
52
|
def shift
|
53
|
-
|
53
|
+
updated_queue = []
|
54
|
+
found_job = nil
|
55
|
+
@queue.each do |job|
|
56
|
+
if found_job || job.status == Executor::STATUS_HOLDING
|
57
|
+
updated_queue.push(job)
|
58
|
+
else
|
59
|
+
found_job = job
|
60
|
+
end
|
61
|
+
end
|
62
|
+
@queue = updated_queue
|
54
63
|
@time_start = Time.now if @time_start == nil
|
55
|
-
return
|
64
|
+
return found_job
|
56
65
|
end
|
57
66
|
|
58
67
|
#
|
@@ -191,6 +200,7 @@ module Chimp
|
|
191
200
|
# Requeue a job by id
|
192
201
|
#
|
193
202
|
def requeue(id)
|
203
|
+
Log.debug "Requeuing job id #{id}"
|
194
204
|
job = @jobs_by_id[id]
|
195
205
|
job.status = Executor::STATUS_NONE
|
196
206
|
job.owner = nil
|
@@ -35,6 +35,9 @@ SINCE 2012</p>
|
|
35
35
|
<tr>
|
36
36
|
<td>Jobs running:</td>
|
37
37
|
<td><%= count_jobs_running %>
|
38
|
+
</tr><tr>
|
39
|
+
<td>Jobs holding:</td>
|
40
|
+
<td><%= count_jobs_holding %>
|
38
41
|
</tr><tr>
|
39
42
|
<td>Jobs waiting:</td>
|
40
43
|
<td><%= count_jobs_queued %>
|
@@ -60,14 +63,16 @@ SINCE 2012</p>
|
|
60
63
|
</div>
|
61
64
|
|
62
65
|
|
63
|
-
<h3>Filter Results</h3>
|
66
|
+
<h3>Filter Results By Job Status</h3>
|
64
67
|
|
65
68
|
<p>[
|
66
|
-
<% if job_filter == 'running' or job_filter == nil %>running
|
67
|
-
<% if job_filter == '
|
68
|
-
<% if job_filter == '
|
69
|
-
<% if job_filter == '
|
70
|
-
|
69
|
+
<% if job_filter == 'running' or job_filter == nil %>running<% else %><a href="/display/running">running</a><% end %> |
|
70
|
+
<% if job_filter == 'none' %>waiting<% else %><a href="/display/none">waiting</a> <% end %> |
|
71
|
+
<% if job_filter == 'holding' %>holding<% else %><a href="/display/holding">holding</a> <% end %> |
|
72
|
+
<% if job_filter == 'done' %>completed<% else %><a href="/display/done">completed</a><% end %> |
|
73
|
+
<% if job_filter == 'error' %>failed<% else %><a href="/display/error">failed</a><% end %>
|
74
|
+
|
|
75
|
+
<% if job_filter == 'all' %>all<% else %><a href="/display/all">all</a> <% end %> ]
|
71
76
|
</p>
|
72
77
|
|
73
78
|
<h3>Commands</h3>
|
@@ -147,12 +152,16 @@ jobs.each do |j|
|
|
147
152
|
<% end %>
|
148
153
|
|
149
154
|
<li> <span class="action">
|
150
|
-
<%
|
155
|
+
<% case status
|
156
|
+
when Executor::STATUS_ERROR %>
|
151
157
|
<a href="#" onclick="chimpd_job_control(this, '/job/<%=id%>/ack')">ack</a> |
|
152
158
|
<a href="#" onclick="chimpd_job_control(this, '/job/<%=id%>/retry')">retry</a>
|
153
|
-
<%
|
159
|
+
<% when Executor::STATUS_RUNNING, Executor::STATUS_RETRYING, Executor::STATUS_NONE %>
|
160
|
+
<a href="#" onclick="chimpd_job_control(this, '/job/<%=id%>/cancel')">cancel</a>
|
161
|
+
<% when Executor::STATUS_HOLDING %>
|
162
|
+
<a href="#" onclick="chimpd_job_control(this, '/job/<%=id%>/retry')">queue</a>
|
154
163
|
<a href="#" onclick="chimpd_job_control(this, '/job/<%=id%>/cancel')">cancel</a>
|
155
|
-
<%
|
164
|
+
<% when Executor::STATUS_DONE %>
|
156
165
|
<a href="#" onclick="chimpd_job_control(this, '/job/<%=id%>/retry')">requeue</a>
|
157
166
|
<% end %>
|
158
167
|
</li>
|
data/lib/right_chimp/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: right_chimp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-11-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest_connection
|