suma 0.5.40 → 0.5.42
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/suma/cli/build.rb +5 -3
- data/lib/suma/schema_exporter.rb +5 -1
- data/lib/suma/staged_collection_builder/worker.rb +25 -10
- data/lib/suma/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2dd53cb9feb11d811ab5f1bc07a408e670cd5090e0f5d77f0a4b8b12534a8d93
|
|
4
|
+
data.tar.gz: 1e6b86136d30b16b711e9a8351f0130022913717d0163462c7099a9897d4ad53
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d23bddd8fc77b86b8012220150647bf00899b94ece8eedb3d4ff0b56857e11250cc3d507934a6c41432f6cc88f346dbb825da5f8851746b799b40a55de0cd73b
|
|
7
|
+
data.tar.gz: c43beead9acb833456f19f16115ef9864c6e81e124d912377d3f6c41be33a2a8b5facd94c0b1124c66df093d1c443a443854590cd39b407fdf8b46e636da75dd
|
data/lib/suma/cli/build.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "etc"
|
|
3
4
|
require "thor"
|
|
4
5
|
|
|
5
6
|
module Suma
|
|
@@ -55,9 +56,10 @@ module Suma
|
|
|
55
56
|
"to plain_schemas/.suma-build-state.json)"
|
|
56
57
|
option :state_file, type: :string,
|
|
57
58
|
desc: "Path to the incremental build state file"
|
|
58
|
-
option :jobs, type: :numeric, default:
|
|
59
|
-
desc: "Concurrent schema export workers (
|
|
60
|
-
"
|
|
59
|
+
option :jobs, type: :numeric, default: Etc.nprocessors,
|
|
60
|
+
desc: "Concurrent schema export workers (the parser " \
|
|
61
|
+
"releases the GVL, so this is true parallelism; " \
|
|
62
|
+
"document compilation remains sequential)"
|
|
61
63
|
option :provenance, type: :string,
|
|
62
64
|
desc: "Write a provenance manifest (sha256 of inputs " \
|
|
63
65
|
"and outputs + toolchain versions) to this path"
|
data/lib/suma/schema_exporter.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "etc"
|
|
3
4
|
require "fileutils"
|
|
4
5
|
|
|
5
6
|
module Suma
|
|
@@ -42,7 +43,10 @@ module Suma
|
|
|
42
43
|
annotations: false,
|
|
43
44
|
create_zip: false,
|
|
44
45
|
structure: :preserve,
|
|
45
|
-
|
|
46
|
+
# Cold-parse parallelism by default: the parsanol parse is the
|
|
47
|
+
# dominant cost of a vanilla (no cache) build and is GVL-free
|
|
48
|
+
# (Rust), so N workers is a near-N-fold cut. Pass jobs: to pin it.
|
|
49
|
+
jobs: Etc.nprocessors,
|
|
46
50
|
}
|
|
47
51
|
end
|
|
48
52
|
|
|
@@ -56,10 +56,14 @@ module Suma
|
|
|
56
56
|
# The render options arrive from the parent over STDIN as JSON (not
|
|
57
57
|
# Marshal: deserializing a stream is rb/unsafe-deserialization, and
|
|
58
58
|
# the payload is plain strings, booleans, arrays, and nested hashes
|
|
59
|
-
# - JSON expresses it exactly, with symbols restored below).
|
|
59
|
+
# - JSON expresses it exactly, with symbols restored below). Returns
|
|
60
|
+
# the PARSED COLLECTION, not the render's return: Collection#render
|
|
61
|
+
# returns the Renderer on current metanorma, and the aliasing reads
|
|
62
|
+
# the collection's bibdata keys and manifest identifier_aliases.
|
|
60
63
|
def render_with_options(manifest_path)
|
|
61
|
-
Metanorma::Collection.parse(manifest_path)
|
|
62
|
-
|
|
64
|
+
collection = Metanorma::Collection.parse(manifest_path)
|
|
65
|
+
collection.render(load_options($stdin.read))
|
|
66
|
+
collection
|
|
63
67
|
end
|
|
64
68
|
|
|
65
69
|
# Parent side: symbols and hash keys become strings for the wire.
|
|
@@ -115,18 +119,29 @@ module Suma
|
|
|
115
119
|
end
|
|
116
120
|
end
|
|
117
121
|
|
|
118
|
-
def
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
ensure
|
|
122
|
+
def member_paths(ctx, idx, pos)
|
|
123
|
+
[File.join(ctx.config_dir, "._suma_staged_b#{idx}_#{pos}.yml"),
|
|
124
|
+
File.join(ctx.out_dir, "._staged_out_b#{idx}_#{pos}")]
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
def cleanup_batch_files(one_path, out)
|
|
125
128
|
FileUtils.rm_f(one_path)
|
|
126
129
|
FileUtils.rm_rf(out)
|
|
127
130
|
GC.start
|
|
128
131
|
end
|
|
129
132
|
|
|
133
|
+
def render_batch_member(ctx, idx, pos, manifest)
|
|
134
|
+
one_path, out = member_paths(ctx, idx, pos)
|
|
135
|
+
started = Time.now
|
|
136
|
+
begin
|
|
137
|
+
File.write(one_path, YAML.dump(manifest))
|
|
138
|
+
render_and_alias(render_member(one_path, ctx, out), manifest, ctx)
|
|
139
|
+
log_batch_ok(ctx, idx, pos, started)
|
|
140
|
+
ensure
|
|
141
|
+
cleanup_batch_files(one_path, out)
|
|
142
|
+
end
|
|
143
|
+
end
|
|
144
|
+
|
|
130
145
|
def render_and_alias(collection, manifest, ctx)
|
|
131
146
|
alias_artifacts(collection, slug(member_identifier(manifest)),
|
|
132
147
|
ctx.store_dir)
|
data/lib/suma/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: suma
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.5.
|
|
4
|
+
version: 0.5.42
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ribose Inc.
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: base64
|