paraduct 0.0.1.beta13 → 0.0.1.beta14
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/paraduct/colored_label_logger.rb +2 -1
- data/lib/paraduct/errors.rb +1 -0
- data/lib/paraduct/parallel_runner.rb +3 -0
- data/lib/paraduct/runner.rb +15 -12
- data/lib/paraduct/test_response.rb +1 -1
- data/lib/paraduct/version.rb +1 -1
- data/lib/paraduct.rb +1 -0
- data/spec/spec_helper.rb +9 -2
- metadata +3 -3
@@ -7,7 +7,8 @@ module Paraduct
|
|
7
7
|
@formatter = ActiveSupport::Logger::SimpleFormatter.new
|
8
8
|
end
|
9
9
|
|
10
|
-
[:debug, :info, :warn, :error, :fatal]
|
10
|
+
SEVERITIES = [:debug, :info, :warn, :error, :fatal]
|
11
|
+
SEVERITIES.each do |severity|
|
11
12
|
define_method "#{severity}_with_label" do |message|
|
12
13
|
message.each_line do |line|
|
13
14
|
send "#{severity}_without_label", "#{@label} #{line.strip}" unless line.blank?
|
data/lib/paraduct/errors.rb
CHANGED
@@ -32,6 +32,7 @@ START matrix test
|
|
32
32
|
stdout = runner.perform
|
33
33
|
successful = true
|
34
34
|
rescue Paraduct::Errors::ProcessError => e
|
35
|
+
runner.logger.error "exitstatus=#{e.status}, #{e.inspect}"
|
35
36
|
stdout = e.message
|
36
37
|
successful = false
|
37
38
|
end
|
@@ -51,6 +52,8 @@ START matrix test
|
|
51
52
|
pool.shutdown
|
52
53
|
end
|
53
54
|
|
55
|
+
raise Paraduct::Errors::DirtyExitError unless test_response.jobs_count == product_variables.count
|
56
|
+
|
54
57
|
test_response
|
55
58
|
end
|
56
59
|
end
|
data/lib/paraduct/runner.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
module Paraduct
|
2
|
-
require "
|
3
|
-
require "open3"
|
2
|
+
require "pty"
|
4
3
|
|
5
4
|
class Runner
|
6
5
|
attr_reader :script, :params, :base_job_dir
|
@@ -69,20 +68,24 @@ module Paraduct
|
|
69
68
|
end
|
70
69
|
|
71
70
|
private
|
72
|
-
def run_command(command)
|
73
|
-
lines = ""
|
74
71
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
72
|
+
def run_command(command)
|
73
|
+
full_stdout = ""
|
74
|
+
|
75
|
+
PTY.spawn(command) do |stdin, _stdout, pid|
|
76
|
+
begin
|
77
|
+
stdin.each do |line|
|
78
|
+
line.strip!
|
79
|
+
logger.info line
|
80
|
+
full_stdout << "#{line}\n"
|
81
|
+
end
|
82
|
+
rescue Errno::EIO
|
79
83
|
end
|
84
|
+
exit_status = PTY.check(pid)
|
85
|
+
raise Paraduct::Errors::ProcessError.new(full_stdout, exit_status) unless exit_status.success?
|
80
86
|
end
|
81
87
|
|
82
|
-
|
83
|
-
raise Paraduct::Errors::ProcessError.new(lines, status) unless status.success?
|
84
|
-
|
85
|
-
lines
|
88
|
+
full_stdout
|
86
89
|
end
|
87
90
|
end
|
88
91
|
end
|
data/lib/paraduct/version.rb
CHANGED
data/lib/paraduct.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -20,6 +20,8 @@ require 'rspec/temp_dir'
|
|
20
20
|
require 'rspec/its'
|
21
21
|
require 'pry'
|
22
22
|
|
23
|
+
is_verbose = ENV["VERBOSE"].present?
|
24
|
+
|
23
25
|
def spec_dir
|
24
26
|
Pathname(File.dirname(__FILE__))
|
25
27
|
end
|
@@ -118,7 +120,12 @@ RSpec.configure do |config|
|
|
118
120
|
config.order = :random
|
119
121
|
|
120
122
|
config.before do
|
121
|
-
|
122
|
-
|
123
|
+
unless is_verbose
|
124
|
+
# quiet all logs
|
125
|
+
Paraduct::ColoredLabelLogger::SEVERITIES.each do |severity|
|
126
|
+
allow(Paraduct.logger).to receive(severity)
|
127
|
+
allow_any_instance_of(Paraduct::ColoredLabelLogger).to receive(severity)
|
128
|
+
end
|
129
|
+
end
|
123
130
|
end
|
124
131
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paraduct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1.
|
4
|
+
version: 0.0.1.beta14
|
5
5
|
prerelease: 6
|
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: 2014-10-
|
12
|
+
date: 2014-10-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -369,7 +369,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
369
369
|
version: '0'
|
370
370
|
segments:
|
371
371
|
- 0
|
372
|
-
hash: -
|
372
|
+
hash: -1455455327285807628
|
373
373
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
374
374
|
none: false
|
375
375
|
requirements:
|