benchmark_driver-output-rubybench 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/benchmark_driver-output-rubybench.gemspec +1 -1
- data/lib/benchmark_driver/output/rubybench.rb +11 -18
- data/lib/benchmark_driver/output/rubybench/version.rb +1 -1
- metadata +3 -5
- data/bin/console +0 -14
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21477e8cefe77e8ab842ee00ac21374e7ab6d298
|
4
|
+
data.tar.gz: 3598fd9427e9627d928f63e79f1056855a25f355
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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 =>
|
17
|
+
# @param [Hash{ BenchmarkDriver::Job => Hash{ BenchmarkDriver::Context => BenchmarkDriver::Result } }] job_context_result
|
18
18
|
# @param [Array<BenchmarkDriver::Metric>] metrics
|
19
|
-
def bulk_output(
|
19
|
+
def bulk_output(job_context_result:, metrics:)
|
20
20
|
metrics.each do |metric|
|
21
|
-
|
22
|
-
|
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 =>
|
40
|
-
def create_benchmark_run(job, metric,
|
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
|
-
|
55
|
-
initiator_hash["benchmark_run[result][#{context.name}]"] =
|
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
|
-
|
59
|
-
|
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(
|
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))
|
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.
|
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.
|
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.
|
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__)
|