right_chimp 2.1.22.2 → 2.1.24
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/CHANGES +135 -126
- data/Gemfile.lock +2 -2
- data/lib/right_chimp/Chimp.rb +28 -17
- data/lib/right_chimp/daemon/ChimpDaemon.rb +42 -11
- data/lib/right_chimp/daemon/ChimpDaemonClient.rb +2 -2
- data/lib/right_chimp/queue/ChimpQueue.rb +2 -1
- data/lib/right_chimp/queue/ExecutionGroup.rb +5 -5
- data/lib/right_chimp/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3b8353c389aaf578df02f964a87778706144628b
|
|
4
|
+
data.tar.gz: 42bae4bf2b3e4246cf5ee31fea1709e42a3be2d7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a60272b66e310894fdbbc393b5010dd12eeb9380c65aeeea84c5d152390edbf8a7f7a5330aea4188c2e8a4dd747b4502656278cac1ba4e29d71d22f6c3956559
|
|
7
|
+
data.tar.gz: 8edc1310533df69e7a192019c77aca13a799f529bc5b07de5eb0f7ea3af9d02a7b46cbb8efc796ab4b3f8fcf380a54f73252eacf1b4a7d704da1f61e3420ee47
|
data/CHANGES
CHANGED
|
@@ -1,190 +1,199 @@
|
|
|
1
|
-
Version
|
|
1
|
+
Version 2.1.24
|
|
2
2
|
--------------
|
|
3
|
-
*
|
|
3
|
+
* Feature: We now ensure jobs are added and tracked into the processing status before sending a 200 back to
|
|
4
|
+
the client. As a result chimp wait until will never skip a group because of slow API performance.
|
|
4
5
|
|
|
5
|
-
Version
|
|
6
|
-
|
|
7
|
-
* Feature:
|
|
8
|
-
* Feature: initial release of chimpd
|
|
6
|
+
Version 2.1.23
|
|
7
|
+
--------------
|
|
8
|
+
* Feature: better chimp wait until done messaging.
|
|
9
9
|
|
|
10
|
-
Version
|
|
11
|
-
|
|
12
|
-
* Bugfix:
|
|
10
|
+
Version 2.1.22.2
|
|
11
|
+
--------------
|
|
12
|
+
* Bugfix: don't consume CPU in 'pause' mode
|
|
13
13
|
|
|
14
|
-
Version
|
|
15
|
-
|
|
16
|
-
*
|
|
17
|
-
* Feature: Array instance execution now includes error checking (requires API 0.1)
|
|
18
|
-
* Change: The work queue is now sorted by server name initially
|
|
19
|
-
* Change: Refactored chimp and chimpd scripts into Real Ruby Objects
|
|
14
|
+
Version 2.1.22.1
|
|
15
|
+
--------------
|
|
16
|
+
* Bugfix: don't show retry/abort/ignore prompt in 'pause' mode
|
|
20
17
|
|
|
21
|
-
Version
|
|
22
|
-
|
|
23
|
-
*
|
|
24
|
-
* Feature: chimp will now display a list of scripts to choose from
|
|
18
|
+
Version 2.1.22
|
|
19
|
+
--------------
|
|
20
|
+
* Bugfix: use 'pause' behaviour if there are no contents in stdin
|
|
25
21
|
|
|
26
|
-
Version
|
|
27
|
-
|
|
28
|
-
*
|
|
29
|
-
* Bugfix: fixed --script href bug
|
|
30
|
-
* Bugfix: fix chimpd submission from chimp exit code
|
|
22
|
+
Version 2.1.21
|
|
23
|
+
--------------
|
|
24
|
+
* Bugfix: Pull the correct path whenever loading up the erb template in webui.
|
|
31
25
|
|
|
32
|
-
Version
|
|
26
|
+
Version 2.1.20
|
|
27
|
+
--------------
|
|
28
|
+
* Bugfix: We now correctly report the correct number of tasks waiting, in the json interface
|
|
29
|
+
|
|
30
|
+
Version 2.1.19.1
|
|
31
|
+
--------------
|
|
32
|
+
Reverted bad release
|
|
33
|
+
|
|
34
|
+
Version 2.1.16
|
|
35
|
+
--------------
|
|
36
|
+
* Bugfix: chimp --wait-until-done now honors the noprompt flag.
|
|
37
|
+
|
|
38
|
+
Version 2.1.15
|
|
39
|
+
---------------
|
|
40
|
+
* Feature: We now are able to query a subset of job_uuids and total stats format.
|
|
41
|
+
|
|
42
|
+
Version 2.1.13
|
|
43
|
+
--------------
|
|
44
|
+
* Feature: Web UI now shows job_uuid
|
|
45
|
+
* Feature: Changed error reporting format
|
|
46
|
+
* Feature: One can now associate a "note" to a job by using --job-notes="foo"
|
|
47
|
+
|
|
48
|
+
Version 2.1.4
|
|
33
49
|
-------------
|
|
34
|
-
* Bugfix:
|
|
35
|
-
* Feature: Improved ability to ignore runaway tasks in chimpd
|
|
50
|
+
* Bugfix: Fixed UI issues casued by long job names
|
|
36
51
|
|
|
37
|
-
Version
|
|
52
|
+
Version 2.1.3
|
|
38
53
|
-------------
|
|
39
|
-
* Feature:
|
|
54
|
+
* Feature: chimpd-wait-until now dsiplays the group name it is waiting on every 120secs
|
|
40
55
|
|
|
41
|
-
Version
|
|
56
|
+
Version 2.1
|
|
57
|
+
-----------
|
|
58
|
+
* 'Feature': Updated to run with Ruby 2.2.2, with minor version increment accoridngly.
|
|
59
|
+
|
|
60
|
+
Version 2.0
|
|
61
|
+
-----------
|
|
62
|
+
* Feature: Deprecated all Rightscale API1.0 calls in favor of Rightscale API1.5 and API1.6 calls.
|
|
63
|
+
|
|
64
|
+
Version 1.1.3
|
|
42
65
|
-------------
|
|
43
|
-
*
|
|
44
|
-
* Feature: add ignore-errors command line flag
|
|
45
|
-
* Feature: now using the USER environment variable for ssh jobs
|
|
66
|
+
* Bugfix: Fix issue where queued/held jobs move into a waiting state and do nothing
|
|
46
67
|
|
|
47
|
-
Version
|
|
68
|
+
Version 1.1.2
|
|
48
69
|
-------------
|
|
49
|
-
* Bugfix:
|
|
70
|
+
* Bugfix: Fix issue where ssh commands were non-functional
|
|
71
|
+
* Bugfix: Fix queueing of 'held' jobs to pull no more than one job from the queue
|
|
50
72
|
|
|
51
|
-
Version
|
|
73
|
+
Version 1.1.1
|
|
52
74
|
-------------
|
|
53
|
-
* Bugfix:
|
|
75
|
+
* Bugfix: Enable timeouts on server arrays
|
|
54
76
|
|
|
55
|
-
Version
|
|
77
|
+
Version 1.1.0
|
|
56
78
|
-------------
|
|
57
|
-
* Feature:
|
|
58
|
-
* Feature: retry/cancel all button added to chimpd
|
|
79
|
+
* Feature: Add a job state called 'holding' where jobs can be held until the user queues them
|
|
59
80
|
|
|
60
|
-
Version 0.
|
|
81
|
+
Version 1.0.9
|
|
61
82
|
-------------
|
|
62
|
-
* Feature:
|
|
63
|
-
* Feature:
|
|
64
|
-
* Feature: new chimpd web interface skin
|
|
65
|
-
* Feature: retry failed and cancel running
|
|
66
|
-
* Feature: improved logging in chimpd
|
|
83
|
+
* Feature: Improved support for running chimp commands on any chimp daemon port
|
|
84
|
+
* Feature: Added inverted hot dog stand theme
|
|
67
85
|
|
|
68
|
-
Version 0.5
|
|
86
|
+
Version 1.0.5
|
|
69
87
|
-------------
|
|
70
|
-
* Feature:
|
|
88
|
+
* Feature: improved error handling and logging when submitting to chimpd
|
|
71
89
|
|
|
72
|
-
Version 0.
|
|
90
|
+
Version 1.0.4
|
|
73
91
|
-------------
|
|
74
|
-
* Feature:
|
|
92
|
+
* Feature: chimp output when using chimpd is better behaved
|
|
93
|
+
* Feature: chimpd client now log errors better, retries on failure
|
|
94
|
+
* Feature: chimp --chimpd-wait-until-done now returns immediately during a dry run
|
|
95
|
+
* Feature: chimp --chimpd-wait-until-done now blocks until a group has completed > 1 job
|
|
75
96
|
|
|
76
|
-
Version 0.
|
|
97
|
+
Version 1.0.3
|
|
77
98
|
-------------
|
|
78
|
-
* Bugfix:
|
|
99
|
+
* Bugfix: fix race condition in chimpd serial groups
|
|
79
100
|
|
|
80
|
-
Version 0.
|
|
101
|
+
Version 1.0.2
|
|
81
102
|
-------------
|
|
82
|
-
*
|
|
83
|
-
* Feature: The --report flag now sets quiet mode and concurrency=5 by default
|
|
103
|
+
* Feature: Add support for specifying inputs on the command line when working with arrays
|
|
84
104
|
|
|
85
|
-
Version 0.
|
|
105
|
+
Version 1.0.1
|
|
86
106
|
-------------
|
|
87
|
-
*
|
|
107
|
+
* Add missing ERB template for chimpd
|
|
88
108
|
|
|
89
109
|
Version 1.0
|
|
90
110
|
-----------
|
|
91
111
|
* Initial open source release
|
|
92
112
|
|
|
93
|
-
Version
|
|
113
|
+
Version 0.5.5
|
|
94
114
|
-------------
|
|
95
|
-
*
|
|
115
|
+
* Bugfix: --limit flag wasn't sorting servers before executing
|
|
96
116
|
|
|
97
|
-
Version
|
|
117
|
+
Version 0.5.4
|
|
98
118
|
-------------
|
|
99
|
-
* Feature:
|
|
119
|
+
* Feature: The --report flag now sets quiet mode and concurrency=5 by default
|
|
120
|
+
* Bugfix: reduce log output during reporting
|
|
100
121
|
|
|
101
|
-
Version
|
|
122
|
+
Version 0.5.3
|
|
102
123
|
-------------
|
|
103
|
-
* Bugfix:
|
|
124
|
+
* Bugfix: non-operational array instances are no longer operated upon
|
|
104
125
|
|
|
105
|
-
Version
|
|
126
|
+
Version 0.5.2
|
|
106
127
|
-------------
|
|
107
|
-
* Feature:
|
|
108
|
-
* Feature: chimp --chimpd-wait-until-done now returns immediately during a dry run
|
|
109
|
-
* Feature: chimpd client now log errors better, retries on failure
|
|
110
|
-
* Feature: chimp output when using chimpd is better behaved
|
|
128
|
+
* Feature: --noverify flag disables interactive verification of errors
|
|
111
129
|
|
|
112
|
-
Version
|
|
130
|
+
Version 0.5.1
|
|
113
131
|
-------------
|
|
114
|
-
* Feature:
|
|
132
|
+
* Feature: move run_script_on_instances from API 0.1 to API 1.0 (rest_connection 06df205d7f)
|
|
115
133
|
|
|
116
|
-
Version
|
|
134
|
+
Version 0.5.0
|
|
117
135
|
-------------
|
|
118
|
-
* Feature:
|
|
119
|
-
* Feature:
|
|
136
|
+
* Feature: improved logging in chimpd
|
|
137
|
+
* Feature: retry failed and cancel running
|
|
138
|
+
* Feature: new chimpd web interface skin
|
|
139
|
+
* Feature: detailed execution time reporting
|
|
140
|
+
* Feature: rewrite of queue system to support task grouping
|
|
120
141
|
|
|
121
|
-
Version
|
|
142
|
+
Version 0.4.9
|
|
122
143
|
-------------
|
|
123
|
-
* Feature:
|
|
144
|
+
* Feature: retry/cancel all button added to chimpd
|
|
145
|
+
* Feature: log actions to file
|
|
124
146
|
|
|
125
|
-
Version
|
|
147
|
+
Version 0.4.8
|
|
126
148
|
-------------
|
|
127
|
-
* Bugfix:
|
|
149
|
+
* Bugfix: chimpd --verbose
|
|
128
150
|
|
|
129
|
-
Version
|
|
151
|
+
Version 0.4.6
|
|
130
152
|
-------------
|
|
131
|
-
* Bugfix:
|
|
132
|
-
* Bugfix: Fix issue where ssh commands were non-functional
|
|
153
|
+
* Bugfix: add --ssh-user flag to replace buggy USER env. variable feature
|
|
133
154
|
|
|
134
|
-
Version
|
|
155
|
+
Version 0.4.5
|
|
135
156
|
-------------
|
|
136
|
-
*
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
-----------
|
|
140
|
-
* Feature: Deprecated all Rightscale API1.0 calls in favor of Rightscale API1.5 and API1.6 calls.
|
|
141
|
-
|
|
142
|
-
Version 2.1
|
|
143
|
-
-----------
|
|
144
|
-
* 'Feature': Updated to run with Ruby 2.2.2, with minor version increment accoridngly.
|
|
157
|
+
* Feature: now using the USER environment variable for ssh jobs
|
|
158
|
+
* Feature: add ignore-errors command line flag
|
|
159
|
+
* Feature: add support for setting inputs when executing RightScripts (--input)
|
|
145
160
|
|
|
146
|
-
Version
|
|
161
|
+
Version 0.4.3
|
|
147
162
|
-------------
|
|
148
|
-
* Feature:
|
|
163
|
+
* Feature: If ServerArrays cannot be found, print a warning instead of failing
|
|
149
164
|
|
|
150
|
-
Version
|
|
165
|
+
Version 0.4.2
|
|
151
166
|
-------------
|
|
152
|
-
*
|
|
153
|
-
|
|
154
|
-
Version 2.1.13
|
|
155
|
-
--------------
|
|
156
|
-
* Feature: Changed error reporting format
|
|
157
|
-
* Feature: Web UI now shows job_uuid
|
|
158
|
-
* Feature: One can now associate a "note" to a job by using --job-notes="foo"
|
|
159
|
-
|
|
160
|
-
Version 2.1.15
|
|
161
|
-
---------------
|
|
162
|
-
* Feature: We now are able to query a subset of job_uuids and total stats format.
|
|
163
|
-
|
|
164
|
-
Version 2.1.16
|
|
165
|
-
--------------
|
|
166
|
-
* Bugfix: chimp --wait-until-done now honors the noprompt flag.
|
|
167
|
+
* Feature: Improved ability to ignore runaway tasks in chimpd
|
|
168
|
+
* Bugfix: fixed chimpd submission
|
|
167
169
|
|
|
168
|
-
Version
|
|
169
|
-
|
|
170
|
-
|
|
170
|
+
Version 0.4.1
|
|
171
|
+
-------------
|
|
172
|
+
* Bugfix: fix chimpd submission from chimp exit code
|
|
173
|
+
* Bugfix: fixed --script href bug
|
|
174
|
+
* Feature: specify --script via numerical script id instead of full href
|
|
171
175
|
|
|
172
|
-
Version
|
|
173
|
-
|
|
174
|
-
*
|
|
176
|
+
Version 0.4.0
|
|
177
|
+
-------------
|
|
178
|
+
* Feature: chimp will now display a list of scripts to choose from
|
|
179
|
+
* Feature: "chimpd --exit" can be used to stop a chimpd server
|
|
175
180
|
|
|
176
|
-
Version
|
|
177
|
-
|
|
178
|
-
*
|
|
181
|
+
Version 0.3.0
|
|
182
|
+
-------------
|
|
183
|
+
* Change: Refactored chimp and chimpd scripts into Real Ruby Objects
|
|
184
|
+
* Change: The work queue is now sorted by server name initially
|
|
185
|
+
* Feature: Array instance execution now includes error checking (requires API 0.1)
|
|
186
|
+
* Feature: New --dry-run option
|
|
179
187
|
|
|
180
|
-
Version 2.
|
|
181
|
-
|
|
182
|
-
* Bugfix:
|
|
188
|
+
Version 0.2.3
|
|
189
|
+
-------------
|
|
190
|
+
* Bugfix: chimpd job id management was broken in some places
|
|
183
191
|
|
|
184
|
-
Version 2.
|
|
185
|
-
|
|
186
|
-
*
|
|
192
|
+
Version 0.2.2
|
|
193
|
+
-------------
|
|
194
|
+
* Feature: initial release of chimpd
|
|
195
|
+
* Feature: you can now specify a --script via its URI
|
|
187
196
|
|
|
188
|
-
Version 2.
|
|
189
|
-
|
|
190
|
-
*
|
|
197
|
+
Version 0.2.0
|
|
198
|
+
-------------
|
|
199
|
+
* Initial non-alpha release
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
right_chimp (2.1.
|
|
4
|
+
right_chimp (2.1.24)
|
|
5
5
|
highline (~> 1.7.2)
|
|
6
6
|
nokogiri (~> 1.6.7.1)
|
|
7
7
|
progressbar (~> 0.11.0)
|
|
@@ -16,7 +16,7 @@ GEM
|
|
|
16
16
|
coderay (1.1.1)
|
|
17
17
|
debug_inspector (0.0.2)
|
|
18
18
|
diff-lcs (1.1.3)
|
|
19
|
-
domain_name (0.5.
|
|
19
|
+
domain_name (0.5.20160826)
|
|
20
20
|
unf (>= 0.0.5, < 1.0.0)
|
|
21
21
|
highline (1.7.8)
|
|
22
22
|
http-cookie (1.0.2)
|
data/lib/right_chimp/Chimp.rb
CHANGED
|
@@ -1103,36 +1103,40 @@ module Chimp
|
|
|
1103
1103
|
# This is used by chimpd, when processing a task.
|
|
1104
1104
|
#
|
|
1105
1105
|
def process
|
|
1106
|
+
|
|
1106
1107
|
Chimp.set_failure(false)
|
|
1107
|
-
Chimp.set_job_uuid(
|
|
1108
|
+
Chimp.set_job_uuid(job_uuid)
|
|
1108
1109
|
|
|
1109
|
-
Log.debug "[#{
|
|
1110
|
+
Log.debug "[#{job_uuid}] Processing task"
|
|
1110
1111
|
# Add to our "processing" counter
|
|
1111
1112
|
|
|
1112
|
-
Log.debug "[#{
|
|
1113
|
+
Log.debug "[#{job_uuid}] Trying to get array_info" unless Chimp.failure
|
|
1113
1114
|
get_array_info unless Chimp.failure
|
|
1114
1115
|
|
|
1115
|
-
Log.debug "[#{
|
|
1116
|
+
Log.debug "[#{job_uuid}] Trying to get server_info" unless Chimp.failure
|
|
1116
1117
|
get_server_info unless Chimp.failure
|
|
1117
1118
|
|
|
1118
|
-
Log.debug "[#{
|
|
1119
|
+
Log.debug "[#{job_uuid}] Trying to get template_info" unless Chimp.failure
|
|
1119
1120
|
get_template_info unless Chimp.failure
|
|
1120
1121
|
|
|
1121
|
-
Log.debug "[#{
|
|
1122
|
+
Log.debug "[#{job_uuid}] Trying to get executable_info" unless Chimp.failure
|
|
1122
1123
|
get_executable_info unless Chimp.failure
|
|
1123
1124
|
|
|
1124
1125
|
# All elements of task have been processed
|
|
1125
1126
|
ChimpDaemon.instance.semaphore.synchronize do
|
|
1127
|
+
# remove from the processing queue
|
|
1128
|
+
Log.debug 'Removing job: ' + job_uuid + ' from the processing queue for group: ' + group.to_s
|
|
1129
|
+
ChimpDaemon.instance.queue.processing[group].delete(job_uuid)
|
|
1126
1130
|
ChimpDaemon.instance.proc_counter -= 1
|
|
1127
1131
|
end
|
|
1128
1132
|
|
|
1129
1133
|
if Chimp.failure
|
|
1130
1134
|
|
|
1131
|
-
Log.error
|
|
1132
|
-
Log.error
|
|
1133
|
-
Log.error
|
|
1134
|
-
Log.error
|
|
1135
|
-
Log.error
|
|
1135
|
+
Log.error '##################################################'
|
|
1136
|
+
Log.error '[' + job_uuid + '] API CALL FAILED FOR:'
|
|
1137
|
+
Log.error '[' + job_uuid + "] chimp #{@cli_args} "
|
|
1138
|
+
Log.error '[' + job_uuid + '] Run manually!'
|
|
1139
|
+
Log.error '##################################################'
|
|
1136
1140
|
return []
|
|
1137
1141
|
else
|
|
1138
1142
|
if @servers.first.nil? or @executable.nil?
|
|
@@ -1183,17 +1187,24 @@ module Chimp
|
|
|
1183
1187
|
all = ChimpDaemonClient.retrieve_group_info(@chimpd_host, @chimpd_port, @group, :all)
|
|
1184
1188
|
rescue RestClient::ResourceNotFound
|
|
1185
1189
|
sleep 5
|
|
1186
|
-
$stdout.print "\nINFO: Waiting on group #{@group}"
|
|
1190
|
+
$stdout.print "\nINFO: Waiting on group #{@group} to populate"
|
|
1187
1191
|
retry
|
|
1188
1192
|
end
|
|
1189
1193
|
|
|
1190
1194
|
ChimpQueue.instance.create_group(@group)
|
|
1191
1195
|
ChimpQueue[@group].set_jobs(all)
|
|
1192
1196
|
|
|
1193
|
-
|
|
1197
|
+
if ChimpQueue[@group].done?
|
|
1198
|
+
Log.debug 'Group ' + @group.to_s + ' is completed'
|
|
1199
|
+
jobs = ChimpQueue[@group].size
|
|
1200
|
+
$stdout.print "\nINFO: Group #{@group} has completed (#{jobs} jobs)"
|
|
1201
|
+
break
|
|
1202
|
+
else
|
|
1203
|
+
Log.debug 'Group ' + @group.to_s + ' is not done.'
|
|
1204
|
+
end
|
|
1194
1205
|
|
|
1195
1206
|
if sleeping_counter % 240 == 0
|
|
1196
|
-
$stdout.print "\
|
|
1207
|
+
$stdout.print "\n(Still) Waiting for group #{@group}" unless sleeping_counter == 0
|
|
1197
1208
|
end
|
|
1198
1209
|
$stdout.print "."
|
|
1199
1210
|
$stdout.flush
|
|
@@ -1205,11 +1216,11 @@ module Chimp
|
|
|
1205
1216
|
# If verify_results returns false, then ask chimpd to requeue all failed jobs.
|
|
1206
1217
|
#
|
|
1207
1218
|
case verify_results(@group)
|
|
1208
|
-
when
|
|
1219
|
+
when 'continue'
|
|
1209
1220
|
break
|
|
1210
|
-
when
|
|
1221
|
+
when 'retry'
|
|
1211
1222
|
ChimpDaemonClient.retry_group(@chimpd_host, @chimpd_port, @group)
|
|
1212
|
-
when
|
|
1223
|
+
when 'pause'
|
|
1213
1224
|
@paused = true
|
|
1214
1225
|
#stuck in this loop until action is taken
|
|
1215
1226
|
end
|
|
@@ -250,11 +250,9 @@ module Chimp
|
|
|
250
250
|
(1..n).each do |n|
|
|
251
251
|
@threads ||=[]
|
|
252
252
|
@threads << Thread.new {
|
|
253
|
-
|
|
254
253
|
while true
|
|
255
254
|
begin
|
|
256
255
|
|
|
257
|
-
|
|
258
256
|
queued_request = @chimp_queue.pop
|
|
259
257
|
group = queued_request.group
|
|
260
258
|
queued_request.interactive = false
|
|
@@ -343,14 +341,38 @@ module Chimp
|
|
|
343
341
|
# /group/<name>/<status>
|
|
344
342
|
#
|
|
345
343
|
def do_GET(req, resp)
|
|
346
|
-
jobs =
|
|
344
|
+
jobs = []
|
|
345
|
+
Log.debug 'get group info'
|
|
347
346
|
|
|
348
347
|
group_name = req.request_uri.path.split('/')[-2]
|
|
349
348
|
filter = req.request_uri.path.split('/')[-1]
|
|
349
|
+
# Quickly check processing jobs just in case
|
|
350
|
+
# Instance the entire queue
|
|
351
|
+
q = ChimpQueue.instance
|
|
352
|
+
g2 = q.processing[group_name.to_sym]
|
|
353
|
+
|
|
354
|
+
if g2
|
|
355
|
+
Log.debug 'Found processing job(s): ' + g2.inspect
|
|
356
|
+
else
|
|
357
|
+
Log.debug 'not found any processing jobs for that group: ' + g2.inspect
|
|
358
|
+
end
|
|
359
|
+
|
|
350
360
|
g = ChimpQueue[group_name.to_sym]
|
|
351
|
-
raise WEBrick::HTTPStatus::NotFound,
|
|
352
|
-
jobs = g.get_jobs_by_status(filter)
|
|
361
|
+
raise WEBrick::HTTPStatus::NotFound, 'Group not found' unless g || g2
|
|
362
|
+
jobs = g.get_jobs_by_status(filter) if g
|
|
363
|
+
|
|
364
|
+
# If there are processing jobs, add them as dummy executions.
|
|
365
|
+
if g2
|
|
366
|
+
Log.debug 'Group: ' + group_name + ' is processing:'
|
|
367
|
+
g2.each do |job|
|
|
368
|
+
Log.debug 'Job: ' + job
|
|
369
|
+
j = ExecRightScript.new(group: group_name, job_uuid: job)
|
|
370
|
+
jobs.push j
|
|
371
|
+
end
|
|
372
|
+
end
|
|
373
|
+
|
|
353
374
|
resp.body = jobs.to_yaml
|
|
375
|
+
|
|
354
376
|
raise WEBrick::HTTPStatus::OK
|
|
355
377
|
end
|
|
356
378
|
|
|
@@ -407,19 +429,28 @@ module Chimp
|
|
|
407
429
|
# Ask chimpd to process a Chimp object directly
|
|
408
430
|
#
|
|
409
431
|
if verb == 'process' or verb == 'add'
|
|
432
|
+
# comment the next line to GET STUCK IN PROCESSING forever
|
|
410
433
|
ChimpDaemon.instance.chimp_queue.push payload
|
|
411
434
|
ChimpDaemon.instance.semaphore.synchronize do
|
|
412
|
-
|
|
435
|
+
# While we are at it, we will store these processing jobs to prevent issues in the event
|
|
436
|
+
# of a very slow API response.
|
|
437
|
+
Log.debug 'Adding job: ' + job_uuid + ' to the processing queue for group: ' + group.to_s
|
|
438
|
+
q.processing[payload.group] = [] if q.processing[payload.group].nil?
|
|
439
|
+
q.processing[payload.group].push(payload.job_uuid)
|
|
440
|
+
|
|
441
|
+
ChimpDaemon.instance.proc_counter += 1
|
|
413
442
|
end
|
|
414
|
-
|
|
415
|
-
|
|
443
|
+
|
|
444
|
+
Log.debug 'Tasks in the processing queue:' + ChimpDaemon.instance.proc_counter.to_s
|
|
445
|
+
Log.debug 'Pocessing:'
|
|
446
|
+
Log.debug q.processing.inspect
|
|
416
447
|
elsif verb == 'update'
|
|
417
|
-
puts
|
|
448
|
+
puts 'UPDATE'
|
|
418
449
|
q.get_job(job_id).status = payload.status
|
|
419
450
|
end
|
|
420
451
|
|
|
421
452
|
resp.body = {
|
|
422
|
-
'job_uuid' => job_uuid
|
|
453
|
+
'job_uuid' => job_uuid,
|
|
423
454
|
'id' => job_id
|
|
424
455
|
}.to_yaml
|
|
425
456
|
|
|
@@ -429,7 +460,7 @@ module Chimp
|
|
|
429
460
|
def do_GET(req, resp)
|
|
430
461
|
id = self.get_id(req)
|
|
431
462
|
verb = self.get_verb(req)
|
|
432
|
-
job_results =
|
|
463
|
+
job_results = 'OK'
|
|
433
464
|
queue = ChimpQueue.instance
|
|
434
465
|
|
|
435
466
|
#
|
|
@@ -23,10 +23,10 @@ module Chimp
|
|
|
23
23
|
id = YAML::load(response.body)['id']
|
|
24
24
|
#ID changes upon execution, not upon submission.
|
|
25
25
|
job_uuid = YAML::load(response.body)['job_uuid']
|
|
26
|
-
puts
|
|
26
|
+
puts '[' + job_uuid + ']'
|
|
27
27
|
return true
|
|
28
28
|
else
|
|
29
|
-
$stderr.puts
|
|
29
|
+
$stderr.puts '[' + job_uuid + "] WARNING: error submitting to chimpd! response code: #{response.code}"
|
|
30
30
|
return false
|
|
31
31
|
end
|
|
32
32
|
|
|
@@ -6,7 +6,7 @@ module Chimp
|
|
|
6
6
|
class ChimpQueue
|
|
7
7
|
include Singleton
|
|
8
8
|
|
|
9
|
-
attr_accessor :delay, :retry_count, :max_threads, :group
|
|
9
|
+
attr_accessor :delay, :retry_count, :max_threads, :group, :processing
|
|
10
10
|
|
|
11
11
|
def initialize
|
|
12
12
|
@delay = 0
|
|
@@ -15,6 +15,7 @@ module Chimp
|
|
|
15
15
|
@workers_never_exit = true
|
|
16
16
|
@threads = []
|
|
17
17
|
@semaphore = Mutex.new
|
|
18
|
+
@processing = {}
|
|
18
19
|
self.reset!
|
|
19
20
|
end
|
|
20
21
|
|
|
@@ -172,8 +172,8 @@ module Chimp
|
|
|
172
172
|
return (
|
|
173
173
|
get_jobs_by_status(Executor::STATUS_NONE).size == 0 &&
|
|
174
174
|
get_jobs_by_status(Executor::STATUS_RUNNING).size == 0 &&
|
|
175
|
-
|
|
176
|
-
|
|
175
|
+
get_jobs_by_status(Executor::STATUS_DONE).size > 0
|
|
176
|
+
)
|
|
177
177
|
end
|
|
178
178
|
|
|
179
179
|
#
|
|
@@ -181,9 +181,9 @@ module Chimp
|
|
|
181
181
|
#
|
|
182
182
|
def running?
|
|
183
183
|
total_jobs_running = get_jobs_by_status(Executor::STATUS_NONE).size +
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
184
|
+
get_jobs_by_status(Executor::STATUS_RUNNING).size +
|
|
185
|
+
get_jobs_by_status(Executor::STATUS_RETRYING).size
|
|
186
|
+
(total_jobs_running > 0)
|
|
187
187
|
end
|
|
188
188
|
|
|
189
189
|
#
|
data/lib/right_chimp/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: right_chimp
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.1.
|
|
4
|
+
version: 2.1.24
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- RightScale Operations
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2016-09-
|
|
11
|
+
date: 2016-09-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rake
|