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

one process per baker #517

Merged
merged 3 commits into from
Dec 29, 2022
Merged

one process per baker #517

merged 3 commits into from
Dec 29, 2022

Conversation

nicolasochem
Copy link
Collaborator

@nicolasochem nicolasochem commented Dec 8, 2022

When baking for several addresses, today we instantiate only one baker process. This is unsupported and bad, because it does things sequentially. The supported way to bake for several addresses is to run one baking process per address. This PR changes tezos-k8s to do that.

This is a second, less intrusive attempt after feedback from Aryeh.

  • helm computes the maximum number of baking processes that any pod in the statefulset would need
  • instantiates the max number of bakers for each pod (no choice here..)
  • the baker entrypoint figures which baker it must bake for thanks to a new BAKER_INDEX env var. If it must idle, it enters an infinite sleeping loop.

This works when using bake_using_accounts. I verified that I did not break bake_using_account.

I verified by:

  • creating a private chain with 3 bakers using mkchain
  • assigning two bakers to the first node and one baker to the second

I also ran mkchain with no parameters to ensure it still works.

Various cleanups:

  • remove a octez v13 specific catch (must pass toggle even when vote file absent) in the baker entrypoint

Note that in the future, the baker will be its own pod to this will become irrelevant.

@elric1
Copy link
Collaborator

elric1 commented Dec 15, 2022

I find the DAEMON env var useful because I set PS1 to include it:

node_globals:
  env:
    all:
      PS1: ": $HOSTNAME $DAEMON; "
      TEZOS_CLIENT_UNSAFE_DISABLE_DISCLAIMER: "Y"

When baking for several addresses, today we instantiate only one baker
process. This is unsupported and bad, because it does things
sequentially. The supported way to bake for several addresses is to run
one baking process per address. This PR changes tezos-k8s to do that.

This is a second, less intrusive attempt after feedback from Aryeh.

* helm computes the maximum number of baking processes that any pod in
  the statefulset would need
* instantiates the max number of bakers for each pod (no choice here..)
* the baker entrypoint figures which baker it must bake for thanks to a
  new BAKER_INDEX env var. If it must idle, it enters an infinite
  sleeping loop.

This works when using `bake_using_accounts`. I verified that I did not
break `bake_using_account`.

I verified by:
* creating a private chain with 3 bakers using mkchain
* assigning two bakers to the first node and one baker to the second

I also ran mkchain with no parameters to ensure it still works.

Various cleanups:

* remove a octez v13 specific catch (must pass toggle even when vote
  file absent) in the baker entrypoint
* remove the DAEMON env var in baker (was used to disambiguate between
  baker and endorser)

Random comment:

I don't think it's great that the logic to pick the baking accounts is
written in config-generator.sh instead of py, but I'm not changing this
here.
@nicolasochem
Copy link
Collaborator Author

I find the DAEMON env var useful because I set PS1 to include it:

node_globals:
  env:
    all:
      PS1: ": $HOSTNAME $DAEMON; "
      TEZOS_CLIENT_UNSAFE_DISABLE_DISCLAIMER: "Y"

I reinstated it. Thanks for looking, a review would me much appreciated.

Copy link
Collaborator

@harryttd harryttd left a comment

Choose a reason for hiding this comment

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

Looks great to me. I have not thoroughly tested but the code looks good.

Do you mind:

  • removing the comment remove the DAEMON env var... from the PR description
  • leaving a comment that this PR's changes should be temporary. Based on changes that should be taking place in the future to how the node and baker will be functioning differently.
  • Merge latest master into this PR

@@ -255,17 +259,31 @@
{{- define "tezos.container.bakers" }}
{{- if has "baker" $.node_vals.runs }}
{{- $node_vals_images := $.node_vals.images | default dict }}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I know this line was not introduced in this PR but i don't see why it is needed.

@nicolasochem nicolasochem merged commit 71454ae into master Dec 29, 2022
@nicolasochem nicolasochem deleted the multiple_baker_processes_2 branch December 29, 2022 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants