benchmark_driver-output-rubybench 0.1.0 → 0.2.0

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: 0a977f8e20db83f16767a4aecdb0fd396a98d2e6
4
- data.tar.gz: ae279d4d48ee009a846ff9010a7c8ae4686f441b
3
+ metadata.gz: 21477e8cefe77e8ab842ee00ac21374e7ab6d298
4
+ data.tar.gz: 3598fd9427e9627d928f63e79f1056855a25f355
5
5
  SHA512:
6
- metadata.gz: 93aee7f4e7653a61a3a88a440694ddaa24bf8694ba0531fc76f5dedfed41ccd7fe28d640b8ed774d4728fd825a1553eba3d9858fb0a31681666fb82aab9e9cf9
7
- data.tar.gz: dec25a74a89cae38ada018f3bb85a678b20e5dcd69e4791e0084f5a2150674b6a8a0daaec17e820ed83f92f8640ed44fb2c3ab001ca5d9d93c6f1893470adf45
6
+ metadata.gz: a48a5eef910225ad66dcf9568872a517c19506c4be0eb85de3307dad015e2b92a8850d7da3085b8b1463ca6575ffa3f675627972cdb130fa37277efdac65cd03
7
+ data.tar.gz: 5c5a2c5f937578bb7c56dc3a0dd7839d80fc5f90aaab51c524eec2b211075025a069f33c60f260fac4a78e341e73fa679b1a912b20fe6c7c95710912cd54c0fc
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ["lib"]
25
25
 
26
- spec.add_dependency "benchmark_driver", ">= 0.11"
26
+ spec.add_dependency "benchmark_driver", ">= 0.12"
27
27
  spec.add_development_dependency "bundler", "~> 1.16"
28
28
  spec.add_development_dependency "rake", "~> 10.0"
29
29
  end
@@ -14,19 +14,12 @@ require 'net/http'
14
14
  # ORGANIZATION_NAME
15
15
  class BenchmarkDriver::Output::Rubybench < BenchmarkDriver::BulkOutput
16
16
  # For maintainability, this doesn't support streaming progress output.
17
- # @param [Hash{ BenchmarkDriver::Job => Hash{ BenchmarkDriver::Context => { BenchmarkDriver::Metric => Float } } }] result
17
+ # @param [Hash{ BenchmarkDriver::Job => Hash{ BenchmarkDriver::Context => BenchmarkDriver::Result } }] job_context_result
18
18
  # @param [Array<BenchmarkDriver::Metric>] metrics
19
- def bulk_output(result:, metrics:)
19
+ def bulk_output(job_context_result:, metrics:)
20
20
  metrics.each do |metric|
21
- result.each do |job, context_metric_value|
22
- context_value = {}
23
- context_metric_value.each do |context, metric_value|
24
- if metric_value.key?(metric)
25
- context_value[context] = metric_value[metric]
26
- end
27
- end
28
-
29
- create_benchmark_run(job, metric, context_value)
21
+ job_context_result.each do |job, context_result|
22
+ create_benchmark_run(job, metric, context_result)
30
23
  end
31
24
  end
32
25
  end
@@ -36,8 +29,8 @@ class BenchmarkDriver::Output::Rubybench < BenchmarkDriver::BulkOutput
36
29
  # Create BenchmarkRun record on RubyBench
37
30
  # @param [BenchmarkDriver::Job] job
38
31
  # @param [BenchmarkDriver::Metric] metric
39
- # @param [Hash{ BenchmarkDriver::Context => Float }] context_value
40
- def create_benchmark_run(job, metric, context_value)
32
+ # @param [Hash{ BenchmarkDriver::Context => BenchmarkDriver::Result }] context_result
33
+ def create_benchmark_run(job, metric, context_result)
41
34
  http = Net::HTTP.new(ENV.fetch('API_URL', 'rubybench.org'), 443)
42
35
  http.use_ssl = true
43
36
  request = Net::HTTP::Post.new('/benchmark_runs')
@@ -51,12 +44,12 @@ class BenchmarkDriver::Output::Rubybench < BenchmarkDriver::BulkOutput
51
44
  end
52
45
 
53
46
  result_hash = {}
54
- context_value.each do |context, value|
55
- initiator_hash["benchmark_run[result][#{context.name}]"] = value
47
+ context_result.each do |context, result|
48
+ initiator_hash["benchmark_run[result][#{context.name}]"] = result.values.fetch(metric)
56
49
  end
57
50
 
58
- context = context_value.keys.first
59
- ruby_version = IO.popen([*context.executable.command, '-v'], &:read)
51
+ ruby_version = context_result.keys.first.executable.description
52
+ environment = context_result.values.first.environment
60
53
 
61
54
  request.set_form_data({
62
55
  'benchmark_result_type[name]' => metric.name,
@@ -64,7 +57,7 @@ class BenchmarkDriver::Output::Rubybench < BenchmarkDriver::BulkOutput
64
57
  'benchmark_type[category]' => job.name,
65
58
  'benchmark_type[script_url]' => ENV.fetch('BENCHMARK_TYPE_SCRIPT_URL'),
66
59
  'benchmark_type[digest]' => ENV.fetch('BENCHMARK_TYPE_DIGEST'),
67
- 'benchmark_run[environment]' => { 'Ruby version' => ruby_version }.merge(context.environment).to_yaml,
60
+ 'benchmark_run[environment]' => { 'Ruby version' => ruby_version }.merge(environment).to_yaml,
68
61
  'repo' => ENV.fetch('REPO_NAME'),
69
62
  'organization' => ENV.fetch('ORGANIZATION_NAME'),
70
63
  }.merge(initiator_hash).merge(result_hash))
@@ -1,7 +1,7 @@
1
1
  module BenchmarkDriver
2
2
  module Output
3
3
  class Rubybench
4
- VERSION = "0.1.0"
4
+ VERSION = "0.2.0"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: benchmark_driver-output-rubybench
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takashi Kokubun
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0.11'
19
+ version: '0.12'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '0.11'
26
+ version: '0.12'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -65,8 +65,6 @@ files:
65
65
  - README.md
66
66
  - Rakefile
67
67
  - benchmark_driver-output-rubybench.gemspec
68
- - bin/console
69
- - bin/setup
70
68
  - lib/benchmark_driver/output/rubybench.rb
71
69
  - lib/benchmark_driver/output/rubybench/version.rb
72
70
  homepage: https://github.com/ruby-bench/ruby-bench-suite
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "benchmark_driver/output/rubybench"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here