stellar_core_commander 0.0.11 → 0.0.12
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/.gitignore +1 -0
- data/CONTRIBUTING.md +60 -0
- data/bin/scc +70 -11
- data/examples/cross_host_simple_payment.rb +5 -5
- data/examples/history_generate_and_catchup.rb +26 -0
- data/examples/history_testnet_catchup.rb +15 -0
- data/examples/inflation.rb +8 -0
- data/examples/load_generation.rb +15 -0
- data/examples/load_generation_auto.rb +15 -0
- data/examples/multi_host_simple_payment.rb +12 -5
- data/examples/set_options.rb +23 -0
- data/examples/simple_payment.rb +3 -1
- data/examples/version_mix_consensus.rb +46 -0
- data/lib/stellar_core_commander.rb +1 -0
- data/lib/stellar_core_commander/commander.rb +50 -16
- data/lib/stellar_core_commander/convert.rb +1 -5
- data/lib/stellar_core_commander/docker_process.rb +220 -44
- data/lib/stellar_core_commander/local_process.rb +82 -41
- data/lib/stellar_core_commander/operation_builder.rb +128 -59
- data/lib/stellar_core_commander/process.rb +478 -49
- data/lib/stellar_core_commander/transactor.rb +222 -85
- data/lib/stellar_core_commander/version.rb +1 -1
- data/stellar_core_commander.gemspec +1 -1
- metadata +14 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 194aa47932a7b30b7b5f890cf6a7d7d49144438b
|
4
|
+
data.tar.gz: 000cd0e89691d63bf4c29d7f506bed45180023f1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bec64f9159656b056b23731f0733efbfb3f6b4d563f2937db902435ccf58074788d47a1b7871a3bda94fc2926e084cf576726d229867804450f5aaf99e63bde8
|
7
|
+
data.tar.gz: 6683025f7d1c4aa3081d9336701f3411d09e424cd885d1bd208f962a06ff2a886af6067842d154a27bb0cf0067ed01d85dc82ad2bc7d86f26097ce623c3e75f6
|
data/.gitignore
CHANGED
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
# How to contribute
|
2
|
+
|
3
|
+
Your contributions to the Stellar network will help improve the world’s financial
|
4
|
+
infrastructure, faster.
|
5
|
+
|
6
|
+
We want to make it as easy as possible to contribute changes that
|
7
|
+
help the Stellar network grow and thrive. There are a few guidelines that we
|
8
|
+
ask contributors to follow so that we can merge your changes quickly.
|
9
|
+
|
10
|
+
## Getting Started
|
11
|
+
|
12
|
+
* Create a GitHub issue for your contribution, assuming one does not already exist.
|
13
|
+
* Clearly describe the issue including steps to reproduce if it is a bug.
|
14
|
+
* Fork the repository on GitHub
|
15
|
+
|
16
|
+
## Making Changes
|
17
|
+
|
18
|
+
* Create a topic branch from where you want to base your work.
|
19
|
+
* This is usually the master branch.
|
20
|
+
* Please avoid working directly on the `master` branch.
|
21
|
+
* Make sure you have added the necessary tests for your changes, and make sure all tests pass.
|
22
|
+
|
23
|
+
## Submitting Changes
|
24
|
+
|
25
|
+
* <a href="https://docs.google.com/forms/d/1g7EF6PERciwn7zfmfke5Sir2n10yddGGSXyZsq98tVY/viewform?usp=send_form">Sign the Contributor License Agreement</a>.
|
26
|
+
* All content, comments, and pull requests must follow the [Stellar Community Guidelines](https://www.stellar.org/community-guidelines/).
|
27
|
+
* Push your changes to a topic branch in your fork of the repository.
|
28
|
+
* Submit a pull request to the [stellar_core_commander repository](https://github.com/stellar/stellar-tutorials) in the Stellar organization.
|
29
|
+
* Include a descriptive [commit message](https://github.com/erlang/otp/wiki/Writing-good-commit-messages).
|
30
|
+
* Changes contributed via pull request should focus on a single issue at a time.
|
31
|
+
* Rebase your local changes against the master branch. Resolve any conflicts that arise.
|
32
|
+
|
33
|
+
At this point you're waiting on us. We like to at least comment on pull requests within three
|
34
|
+
business days (and, typically, one business day). We may suggest some changes or improvements or alternatives.
|
35
|
+
|
36
|
+
## Making Trivial Changes
|
37
|
+
|
38
|
+
### Documentation
|
39
|
+
For changes of a trivial nature to comments and documentation, it is not
|
40
|
+
always necessary to create a new GitHub issue. In this case, it is
|
41
|
+
appropriate to start the first line of a commit with 'doc' instead of
|
42
|
+
an issue number.
|
43
|
+
|
44
|
+
# Additional Resources
|
45
|
+
|
46
|
+
* [Bug tracker (Github)](https://github.com/stellar/stellar_core_commander/issues)
|
47
|
+
* <a href="https://docs.google.com/forms/d/1g7EF6PERciwn7zfmfke5Sir2n10yddGGSXyZsq98tVY/viewform?usp=send_form">Contributor License Agreement</a>
|
48
|
+
* [Explore the API](http://docs.stellarhorizon.apiary.io/)
|
49
|
+
* [Readme for stellar_core_commander](https://github.com/stellar/stellar_core_commander/blob/master/README.md)
|
50
|
+
* #stellar-dev IRC channel on freenode.org
|
51
|
+
* #dev channel on [Slack](http://slack.stellar.org)
|
52
|
+
|
53
|
+
|
54
|
+
This document is inspired by:
|
55
|
+
|
56
|
+
https://github.com/puppetlabs/puppet/blob/master/CONTRIBUTING.md
|
57
|
+
|
58
|
+
https://github.com/thoughtbot/factory_girl_rails/blob/master/CONTRIBUTING.md
|
59
|
+
|
60
|
+
https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md
|
data/bin/scc
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'stellar_core_commander'
|
4
|
+
require 'stellar-base'
|
4
5
|
require 'slop'
|
5
6
|
|
6
7
|
def run
|
@@ -19,8 +20,51 @@ def run
|
|
19
20
|
default: 'local'
|
20
21
|
on 'w', 'wait',
|
21
22
|
'wait for TERM signal before shutting down and cleaning up',
|
22
|
-
|
23
|
-
|
23
|
+
argument: false,
|
24
|
+
default: false
|
25
|
+
on 'docker-core-image',
|
26
|
+
'docker image to use for stellar-core',
|
27
|
+
argument: true,
|
28
|
+
default: 'stellar/stellar-core'
|
29
|
+
on 'docker-state-image',
|
30
|
+
'docker image to use for state',
|
31
|
+
argument: true,
|
32
|
+
default: 'stellar/stellar-core-state'
|
33
|
+
on 'docker-pull',
|
34
|
+
'docker pull images before use',
|
35
|
+
default: false
|
36
|
+
on 'atlas',
|
37
|
+
'atlas endpoint for publishing metrics (e.g., http://192.168.59.103:7101/api/v1/publish)',
|
38
|
+
argument: true,
|
39
|
+
default: nil
|
40
|
+
on 'atlas-interval',
|
41
|
+
'number of seconds to wait between publishing metric payloads',
|
42
|
+
argument: true,
|
43
|
+
default: 1
|
44
|
+
on 'destination',
|
45
|
+
'where to store logs and other artifacts (default: a temporary directory)',
|
46
|
+
argument: true,
|
47
|
+
default: nil
|
48
|
+
on 'use-s3',
|
49
|
+
'share history via s3',
|
50
|
+
argument: false,
|
51
|
+
default: false
|
52
|
+
on 's3-history-prefix',
|
53
|
+
's3 prefix to store temp history in (default: subdir of s3://history-stg.stellar.org/dev/scc)',
|
54
|
+
argument: true,
|
55
|
+
default: "s3://history-stg.stellar.org/dev/scc/#{Time.now.to_i}-#{rand 100000}"
|
56
|
+
on 's3-history-region',
|
57
|
+
's3 region to store temp history in (default: eu-west-1)',
|
58
|
+
argument: true,
|
59
|
+
default: "eu-west-1"
|
60
|
+
on 'dump-root-db',
|
61
|
+
'when true, dump to root processes sql database after recipe completion',
|
62
|
+
argument: false,
|
63
|
+
default: false
|
64
|
+
on 'network-passphrase',
|
65
|
+
'sets the network passphrase to configure on all running processes',
|
66
|
+
argument: true,
|
67
|
+
default: Stellar::Networks::TESTNET
|
24
68
|
end
|
25
69
|
|
26
70
|
recipe = load_recipe
|
@@ -29,14 +73,16 @@ def run
|
|
29
73
|
#run recipe
|
30
74
|
transactor = StellarCoreCommander::Transactor.new(commander)
|
31
75
|
|
32
|
-
|
33
76
|
transactor.run_recipe recipe
|
34
77
|
transactor.close_ledger
|
35
78
|
|
36
|
-
|
79
|
+
if $opts[:"dump-root-db"]
|
80
|
+
file = commander.get_root_process(transactor).dump_database
|
81
|
+
$stdout.puts IO.read(file)
|
82
|
+
end
|
37
83
|
|
38
84
|
if $opts[:wait]
|
39
|
-
puts "Waiting for INT signal..."
|
85
|
+
$stderr.puts "Waiting for INT signal..."
|
40
86
|
Signal.trap("INT"){ exit }
|
41
87
|
sleep
|
42
88
|
end
|
@@ -46,10 +92,27 @@ end
|
|
46
92
|
def make_commander
|
47
93
|
opts = {
|
48
94
|
stellar_core_bin: $opts[:"stellar-core-bin"],
|
95
|
+
docker_core_image: $opts[:"docker-core-image"],
|
96
|
+
docker_state_image: $opts[:"docker-state-image"],
|
97
|
+
docker_pull: $opts[:"docker-pull"],
|
98
|
+
atlas: $opts[:"atlas"],
|
99
|
+
atlas_interval: $opts[:"atlas-interval"].to_i,
|
100
|
+
use_s3: $opts[:"use-s3"],
|
101
|
+
s3_history_region: $opts[:"s3-history-region"],
|
102
|
+
s3_history_prefix: $opts[:"s3-history-prefix"],
|
103
|
+
network_passphrase: $opts[:"network-passphrase"],
|
49
104
|
}
|
50
105
|
|
51
|
-
|
52
|
-
|
106
|
+
destination = $opts[:"destination"]
|
107
|
+
if destination
|
108
|
+
clean_up_destination = false
|
109
|
+
else
|
110
|
+
destination = Dir.mktmpdir("scc")
|
111
|
+
clean_up_destination = true
|
112
|
+
end
|
113
|
+
|
114
|
+
StellarCoreCommander::Commander.new($opts[:"process"], destination, opts).tap do |c|
|
115
|
+
c.cleanup_at_exit!(clean_up_destination)
|
53
116
|
end
|
54
117
|
end
|
55
118
|
|
@@ -69,8 +132,4 @@ def load_recipe
|
|
69
132
|
recipe
|
70
133
|
end
|
71
134
|
|
72
|
-
def output_results(process)
|
73
|
-
$stdout.puts process.dump_database
|
74
|
-
end
|
75
|
-
|
76
135
|
run
|
@@ -1,6 +1,6 @@
|
|
1
|
-
process :node1, [:node1, :node2, :node3],
|
2
|
-
process :node2, [:node1, :node2, :node3],
|
3
|
-
process :node3, [:node1, :node2, :node3],
|
1
|
+
process :node1, [:node1, :node2, :node3], host: '192.168.99.105'
|
2
|
+
process :node2, [:node1, :node2, :node3], host: '192.168.99.104'
|
3
|
+
process :node3, [:node1, :node2, :node3], host: '192.168.99.103'
|
4
4
|
|
5
5
|
account :alice
|
6
6
|
account :bob
|
@@ -11,9 +11,9 @@ on :node1 do
|
|
11
11
|
create_account :alice, :master
|
12
12
|
create_account :bob, :master
|
13
13
|
close_ledger
|
14
|
-
payment :master, :bob, [:native,
|
14
|
+
payment :master, :bob, [:native, 100 * Stellar::ONE]
|
15
15
|
close_ledger
|
16
16
|
end
|
17
17
|
|
18
|
-
payment :master, :alice, [:native,
|
18
|
+
payment :master, :alice, [:native, 100 * Stellar::ONE]
|
19
19
|
|
@@ -0,0 +1,26 @@
|
|
1
|
+
process :node1, [:node1], accelerate_time: true
|
2
|
+
on :node1 do
|
3
|
+
generate_load_and_await_completion 100, 100, 20
|
4
|
+
retry_until_true retries: 100 do
|
5
|
+
ledger_num > 10
|
6
|
+
end
|
7
|
+
check_no_error_metrics
|
8
|
+
check_database_against_ledger_buckets
|
9
|
+
end
|
10
|
+
|
11
|
+
process :node2_minimal, [:node1], forcescp: false, accelerate_time: true
|
12
|
+
on :node2_minimal do
|
13
|
+
retry_until_true retries: 100 do
|
14
|
+
ledger_num > 15
|
15
|
+
end
|
16
|
+
check_integrity_against :node1
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
process :node2_complete, [:node1], forcescp: false, accelerate_time: true, catchup_complete: true
|
21
|
+
on :node2_complete do
|
22
|
+
retry_until_true retries: 100 do
|
23
|
+
ledger_num > 15
|
24
|
+
end
|
25
|
+
check_integrity_against :node1
|
26
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
process :node1, [:testnet1, :testnet2, :testnet3], forcescp: false, debug: true, validate: false
|
2
|
+
on :node1 do
|
3
|
+
raise "node1 synced but failed to catch up" if ledger_num < 5
|
4
|
+
$stderr.puts "caught up on node1: ledger #{ledger_num}"
|
5
|
+
check_no_error_metrics
|
6
|
+
check_database_against_ledger_buckets
|
7
|
+
end
|
8
|
+
|
9
|
+
process :node2, [:testnet1, :testnet2, :testnet3], forcescp: false, catchup_complete: true, debug: true, validate: false
|
10
|
+
on :node2 do
|
11
|
+
raise "node2 synced but failed to catch up" if ledger_num < 5
|
12
|
+
$stderr.puts "caught up on node2: ledger #{ledger_num}"
|
13
|
+
check_no_error_metrics
|
14
|
+
check_database_against_ledger_buckets
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
process :node1, [:node1, :node2, :node3]
|
2
|
+
process :node2, [:node1, :node2, :node3]
|
3
|
+
process :node3, [:node1, :node2, :node3]
|
4
|
+
|
5
|
+
on :node1 do
|
6
|
+
generate_load_and_await_completion 1000, 1000, 30
|
7
|
+
end
|
8
|
+
|
9
|
+
on :node2 do
|
10
|
+
check_integrity_against :node1
|
11
|
+
end
|
12
|
+
|
13
|
+
on :node3 do
|
14
|
+
check_integrity_against :node1
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
process :node1, [:node1, :node2, :node3]
|
2
|
+
process :node2, [:node1, :node2, :node3]
|
3
|
+
process :node3, [:node1, :node2, :node3]
|
4
|
+
|
5
|
+
on :node1 do
|
6
|
+
generate_load_and_await_completion 10000, 10000, :auto
|
7
|
+
end
|
8
|
+
|
9
|
+
on :node2 do
|
10
|
+
check_integrity_against :node1
|
11
|
+
end
|
12
|
+
|
13
|
+
on :node3 do
|
14
|
+
check_integrity_against :node1
|
15
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
process :node1, [:node1, :node2, :node3]
|
2
|
-
process :node2, [:node1, :node2, :node3]
|
3
|
-
process :node3, [:node1, :node2, :node3]
|
1
|
+
process :node1, [:node1, :node2, :node3]
|
2
|
+
process :node2, [:node1, :node2, :node3]
|
3
|
+
process :node3, [:node1, :node2, :node3]
|
4
4
|
|
5
5
|
account :alice
|
6
6
|
account :bob
|
@@ -11,9 +11,16 @@ on :node1 do
|
|
11
11
|
create_account :alice, :master
|
12
12
|
create_account :bob, :master
|
13
13
|
close_ledger
|
14
|
-
payment :master, :bob, [:native,
|
14
|
+
payment :master, :bob, [:native, 100 * Stellar::ONE]
|
15
15
|
close_ledger
|
16
16
|
end
|
17
17
|
|
18
|
-
payment :master, :alice, [:native,
|
18
|
+
payment :master, :alice, [:native, 100 * Stellar::ONE]
|
19
19
|
|
20
|
+
on :node2 do
|
21
|
+
check_integrity_against :node1
|
22
|
+
end
|
23
|
+
|
24
|
+
on :node3 do
|
25
|
+
check_integrity_against :node1
|
26
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
use_manual_close
|
2
|
+
|
3
|
+
account :scott
|
4
|
+
account :bartek
|
5
|
+
create_account :scott
|
6
|
+
create_account :bartek
|
7
|
+
|
8
|
+
close_ledger
|
9
|
+
|
10
|
+
kp = Stellar::KeyPair.random
|
11
|
+
|
12
|
+
set_inflation_dest :scott, :bartek
|
13
|
+
set_flags :scott, [:auth_required_flag]
|
14
|
+
set_master_signer_weight :scott, 2
|
15
|
+
set_thresholds :scott, low: 0, medium: 2, high: 2
|
16
|
+
set_thresholds :scott, high: 1
|
17
|
+
set_home_domain :scott, "nullstyle.com"
|
18
|
+
add_signer :scott, kp, 1
|
19
|
+
|
20
|
+
close_ledger
|
21
|
+
|
22
|
+
clear_flags :scott, [:auth_required_flag]
|
23
|
+
remove_signer :scott, kp
|
data/examples/simple_payment.rb
CHANGED
@@ -0,0 +1,46 @@
|
|
1
|
+
old_image = ENV["OLD_IMAGE"]
|
2
|
+
new_image = ENV["NEW_IMAGE"]
|
3
|
+
|
4
|
+
raise "missing ENV['OLD_IMAGE']" unless old_image
|
5
|
+
raise "missing ENV['NEW_IMAGE']" unless new_image
|
6
|
+
|
7
|
+
peers = [:oldnode1, :oldnode2, :newnode1, :newnode2]
|
8
|
+
|
9
|
+
process :oldnode1, peers, docker_core_image: old_image, docker_pull: true
|
10
|
+
process :oldnode2, peers, docker_core_image: old_image, docker_pull: true
|
11
|
+
process :newnode1, peers, docker_core_image: new_image, docker_pull: true
|
12
|
+
process :newnode2, peers, docker_core_image: new_image, docker_pull: true
|
13
|
+
|
14
|
+
account :alice
|
15
|
+
account :bob
|
16
|
+
|
17
|
+
on :oldnode2 do
|
18
|
+
create_account :alice, :master
|
19
|
+
create_account :bob, :master
|
20
|
+
while not ((account_created :bob) and (account_created :alice))
|
21
|
+
$stderr.puts "Awaiting account-creation"
|
22
|
+
close_ledger
|
23
|
+
end
|
24
|
+
$stderr.puts "oldnode2 bob balance: #{(balance :bob)}"
|
25
|
+
$stderr.puts "oldnode2 alice balance: #{(balance :alice)}"
|
26
|
+
payment :master, :bob, [:native, 100 * Stellar::ONE]
|
27
|
+
close_ledger
|
28
|
+
end
|
29
|
+
|
30
|
+
on :newnode1 do
|
31
|
+
$stderr.puts "newnode1 bob balance: #{(balance :bob)}"
|
32
|
+
$stderr.puts "newnode1 alice balance: #{(balance :alice)}"
|
33
|
+
raise if (balance :bob) != 1100 * Stellar::ONE
|
34
|
+
payment :master, :alice, [:native, 100 * Stellar::ONE]
|
35
|
+
close_ledger
|
36
|
+
check_integrity_against :oldnode1
|
37
|
+
check_integrity_against :oldnode2
|
38
|
+
end
|
39
|
+
|
40
|
+
on :oldnode1 do
|
41
|
+
$stderr.puts "oldnode1 bob balance: #{(balance :bob)}"
|
42
|
+
$stderr.puts "oldnode1 alice balance: #{(balance :alice)}"
|
43
|
+
raise if (balance :alice) != 1100 * Stellar::ONE
|
44
|
+
check_integrity_against :newnode1
|
45
|
+
check_integrity_against :newnode2
|
46
|
+
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'fileutils'
|
2
|
+
|
2
3
|
module StellarCoreCommander
|
3
4
|
|
4
5
|
#
|
@@ -8,32 +9,35 @@ module StellarCoreCommander
|
|
8
9
|
class Commander
|
9
10
|
include Contracts
|
10
11
|
|
12
|
+
attr_reader :process_options
|
13
|
+
|
11
14
|
#
|
12
15
|
# Creates a new core commander
|
13
16
|
#
|
14
|
-
Contract Or["local", "docker"], Hash => Any
|
15
|
-
def initialize(process_type, process_options={})
|
17
|
+
Contract Or["local", "docker"], String, Hash => Any
|
18
|
+
def initialize(process_type, destination, process_options={})
|
16
19
|
@process_type = process_type
|
20
|
+
@destination = destination
|
17
21
|
@process_options = process_options
|
18
22
|
@processes = []
|
19
23
|
end
|
20
24
|
|
21
|
-
Contract Transactor, Symbol, ArrayOf[Symbol],
|
25
|
+
Contract Transactor, Symbol, ArrayOf[Symbol], Hash => Process
|
22
26
|
#
|
23
27
|
# make_process returns a new, unlaunched Process object, bound to a new
|
24
28
|
# tmpdir
|
25
|
-
def make_process(transactor, name, quorum,
|
26
|
-
|
29
|
+
def make_process(transactor, name, quorum, options={})
|
30
|
+
working_dir = File.join(@destination, name.to_s)
|
31
|
+
FileUtils.mkpath(working_dir)
|
27
32
|
|
28
33
|
process_options = @process_options.merge({
|
29
34
|
transactor: transactor,
|
30
|
-
working_dir:
|
35
|
+
working_dir: working_dir,
|
31
36
|
name: name,
|
32
|
-
base_port:
|
37
|
+
base_port: 11625 + @processes.map(&:required_ports).sum,
|
33
38
|
identity: Stellar::KeyPair.random,
|
34
39
|
quorum: quorum,
|
35
|
-
|
36
|
-
manual_close: false
|
40
|
+
manual_close: transactor.manual_close
|
37
41
|
}).merge(options)
|
38
42
|
|
39
43
|
process_class = case @process_type
|
@@ -53,32 +57,62 @@ module StellarCoreCommander
|
|
53
57
|
Contract Transactor => Process
|
54
58
|
def get_root_process(transactor)
|
55
59
|
if @processes.size == 0
|
56
|
-
make_process transactor, :node0, [:node0]
|
60
|
+
make_process transactor, :node0, [:node0]
|
57
61
|
end
|
58
62
|
@processes[0]
|
59
63
|
end
|
60
64
|
|
61
65
|
Contract None => ArrayOf[Process]
|
62
66
|
def start_all_processes
|
67
|
+
stopped = @processes.select(&:stopped?)
|
68
|
+
|
69
|
+
stopped.each(&:prepare)
|
70
|
+
|
71
|
+
stopped.each do |p|
|
72
|
+
next if p.running?
|
73
|
+
|
74
|
+
$stderr.puts "running #{p.idname} (dir:#{p.working_dir})"
|
75
|
+
p.run
|
76
|
+
p.wait_for_ready if p.await_sync?
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
Contract None => ArrayOf[Process]
|
82
|
+
def require_processes_in_sync
|
63
83
|
@processes.each do |p|
|
64
|
-
|
65
|
-
|
66
|
-
p.
|
67
|
-
|
84
|
+
next unless p.await_sync?
|
85
|
+
begin
|
86
|
+
p.wait_for_ready unless p.synced?
|
87
|
+
rescue Timeout::Error
|
88
|
+
@processes.each do |p2|
|
89
|
+
p2.dump_scp_state
|
90
|
+
p2.dump_info
|
91
|
+
p2.dump_metrics
|
92
|
+
raise "process #{p.name} lost sync"
|
93
|
+
end
|
68
94
|
end
|
69
95
|
end
|
70
96
|
end
|
71
97
|
|
98
|
+
Contract None => Bool
|
99
|
+
def check_no_process_error_metrics
|
100
|
+
@processes.each do |p|
|
101
|
+
p.check_no_error_metrics
|
102
|
+
end
|
103
|
+
true
|
104
|
+
end
|
105
|
+
|
72
106
|
def cleanup
|
73
107
|
@processes.each(&:cleanup)
|
74
108
|
end
|
75
109
|
|
76
|
-
def cleanup_at_exit!
|
110
|
+
def cleanup_at_exit!(clean_up_destination)
|
77
111
|
at_exit do
|
78
112
|
$stderr.puts "cleaning up #{@processes.length} processes"
|
79
113
|
cleanup
|
114
|
+
FileUtils.rm_rf @destination if clean_up_destination
|
80
115
|
end
|
81
116
|
end
|
82
|
-
|
83
117
|
end
|
84
118
|
end
|