bitfab 0.62.4 → 0.62.6

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.
@@ -6,7 +6,7 @@ require "tempfile"
6
6
 
7
7
  module Bitfab
8
8
  module CloudReplayCli
9
- HELP = "Direct GitHub replay: --cloud PIPELINE --trace-ids UUID[,UUID] [--registry PATH] [--max-concurrency 1..32] [--cloud-include FILE] [--cloud-dry-run] [--cloud-detach] [--cloud-request-id UUID]. Lifecycle: --cloud-status|--cloud-watch|--cloud-cancel|--cloud-cleanup UUID. Setup: --cloud-init --config FILE, --cloud-secrets --env-file FILE [NAME ...]. Requires git, gh auth login, Python 3.10+, and bitfab:setup cloud."
9
+ HELP = "Direct GitHub replay: --cloud PIPELINE --trace-ids UUID[,UUID] [--registry PATH] [--max-concurrency 1..32] [--cloud-include FILE] [--cloud-dry-run] [--cloud-detach] [--cloud-request-id UUID] [--cloud-timeout MINUTES] [--cloud-check] [--fail-on-error] [replay options such as --name, --dataset-ids, --attempts, or --resume, passed to the replay on the runner]. Lifecycle: --cloud-status|--cloud-watch|--cloud-cancel|--cloud-cleanup UUID. Setup: --cloud-init [--config FILE] (creates a setup or updates it in place), --cloud-secrets --env-file FILE [NAME ...]. Requires git, gh auth login, Python 3.10+, and bitfab:setup cloud."
10
10
 
11
11
  HELPER = File.expand_path("cloudReplay.py", __dir__)
12
12
 
@@ -89,6 +89,8 @@ module Bitfab
89
89
  module ReplayCli
90
90
  MAX_PINNED_TRACE_IDS = 100
91
91
 
92
+ class ItemsErroredError < StandardError; end
93
+
92
94
  module_function
93
95
 
94
96
  # get_assertions returns every state so a reviewer can see drafts, but only an
@@ -266,9 +268,20 @@ module Bitfab
266
268
  render_summary(args.fetch(:pipeline), result, stderr)
267
269
  end
268
270
  stdout.puts Bitfab.serialize_replay_result(result)
271
+ fail_if_items_errored(result, dry_run: options[:dry_run]) if args[:fail_on_error]
269
272
  result
270
273
  end
271
274
 
275
+ def fail_if_items_errored(result, dry_run:)
276
+ items = result[:items].reject { |item| item[:carried_over] }
277
+ errored = items.count { |item| item[:error] }
278
+ return if errored.zero?
279
+
280
+ noun = dry_run ? "resolved" : "replayed"
281
+ raise ItemsErroredError,
282
+ "[replay] #{errored} of #{items.length} #{noun} items errored; exiting 1 because of --fail-on-error"
283
+ end
284
+
272
285
  def parse(registry, argv)
273
286
  if argv.include?("--db-branch") && argv.include?("--no-db-branch")
274
287
  raise OptionParser::InvalidArgument, "--db-branch and --no-db-branch cannot be used together"
@@ -315,6 +328,9 @@ module Bitfab
315
328
  options.on("--judge-assertions",
316
329
  "Judge each replay's approved assertions as it finishes (costs model calls)") { args[:judge_assertions] = true }
317
330
  options.on("--dry-run") { args[:dry_run] = true }
331
+ options.on("--fail-on-error",
332
+ "Exit 1 after printing the result when any replayed item errored. " \
333
+ "Under --dry-run, items whose inputs failed to resolve count.") { args[:fail_on_error] = true }
318
334
  options.on("--primitive TYPE", %w[async process]) { |value| args[:primitive] = value }
319
335
  options.on("--[no-]memory-throttle") { |value| args[:memory_throttle] = value }
320
336
  options.on("--mock STRATEGY", %w[none all marked]) { |value| args[:mock] = value }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bitfab
4
- VERSION = "0.62.4"
4
+ VERSION = "0.62.6"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitfab
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.62.4
4
+ version: 0.62.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harvest Team