paraduct 0.0.1.beta10 → 0.0.1.beta11

Sign up to get free protection for your applications and to get access to all the features.
@@ -18,11 +18,12 @@ START matrix test
18
18
 
19
19
  pool = Thread.pool(Paraduct.config.max_threads)
20
20
  begin
21
- product_variables.each do |params|
21
+ product_variables.each_with_index do |params, index|
22
22
  runner = Paraduct::Runner.new(
23
23
  script: script,
24
24
  params: params,
25
25
  base_job_dir: base_job_dir,
26
+ job_id: index + 1,
26
27
  )
27
28
  runner.logger.info "[START] params: #{runner.formatted_params}"
28
29
  pool.process do
@@ -13,6 +13,7 @@ module Paraduct
13
13
  @script = args[:script]
14
14
  @params = args[:params]
15
15
  @base_job_dir = args[:base_job_dir]
16
+ @job_id = args[:job_id]
16
17
  @logger = Paraduct::ThreadLogger.new
17
18
  end
18
19
 
@@ -26,7 +27,8 @@ module Paraduct
26
27
  # @return [String] stdout
27
28
  # @raise [Paraduct::Errors::ProcessError] command exited error status
28
29
  def perform
29
- variable_string = key_capitalized_params.map{ |key, value| %(export #{key}="#{value}";) }.join(" ")
30
+ export_variables = key_capitalized_params.merge("JOB_ID" => @job_id, "JOB_NAME" => job_name)
31
+ variable_string = export_variables.map{ |key, value| %(export #{key}="#{value}";) }.join(" ")
30
32
 
31
33
  Array.wrap(@script).inject("") do |stdout, command|
32
34
  stdout << run_command("#{variable_string} #{command}")
@@ -1,3 +1,3 @@
1
1
  module Paraduct
2
- VERSION = "0.0.1.beta10"
2
+ VERSION = "0.0.1.beta11"
3
3
  end
@@ -4,19 +4,21 @@ describe Paraduct::Runner do
4
4
  script: script,
5
5
  params: params,
6
6
  base_job_dir: base_job_dir,
7
+ job_id: job_id,
7
8
  )
8
9
  end
9
10
 
10
11
  let(:base_job_dir){ "/tmp/jobs" }
11
12
  let(:script) { "" }
12
13
  let(:params) { {} }
14
+ let(:job_id) { 1 }
13
15
 
14
16
  describe "#perform" do
15
17
  subject{ runner.perform }
16
18
 
17
19
  let(:script) { "./script/build_success.sh" }
18
20
  let(:params) { { "ruby" => "1.9", "database" => "mysql" } }
19
- let(:command){ 'export RUBY="1.9"; export DATABASE="mysql"; ./script/build_success.sh' }
21
+ let(:command){ 'export RUBY="1.9"; export DATABASE="mysql"; export JOB_ID="1"; export JOB_NAME="RUBY_1.9_DATABASE_mysql"; ./script/build_success.sh' }
20
22
 
21
23
  context "with mock system" do
22
24
  it "script is call with capitalized variable" do
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.beta10
4
+ version: 0.0.1.beta11
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -369,7 +369,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
369
369
  version: '0'
370
370
  segments:
371
371
  - 0
372
- hash: -3937149399617201797
372
+ hash: 1831065147149086006
373
373
  required_rubygems_version: !ruby/object:Gem::Requirement
374
374
  none: false
375
375
  requirements: