bitfab 0.63.0 → 0.63.1

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.
@@ -2,13 +2,15 @@
2
2
 
3
3
  require "json"
4
4
  require "open3"
5
+ require "rbconfig"
5
6
  require "tempfile"
6
7
 
7
8
  module Bitfab
8
9
  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] [--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
+ HINT = "Add --cloud to run the same replay on GitHub Actions; bitfab-replay --cloud --help explains it."
10
11
 
11
12
  HELPER = File.expand_path("cloudReplay.py", __dir__)
13
+ REPLAY_EXECUTABLE = File.expand_path("../../exe/bitfab-replay", __dir__)
12
14
 
13
15
  module_function
14
16
 
@@ -17,13 +19,13 @@ module Bitfab
17
19
  end
18
20
 
19
21
  def run(argv:, stdout:, stderr:, helper: HELPER)
20
- if argv.include?("--help") || argv.include?("-h")
21
- stdout.puts HELP
22
- return {}
23
- end
22
+ env = {
23
+ "BITFAB_REPLAY_COMMAND" => JSON.generate([RbConfig.ruby, REPLAY_EXECUTABLE]),
24
+ "BITFAB_SDK_LANGUAGE" => "ruby"
25
+ }
24
26
  Tempfile.create("bitfab-cloud-output") do |file|
25
27
  result_status = nil
26
- Open3.popen3("python3", helper, *argv) do |input, output_stream, error_stream, thread|
28
+ Open3.popen3(env, "python3", helper, *argv) do |input, output_stream, error_stream, thread|
27
29
  input.close
28
30
  reader = Thread.new { IO.copy_stream(output_stream, file) }
29
31
  error_stream.each_line { |line| stderr.write(line) }
@@ -36,6 +38,10 @@ module Bitfab
36
38
  stdout.puts result_output unless result_output.strip.empty?
37
39
  raise ArgumentError, "Cloud replay failed. See diagnostics; use the execution UUID to recover a dispatched job."
38
40
  end
41
+ if argv.include?("--help") || argv.include?("-h")
42
+ stdout.write result_output
43
+ return {}
44
+ end
39
45
  result = JSON.parse(result_output)
40
46
  stdout.puts JSON.pretty_generate(result)
41
47
  result
@@ -7,7 +7,7 @@ module Bitfab
7
7
  # Installed command that loads a project-owned registry module.
8
8
  module ReplayCommand
9
9
  USAGE = "Usage: bitfab-replay --registry <path> <pipeline> [replay options]"
10
- HELP = "#{USAGE}\nRun bitfab-replay --registry <path> --help to list replay options.\n#{CloudReplayCli::HELP}"
10
+ HELP = "#{USAGE}\nRun bitfab-replay --registry <path> --help to list replay options.\n#{CloudReplayCli::HINT}"
11
11
 
12
12
  module_function
13
13
 
@@ -26,7 +26,7 @@ module Bitfab
26
26
  end
27
27
 
28
28
  def main(argv: ARGV, stdout: $stdout, stderr: $stderr)
29
- if (argv.include?("--help") || argv.include?("-h")) && !argv.include?("--registry")
29
+ if (argv.include?("--help") || argv.include?("-h")) && !argv.include?("--registry") && !CloudReplayCli.cloud?(argv)
30
30
  stdout.puts HELP
31
31
  return 0
32
32
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bitfab
4
- VERSION = "0.63.0"
4
+ VERSION = "0.63.1"
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.63.0
4
+ version: 0.63.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Harvest Team