Skip to content

Add bg task for collecting chicken switches from DB #8462

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

andrewjstone
Copy link
Contributor

Wire up the task watcher into the planner so that it only runs when the planner_enabled switch is set to `true.

Fixes #8253

Wire up the task watcher into the planner so that it only runs when the
`planner_enabled` switch is set to `true.

Fixes #8253
@andrewjstone andrewjstone requested a review from jgallagher June 26, 2025 19:16
@andrewjstone
Copy link
Contributor Author

Manual testing:

➜  omicron git:(ajs/chicken-switch-bg-task) cargo run -p omicron-omdb nexus --nexus-internal-url='http://[::1]:12221' chicken-switches show current
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.87s
     Running `target/debug/omdb nexus '--nexus-internal-url=http://[::1]:12221' chicken-switches show current`
note: using Nexus URL http://[::1]:12221
No chicken switches enabled

➜  omicron git:(ajs/chicken-switch-bg-task) cargo run -p omicron-omdb nexus --nexus-internal-url='http://[::1]:12221' background-tasks show blueprint_planner
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.78s
     Running `target/debug/omdb nexus '--nexus-internal-url=http://[::1]:12221' background-tasks show blueprint_planner`
note: using Nexus URL http://[::1]:12221
task: "blueprint_planner"
  configured period: every 1m
  currently executing: no
  last completed activation: iter 8, triggered by a periodic timer firing
    started at 2025-06-26T21:23:41.949Z (16s ago) and ran for 0ms
    blueprint planning explicitly disabled by config!
    
➜  omicron git:(ajs/chicken-switch-bg-task) cargo run -p omicron-omdb nexus --nexus-internal-url='http://[::1]:12221' chicken-switches set --planner-enabled true -w
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.86s
     Running `target/debug/omdb nexus '--nexus-internal-url=http://[::1]:12221' chicken-switches set --planner-enabled true -w`
note: using Nexus URL http://[::1]:12221
Chicken switches updated at version 1

➜  omicron git:(ajs/chicken-switch-bg-task) cargo run -p omicron-omdb nexus --nexus-internal-url='http://[::1]:12221' chicken-switches show current
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.78s
     Running `target/debug/omdb nexus '--nexus-internal-url=http://[::1]:12221' chicken-switches show current`
note: using Nexus URL http://[::1]:12221
Reconfigurator Chicken Switches:
    version: 1
    modified time: 2025-06-26 21:24:31.546880 UTC
    planner enabled: true

➜  omicron git:(ajs/chicken-switch-bg-task) cargo run -p omicron-omdb nexus --nexus-internal-url='http://[::1]:12221' background-tasks show blueprint_planner
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.81s
     Running `target/debug/omdb nexus '--nexus-internal-url=http://[::1]:12221' background-tasks show blueprint_planner`
note: using Nexus URL http://[::1]:12221
task: "blueprint_planner"
  configured period: every 1m
  currently executing: no
  last completed activation: iter 11, triggered by a dependent task completing
    started at 2025-06-26T21:24:42.200Z (23s ago) and ran for 99ms
    plan unchanged from parent 0a6670a1-ccf9-4062-be6d-5f6e6821e644
    
➜  omicron git:(ajs/chicken-switch-bg-task) cargo run -p omicron-omdb nexus --nexus-internal-url='http://[::1]:12221' chicken-switches set --planner-enabled false -w
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.82s
     Running `target/debug/omdb nexus '--nexus-internal-url=http://[::1]:12221' chicken-switches set --planner-enabled false -w`
note: using Nexus URL http://[::1]:12221
Chicken switches updated at version 2

➜  omicron git:(ajs/chicken-switch-bg-task) cargo run -p omicron-omdb nexus --nexus-internal-url='http://[::1]:12221' chicken-switches show current
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.80s
     Running `target/debug/omdb nexus '--nexus-internal-url=http://[::1]:12221' chicken-switches show current`
note: using Nexus URL http://[::1]:12221
Reconfigurator Chicken Switches:
    version: 2
    modified time: 2025-06-26 21:25:38.912297 UTC
    planner enabled: false

➜  omicron git:(ajs/chicken-switch-bg-task) cargo run -p omicron-omdb nexus --nexus-internal-url='http://[::1]:12221' background-tasks show blueprint_planner
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.94s
     Running `target/debug/omdb nexus '--nexus-internal-url=http://[::1]:12221' background-tasks show blueprint_planner`
note: using Nexus URL http://[::1]:12221
task: "blueprint_planner"
  configured period: every 1m
  currently executing: no
  last completed activation: iter 13, triggered by a dependent task completing
    started at 2025-06-26T21:25:42.178Z (0s ago) and ran for 0ms
    blueprint planning explicitly disabled by config!
    
➜  omicron git:(ajs/chicken-switch-bg-task) cargo run -p omicron-omdb nexus --nexus-internal-url='http://[::1]:12221' chicken-switches show 1
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.78s
     Running `target/debug/omdb nexus '--nexus-internal-url=http://[::1]:12221' chicken-switches show 1`
note: using Nexus URL http://[::1]:12221
Reconfigurator Chicken Switches:
    version: 1
    modified time: 2025-06-26 21:24:31.546880 UTC
    planner enabled: true

Copy link
Contributor

@jgallagher jgallagher 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, just some minor nits 👍

@andrewjstone
Copy link
Contributor Author

I followed the same testing as above after implementing the review fixes and everything works.

@andrewjstone andrewjstone enabled auto-merge (squash) July 1, 2025 15:05
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.

runtime configurability for Reconfigurator
3 participants