task-orchestrator 0.0.24 → 0.0.25

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bbae6a935dbfe404d446bfd999e02d593d0a5035
4
- data.tar.gz: 3c498d82e8a231ad8e65a0f019cac1c2dccb24b0
3
+ metadata.gz: d429c26750c50b057de12c86cfa1f9a35d712103
4
+ data.tar.gz: ecc803f3b40cb903e9093cafc70e236ebfb89cf2
5
5
  SHA512:
6
- metadata.gz: 645cb8b67b0a97e4dd27d9bde36ff6651ae93d55ee3a0085ba477a50a3f580f433d129ebb41d082f132b60ab62f3092f6d16df29d9249c18d9654107017c5f3b
7
- data.tar.gz: b696ddba05522ec91571062d662a5a55438b5567d40d210915f3f1497c10c61630df79f88c93d5514231d6b60f326244fe719ecceee91fb32b7630d5692919ed
6
+ metadata.gz: f7358c4788335a26d19a4c2c39a8a61e20abfefd6c955a3c3d94306f2c9db521f72a30a736d07b1b0a94e1f8fc0265922b46d196697ad988acad503c92ceef00
7
+ data.tar.gz: 91229f1333d4295043be212de1268c6b000acc458535d220a412f4f8f41cf65db034af13701834b4d09f8e8f0592f284869463bad221ca81392142a9448f1c70
@@ -0,0 +1,10 @@
1
+ orchestrator:
2
+ statedir: states
3
+ nested_loop:
4
+ description: nested loop test
5
+ save: true
6
+ steps:
7
+ - type: sequential
8
+ nested_loop: [[a,b],[x,y],[1,2]]
9
+ scripts:
10
+ - command: "echo :::LOOP.0::: :::LOOP.1::: :::LOOP.2:::"
@@ -142,6 +142,11 @@ module Orchestrator
142
142
  invalid("interpolation type is not valid in this context - :::#{match}:::") if match !~ pattern and match =~ /^(ENV|ARG|EXEC)\./
143
143
 
144
144
  case match
145
+ when /^LOOP\.\d$/
146
+ require 'pp'
147
+ invalid("command interpolation failed not nested loop type step") unless @nested_loop_param
148
+ i = match.match(/^LOOP\.(\d)$/)[1].to_i
149
+ @nested_loop_param[i] ? @nested_loop_param[i] : invalid("command interpolation failed unexisting nesting #{match}")
145
150
  when /^LOOP$/
146
151
  invalid("command interpolation failed not loop type step") unless @loop_param
147
152
  @loop_param
@@ -238,6 +243,30 @@ module Orchestrator
238
243
  end
239
244
  step['scripts'] = scripts
240
245
  step.delete('loop')
246
+ elsif step.has_key?('nested_loop')
247
+ invalid("task step nested loop is not array") unless step['nested_loop'].is_a?(Array)
248
+ step['nested_loop'].each do |loop|
249
+ invalid("task step nested loop is not array of arrays") unless loop.is_a?(Array)
250
+ end
251
+ scripts = []
252
+ loops = step['nested_loop'].inject([[]]) do |tuples, array|
253
+ tuples.inject([]) do |agg, tuple|
254
+ array.each do |x|
255
+ agg << [*tuple, x]
256
+ end
257
+ agg
258
+ end
259
+ end
260
+ loops.each do |item|
261
+ @nested_loop_param = item
262
+ step['scripts'].each_index do |index|
263
+ script = Marshal.load(Marshal.dump(step['scripts'][index]))
264
+ scripts << validate_command(script, 'task step nested loop script')
265
+ end
266
+ @nested_loop_param = nil
267
+ end
268
+ step['scripts'] = scripts
269
+ step.delete('nested_loop')
241
270
  else
242
271
  step['scripts'].each_index do |index|
243
272
  step['scripts'][index] = validate_command(step['scripts'][index], 'task step script')
@@ -1,3 +1,3 @@
1
1
  module Orchestrator
2
- VERSION ||= '0.0.24'
2
+ VERSION ||= '0.0.25'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: task-orchestrator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.24
4
+ version: 0.0.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexander Piavlo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-14 00:00:00.000000000 Z
11
+ date: 2015-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pony
@@ -84,6 +84,7 @@ files:
84
84
  - examples/interpolation
85
85
  - examples/loops
86
86
  - examples/multistep
87
+ - examples/nested_loops
87
88
  - examples/parallel
88
89
  - examples/retry_handler
89
90
  - examples/sequential