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

feat(swarm): register templates on startup automatically if not already registered #1185

Conversation

ksrichard
Copy link
Collaborator

Description

At startup we check for every registered and active templates, then compare with what we have in templates folder and then we will register automatically all the missing templates. If any new template in the meantime added to the folder and not registered, at the next startup they will be registered automatically as well.
We have a new parameter to be able to pass to start command which is --disable-template-auto-register which disables the automatic registration of templates from the templates directory (by default this feature is on).

Motivation and Context

When we start from a fresh swarm (by deleting <base_dir>/processes folder) all the previously registered templates are gone and not registered again. We need to have the previously uploaded and registered templates already in place, so any test or anything can use them.

How Has This Been Tested?

Prepare

  1. Start a swarm locally
  2. Upload a compiled template through swarm daemon UI (http://127.0.0.1:8080/) - I used simply counter example
  3. Stop swarm
  4. delete <base_dir>/processes folder (base_dir is mostly ./data)
  5. Make sure that in the <base_dir>/templates folder there is the previously uploaded .wasm file (example: counter-wasm-e8bd952191282de51ecec1bfdcea1260db3c08bf3ff3b3b072484db4da7fe0c2.wasm)

Test

  1. Start a swarm locally again
  2. Wait for it to register all nodes and start consensus
  3. Check any of the Validator Node's UI templates list if we have the new templates. (example URL: http://localhost:12072/templates)

Also tested the scenarios when I skip registration by passing the param above and checked also when I start multiple times without touching data directory whether the template is registered multiple times (it's not).

What process can a PR reviewer use to test or verify this change?

See test.

Breaking Changes

  • None
  • Requires data directory to be deleted
  • Other - Please specify

@ksrichard ksrichard requested a review from sdbondi October 24, 2024 09:28
Copy link

Test Results (CI)

577 tests  ±0   577 ✅ ±0   3h 3m 52s ⏱️ + 9m 28s
 64 suites ±0     0 💤 ±0 
  2 files   ±0     0 ❌ ±0 

Results for commit f63d725. ± Comparison against base commit d81722d.

Copy link
Member

@sdbondi sdbondi left a comment

Choose a reason for hiding this comment

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

LGTM - not tested but think it can go in

@sdbondi sdbondi added this pull request to the merge queue Oct 24, 2024
Merged via the queue into tari-project:development with commit 1d4e316 Oct 24, 2024
12 checks passed
sdbondi added a commit to sdbondi/tari-dan that referenced this pull request Oct 24, 2024
* development:
  feat(swarm): register templates on startup automatically if not already registered (tari-project#1185)
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.

3 participants