-
Notifications
You must be signed in to change notification settings - Fork 721
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Write process context on node start to simplify test orchestration #1729
Conversation
eb15b3b
to
178c9fc
Compare
2792c36
to
395815f
Compare
395815f
to
1e6a308
Compare
e0ebb82
to
8bc6244
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only objection I have is to provide a standard location for the node information somwhere in the data dir. I could imagine some downstreams could use the process information we store and providing a single, standard location may simplify adoption
e2e failure is unrelated to this PR, and will be fixed by #1734 |
8bc6244
to
a067cbb
Compare
Rebased to pick up test fixes merged to dev. |
5579f4b
to
7b4d38b
Compare
a6c8a69
to
105c4ce
Compare
Waiting for #1737 to merge to fix the upgrade timeout failure. |
ac90e91
to
a4d415a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
1e8e74d
to
e0abe51
Compare
Updated to always write runtime state to a default path, PTAL. |
config/flags.go
Outdated
@@ -369,6 +370,8 @@ func addNodeFlags(fs *pflag.FlagSet) { | |||
fs.Float64(TracingSampleRateKey, 0.1, "The fraction of traces to sample. If >= 1, always sample. If <= 0, never sample") | |||
fs.StringToString(TracingHeadersKey, map[string]string{}, "The headers to provide the trace indexer") | |||
// TODO add flag to take in headers to send from exporter | |||
|
|||
fs.String(RuntimeStateFileKey, defaultRuntimeStatePath, "The path to write runtime state to (including PID, API URI, and staking address).") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can we put a comment for this flag like the other groups of flags?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given that it's a single flag with no foreseeable additional flags to group with, what comment would you suggest beyond the flag description?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or is there an existing group of flags that this flag might fit with?
By default state will not be written, and providing --runtime-state-path will ensure runtime state (API URI, bootstrap address, and pid) are written to the provided path on startup and removed from the provided path on shutdown. The details in the written file support orchestrating nodes for testing: - pid: check if process is running, stop the process - uri: connect to the node's API - bootstrap address: used by other nodes to bootstrap themselves
As per review comments, this includes using a default path with GetExpandedArg.
As per review commentary, it is preferable to bind the listener on construction to enable determining the URI to access the API endpoint without the overhead of synchronization.
fbff19d
to
396095e
Compare
Why this should be merged
The new local network fixture proposed in #1700 requires the following process context for each node to manage a local network a) without a daemon and b) with dynamically assigned ports:
PID
: used to check if the node process is running and to enable stopping the nodeURI
: used to connect to the node's API (e.g. for health checks)staking address
: used by other nodes to bootstrap themselvesInitially these details were discovered by the fixture (e.g. addresses from logs and pid from process start), but it seemed more maintainable to have the node write the necessary data directly. Having the node write the process context directly also supports the start/stop and debug of test network nodes without explicit use of the test fixture.
How this works
NodeProcessContext
type, marshaled to JSON, and written to[base-data-dir]/process.json
. On shutdown the file will be removed.NodeProcessContext
type.How this was tested