specwrk 0.4.1 → 0.4.2

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
  SHA256:
3
- metadata.gz: 3d9511529ad6b58048312d287ed54240cffd3918b5621555f59c54b69b9451b4
4
- data.tar.gz: a1a878eff39f2ae7592c37572195d1a7da5268554004df4966a6adba559f75e1
3
+ metadata.gz: 9d76f2f9716e7c7e613bc0b341f89e42caf9375dfe0d48083afb908146d1374b
4
+ data.tar.gz: 36136d67829a41b39f4e9de4fff45ea1a614111f9556a523eefde1b35cceba51
5
5
  SHA512:
6
- metadata.gz: dc0f1e302994fc815d00e409d86536acc3589baeb77d4e765741c061a0b0942ae93902ac64940cb5a9aeb5828d899982b67fd13b3e6ac1ffa6252d5efb8139ed
7
- data.tar.gz: e789547dab6d911d1d69c244b87043fb48842380eeac948952b016e6d4f9e7b7e1d9daf8ce96428b1d1902bcb32c4054e52b048d454c51bc4622f3ac241e72c5
6
+ metadata.gz: b7fd2a78d6019864949e6847f09474ad357b04614dd1a2cc3f563ec95f915e7958bfdf211c9d60213d61bea517e59e200ad3e7898963fe0cdd49df114941a786
7
+ data.tar.gz: 6b1836bb1a50ba0d853689ec5b7f169c83883a39c134caf93b4a70637a81c3b4f6e4f8112285dca4b30065d0c6a816807e13e65ff748dc7b16d5c5d03064e52c
data/lib/specwrk/cli.rb CHANGED
@@ -77,10 +77,11 @@ module Specwrk
77
77
  base.unique_option :output, type: :string, default: ENV.fetch("SPECWRK_OUT", ".specwrk/"), aliases: ["-o"], desc: "Directory where worker output is stored. Overrides SPECWRK_OUT. Default '.specwrk/'."
78
78
  base.unique_option :group_by, values: %w[file timings], default: ENV.fetch("SPECWERK_SRV_GROUP_BY", "timings"), desc: "How examples will be grouped for workers; fallback to file if no timings are found. Overrides SPECWERK_SRV_GROUP_BY. Default timings."
79
79
  base.unique_option :single_run, type: :boolean, default: false, desc: "Act on shutdown requests from clients. Default: false."
80
+ base.unique_option :single_seed_per_run, type: :boolean, default: false, desc: "Only allow one seed per run. Useful for CI where many nodes may seed at the same time. Default: false."
80
81
  base.unique_option :verbose, type: :boolean, default: false, desc: "Run in verbose mode. Default false."
81
82
  end
82
83
 
83
- on_setup do |port:, bind:, output:, key:, single_run:, group_by:, verbose:, **|
84
+ on_setup do |port:, bind:, output:, key:, single_run:, single_seed_per_run:, group_by:, verbose:, **|
84
85
  ENV["SPECWRK_OUT"] = Pathname.new(output).expand_path(Dir.pwd).to_s
85
86
  FileUtils.mkdir_p(ENV["SPECWRK_OUT"])
86
87
 
@@ -90,6 +91,7 @@ module Specwrk
90
91
  ENV["SPECWRK_SRV_BIND"] = bind
91
92
  ENV["SPECWRK_SRV_KEY"] = key
92
93
  ENV["SPECWRK_SRV_SINGLE_RUN"] = "1" if single_run
94
+ ENV["SPECWRK_SRV_SINGLE_SEED_PER_RUN"] = "1" if single_seed_per_run
93
95
  ENV["SPECWRK_SRV_GROUP_BY"] = group_by
94
96
  end
95
97
  end
data/lib/specwrk/queue.rb CHANGED
@@ -19,7 +19,11 @@ module Specwrk
19
19
  end
20
20
 
21
21
  def synchronize(&blk)
22
- @mutex.synchronize { yield(@hash) }
22
+ if @mutex.owned?
23
+ yield(@hash)
24
+ else
25
+ @mutex.synchronize { yield(@hash) }
26
+ end
23
27
  end
24
28
 
25
29
  def method_missing(name, *args, &block)
@@ -70,7 +74,7 @@ module Specwrk
70
74
  end
71
75
 
72
76
  def merge_with_previous_run_times!(h2)
73
- @mutex.synchronize do
77
+ synchronize do
74
78
  h2.each { |_id, example| merge_example(example) }
75
79
 
76
80
  # Sort by exepcted run time, slowest to fastest
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Specwrk
4
- VERSION = "0.4.1"
4
+ VERSION = "0.4.2"
5
5
  end
@@ -58,8 +58,15 @@ module Specwrk
58
58
 
59
59
  class Seed < Base
60
60
  def response
61
- examples = payload.map { |hash| [hash[:id], hash] }.to_h
62
- pending_queue.merge_with_previous_run_times!(examples)
61
+ pending_queue.synchronize do |pending_queue_hash|
62
+ unless ENV["SPECWRK_SRV_SINGLE_SEED_PER_RUN"] && pending_queue_hash.length.positive?
63
+ examples = payload.map { |hash| [hash[:id], hash] }.to_h
64
+
65
+ pending_queue.merge_with_previous_run_times!(examples)
66
+
67
+ ok
68
+ end
69
+ end
63
70
 
64
71
  ok
65
72
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: specwrk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Westendorf