task-orchestrator 0.0.11 → 0.0.12

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.
@@ -37,6 +37,9 @@ module Orchestrator
37
37
  options.kill = false
38
38
  parser.on( '--kill', 'Kill running task based on statefile pid then lock can not be acquired' ) { options.kill = true }
39
39
 
40
+ options.wait = false
41
+ parser.on( '--wait', 'Wait until already running task based on statefile pid finish running' ) { options.wait = true }
42
+
40
43
  parser.on( '--args ARGS,', Array, 'extra args for interpolation as arg1=val1,arg2=val2,...]' ) do |extra_args|
41
44
  extra_args.each do |extra_arg|
42
45
  arg,val = extra_arg.split('=')
@@ -52,7 +52,16 @@ module Orchestrator
52
52
  @got_lock = file.flock( File::LOCK_NB | File::LOCK_EX )
53
53
  end
54
54
  end
55
- invalid("The state file #{@options.statefile} is already locked by other process") unless @got_lock
55
+ unless @got_lock
56
+ unless @options.wait
57
+ invalid("The state file #{@options.statefile} is already locked by other process")
58
+ else
59
+ Formatador.display_line("[yellow]WARN[/]: Blocking until already running process ends")
60
+ File.open(@options.statefile, "r") do |file|
61
+ @got_lock = file.flock( File::LOCK_EX )
62
+ end
63
+ end
64
+ end
56
65
  end
57
66
  end
58
67
 
@@ -1,3 +1,3 @@
1
1
  module Orchestrator
2
- VERSION ||= '0.0.11'
2
+ VERSION ||= '0.0.12'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: task-orchestrator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
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-09-06 00:00:00.000000000 Z
12
+ date: 2013-09-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pony
@@ -85,17 +85,17 @@ extra_rdoc_files: []
85
85
  files:
86
86
  - bin/orchestrator
87
87
  - lib/orchestrator.rb
88
+ - lib/orchestrator/task.rb
88
89
  - lib/orchestrator/version.rb
89
90
  - lib/orchestrator/cli.rb
90
- - lib/orchestrator/task.rb
91
- - examples/timeouts
92
- - examples/interpolation
93
- - examples/dependencies
94
91
  - examples/sequential
95
92
  - examples/failure_handler
93
+ - examples/multistep
96
94
  - examples/parallel
95
+ - examples/interpolation
96
+ - examples/timeouts
97
97
  - examples/flock
98
- - examples/multistep
98
+ - examples/dependencies
99
99
  - task-orchestrator.gemspec
100
100
  - LICENSE
101
101
  - README.md