Skip to content
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

Netgoal: Update netgoal generate flags and variables #4656

Merged
merged 24 commits into from
Oct 25, 2022

Conversation

algobarb
Copy link
Contributor

@algobarb algobarb commented Oct 17, 2022

Summary

  1. update generate.go to mimic the same behavior for participating nodes and hosts for NPNs and NPN hosts.
  2. Update generate_network.py with better variable names and the new npn variable. Used for mainnet-model and custom recipe.
  3. Update generate_network.py to fix conditional for "ConsensusProtocol". Noticed it will error on mainnet-model otherwise.
  4. Update existing Makefiles.
  5. Added more documentation for netgoal/generate and recipe folder.
  6. Renamed the flags and variables used by netgoal/generate.go
  7. Changed references from npnHosts to npnNodes for wallet generation and stake distribution.

Important - Functional Changes

Netgoal generate short and long-form flags have changed!

  • --participation-host-machines (-N)
  • --participation-algod-nodes (-n)
  • --npn-host-machines (-X)
  • --npn-algod-nodes (-x)

Test Plan

  1. Tested the change by creating a binary locally and making sure I can specify number of NPNs without specifying the number of NPN hosts properly.
  2. Tested the recipes to make sure a newly generated net.json and genesis.json using the new netgoal binary will generate with the expected result.
  3. Tested to make sure custom recipe works.

@codecov
Copy link

codecov bot commented Oct 17, 2022

Codecov Report

Merging #4656 (af0c57a) into master (4961f54) will decrease coverage by 0.00%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #4656      +/-   ##
==========================================
- Coverage   54.35%   54.35%   -0.01%     
==========================================
  Files         402      402              
  Lines       51793    51793              
==========================================
- Hits        28154    28151       -3     
- Misses      21272    21274       +2     
- Partials     2367     2368       +1     
Impacted Files Coverage Δ
ledger/roundlru.go 90.56% <0.00%> (-5.67%) ⬇️
catchup/peerSelector.go 98.95% <0.00%> (-1.05%) ⬇️
ledger/tracker.go 74.04% <0.00%> (-0.86%) ⬇️
cmd/tealdbg/debugger.go 72.69% <0.00%> (-0.81%) ⬇️
catchup/service.go 68.64% <0.00%> (+0.49%) ⬆️
network/wsPeer.go 68.18% <0.00%> (+0.53%) ⬆️
data/transactions/verify/txn.go 77.14% <0.00%> (+0.95%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

algolucky
algolucky previously approved these changes Oct 18, 2022
excalq
excalq previously approved these changes Oct 18, 2022
Copy link
Contributor

@excalq excalq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree on using long-form params, especially in a README, but it's non-blocking, so I'll approve as well.

@algobarb algobarb dismissed stale reviews from excalq and algolucky via b39a770 October 23, 2022 20:21
@algobarb algobarb closed this Oct 23, 2022
@algobarb algobarb reopened this Oct 24, 2022
@algobarb algobarb changed the title TestData: Update NPN parameters in Recipes Netgoal: Update netgoal generate flags and variables Oct 24, 2022
brianolson
brianolson previously approved these changes Oct 24, 2022
Copy link
Contributor

@brianolson brianolson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

var nodeHostsToGenerate int
var nonPartnodesToGenerate int
var nonPartnodesHostsToGenerate int
var participationAlgodNodes int
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable renaming is great!

algolucky
algolucky previously approved these changes Oct 24, 2022
Copy link
Contributor

@algolucky algolucky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this with the loadgenerator recipe and it generates the same net.json (just change -H to -x or the long-form).

just some random markdown comments about using links.

test/testdata/deployednettemplates/recipes/README.md Outdated Show resolved Hide resolved
Comment on lines +68 to +69
generateCmd.Flags().IntVarP(&npnAlgodNodes, "npn-algod-nodes", "x", 0, "Total non-participation algod nodes to generate")
generateCmd.Flags().IntVarP(&npnHostMachines, "npn-host-machines", "X", 0, "Host machines to generate for non-participation algod nodes, default=npn-algod-nodes")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might get some questions about these, since this does make it breaking. on the other hand, it does make it more consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I posted these changes in #performance and #devops. I think they're the only ones who really know about the new X flag anyways. Not sure what else I should do besides answer questions if it comes up.

Copy link
Contributor Author

@algobarb algobarb Oct 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also updated all of the recipes' Makefiles in go-algorand, so hopefully that will help.

@algobarb algobarb dismissed stale reviews from algolucky and brianolson via af0c57a October 24, 2022 15:50
@algobarb
Copy link
Contributor Author

@egieseke Can you review the new netgoal changes to make sure you're aligned with it?

### Short-Form Flags Example
The following will result in the same outcome as the command above.
```
netgoal generate -t net -r /tmp/wat -o net.json -w 100 -R 8 -N 20 -n 100 -X 5 -x 10 --node-template node.json --relay-template relay.json --non-participating-node-template nonPartNode.json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, it's still using shorthand flags here in readme. Should we set a better example by using long form flags?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The long form flags example is right above the shorthand flags in the readme.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@egieseke egieseke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work. One other change that would be nice is to allow specifying the network name so that it is used for the hostname suffix in the net.json file. Currently, that has to be added manually.

@algobarb
Copy link
Contributor Author

algobarb commented Oct 25, 2022

Nice work. One other change that would be nice is to allow specifying the network name so that it is used for the hostname suffix in the net.json file. Currently, that has to be added manually.

Thanks! I will ask to merge this in as is for now. Maybe we can consider adding the hostname suffix in a follow up iteration/ticket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants