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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0a7c2ce507254463b15a6f6e30ab2d0b664bc841ada2de657af4fc14aba7f012
4
- data.tar.gz: f5abf56a5ca249f795793653cc43b835283d7e6685ad8f9cb013e452e041e944
3
+ metadata.gz: 2dd53cb9feb11d811ab5f1bc07a408e670cd5090e0f5d77f0a4b8b12534a8d93
4
+ data.tar.gz: 1e6b86136d30b16b711e9a8351f0130022913717d0163462c7099a9897d4ad53
5
5
  SHA512:
6
- metadata.gz: 2c56115e2779608109c3301ce743ddf5e25541f9a61ede17ea95d9f7afe62e93b75d70aabc69ddc8fcc222ed24c88e66570a991576f200980097e5f78abd8eaf
7
- data.tar.gz: 685e437b51483bcd56444d26c1bdf7c0aa649c0e9f0e8b43fc4b43990c754bffd85c36b997b64a35592a5cddf056adaf7e4e0847a7e6c210bb0b8eafdaacf4a4
6
+ metadata.gz: d23bddd8fc77b86b8012220150647bf00899b94ece8eedb3d4ff0b56857e11250cc3d507934a6c41432f6cc88f346dbb825da5f8851746b799b40a55de0cd73b
7
+ data.tar.gz: c43beead9acb833456f19f16115ef9864c6e81e124d912377d3f6c41be33a2a8b5facd94c0b1124c66df093d1c443a443854590cd39b407fdf8b46e636da75dd
@@ -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: 1,
59
- desc: "Concurrent schema export workers (document " \
60
- "compilation remains sequential)"
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"
@@ -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
- jobs: 1,
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
- .render(load_options($stdin.read))
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 render_batch_member(ctx, idx, pos, manifest)
119
- one_path = File.join(ctx.config_dir, "._suma_staged_b#{idx}_#{pos}.yml")
120
- out = File.join(ctx.out_dir, "._staged_out_b#{idx}_#{pos}")
121
- started = Time.now
122
- render_and_alias(render_member(one_path, ctx, out), manifest, ctx)
123
- log_batch_ok(ctx, idx, pos, started)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Suma
4
- VERSION = "0.5.40"
4
+ VERSION = "0.5.42"
5
5
  end
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.40
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-14 00:00:00.000000000 Z
11
+ date: 2026-11-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: base64