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 +4 -4
- data/lib/specwrk/cli.rb +3 -1
- data/lib/specwrk/queue.rb +6 -2
- data/lib/specwrk/version.rb +1 -1
- data/lib/specwrk/web/endpoints.rb +9 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d76f2f9716e7c7e613bc0b341f89e42caf9375dfe0d48083afb908146d1374b
|
4
|
+
data.tar.gz: 36136d67829a41b39f4e9de4fff45ea1a614111f9556a523eefde1b35cceba51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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
|
-
|
77
|
+
synchronize do
|
74
78
|
h2.each { |_id, example| merge_example(example) }
|
75
79
|
|
76
80
|
# Sort by exepcted run time, slowest to fastest
|
data/lib/specwrk/version.rb
CHANGED
@@ -58,8 +58,15 @@ module Specwrk
|
|
58
58
|
|
59
59
|
class Seed < Base
|
60
60
|
def response
|
61
|
-
|
62
|
-
|
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
|