blue_colr 0.1.1 → 0.1.2
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.
- data/bin/bluecolrd +1 -1
- data/lib/blue_colr.rb +18 -9
- metadata +3 -3
data/bin/bluecolrd
CHANGED
@@ -149,7 +149,7 @@ begin
|
|
149
149
|
|
150
150
|
loop do
|
151
151
|
# get all pending items
|
152
|
-
pending_processes = @db[:process_items].filter(:status => BlueColr.get_pending_states).all
|
152
|
+
pending_processes = @db[:process_items].filter(:status => BlueColr.get_pending_states).filter(:environment => @environment).all
|
153
153
|
pending_processes = pending_processes.map do |process|
|
154
154
|
# get all the parents' statuses
|
155
155
|
parent_statuses = @db[:process_items].
|
data/lib/blue_colr.rb
CHANGED
@@ -9,18 +9,14 @@ require 'optparse'
|
|
9
9
|
require 'yaml'
|
10
10
|
require 'sequel'
|
11
11
|
|
12
|
-
|
12
|
+
# This class provides a DSL for enqueuing processes, at the same time describing their mutual dependance.
|
13
13
|
class BlueColr
|
14
|
-
|
15
|
-
#
|
16
|
-
# STATUS_PENDING = 'pending'
|
17
|
-
# STATUS_RUNNING = 'running'
|
18
|
-
# STATUS_PREPARING = 'preparing'
|
19
|
-
# STATUS_SKIPPED = 'skipped'
|
20
|
-
|
21
|
-
# default state transitions with simple state setup ('PENDING => RUNNING => OK or ERROR')
|
14
|
+
|
15
|
+
# If no alternative statemap is provided, all newly launched processes will have this state by default.
|
22
16
|
DEFAULT_PENDING_STATE = 'pending'
|
17
|
+
# Used internally.
|
23
18
|
PREPARING_STATE = 'preparing'
|
19
|
+
# Default state transitions with simple state setup ('PENDING => RUNNING => OK or ERROR')
|
24
20
|
DEFAULT_STATEMAP = {
|
25
21
|
'on_pending' => {
|
26
22
|
DEFAULT_PENDING_STATE => [
|
@@ -208,10 +204,14 @@ class BlueColr
|
|
208
204
|
self.class.log
|
209
205
|
end
|
210
206
|
|
207
|
+
# All processes enqueued within the given block should be executed sequentially,
|
208
|
+
# i.e. one after another.
|
211
209
|
def sequential &block
|
212
210
|
exec :sequential, &block
|
213
211
|
end
|
214
212
|
|
213
|
+
# All processes enqueued within the given block should be executed in parallel
|
214
|
+
# (not waiting for each other to finish).
|
215
215
|
def parallel &block
|
216
216
|
exec :parallel, &block
|
217
217
|
end
|
@@ -247,6 +247,15 @@ class BlueColr
|
|
247
247
|
id
|
248
248
|
end
|
249
249
|
|
250
|
+
# Enqueue a single command +cmd+.
|
251
|
+
#
|
252
|
+
# == Parameters
|
253
|
+
# cmd::
|
254
|
+
# A string containing the command that should be executed.
|
255
|
+
# options::
|
256
|
+
# A set of optional parameters which override default fields associated with the given command
|
257
|
+
# (e.g. here you can specify different +:environment+ that the command should be launched in,
|
258
|
+
# optional +:description+, or whatever you decide to store along the command).
|
250
259
|
def run cmd, opts = {}
|
251
260
|
id = enqueue cmd, @waitfor, opts
|
252
261
|
if @type == :sequential
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blue_colr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Mladen Jablanovic
|