Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions plugins/operators/hostos_rollout.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,18 @@
"bvcsg-3od6r-jnydw-eysln-aql7w-td5zn-ay5m6-sibd2-jzojt-anwag-mqe"
)

# Node reward types whose nodes must never be part of a HostOS rollout.
# Currently used to exclude type4 nodes.
EXCLUDED_NODE_REWARD_TYPE_PREFIXES: tuple[str, ...] = ("type4",)

LOGGER = logging.getLogger(__name__)


def _is_excluded_node_type(n: dre.RegistryNode) -> bool:
"""Return True if the node should be globally excluded from HostOS rollouts."""
return n["node_reward_type"].startswith(EXCLUDED_NODE_REWARD_TYPE_PREFIXES)


class DagParams(typing.TypedDict):
git_revision: str
plan: str
Expand Down Expand Up @@ -241,9 +250,13 @@ def compute_actual_plan_for_batch(
possibility that nodes may have changed assignment in the meantime, or
may have changed health status.
"""
# Exclude all upgraded nodes already.
# Exclude all upgraded nodes already, plus any nodes whose reward type
# is globally opted out of HostOS rollouts (see
# EXCLUDED_NODE_REWARD_TYPE_PREFIXES).
remaining_nodes = [
n for n in registry["nodes"] if n["hostos_version_id"] != git_revision
n
for n in registry["nodes"]
if n["hostos_version_id"] != git_revision and not _is_excluded_node_type(n)
]
dcs_owned_by_dfinity = set(
d["dc_id"]
Expand Down Expand Up @@ -296,9 +309,13 @@ def compute_provisional_node_batches(
expects the specific selectors for the single batch that will do the work,
and does not iteratively reduce the number of nodes available.
"""
# Exclude all upgraded nodes already.
# Exclude all upgraded nodes already, plus any nodes whose reward type
# is globally opted out of HostOS rollouts (see
# EXCLUDED_NODE_REWARD_TYPE_PREFIXES).
remaining_nodes = [
n for n in registry["nodes"] if n["hostos_version_id"] != git_revision
n
for n in registry["nodes"]
if n["hostos_version_id"] != git_revision and not _is_excluded_node_type(n)
]
dcs_owned_by_dfinity = set(
d["dc_id"]
Expand Down
2 changes: 1 addition & 1 deletion shared/dfinity/dre.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class RegistryNode(TypedDict):
dc_id: rollout_types.DCId
node_provider_id: rollout_types.NodeProviderId
status: rollout_types.NodeStatus
# "node_type": "type1.1"
node_reward_type: rollout_types.NodeRewardType


class RegistrySubnet(TypedDict):
Expand Down
1 change: 1 addition & 0 deletions shared/dfinity/rollout_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
type DCId = str
type NodeStatus = Literal["Healthy"] | Literal["Degraded"] | Literal["Down"]
type HostOsVersion = str
type NodeRewardType = str

type DaysOfWeek = (
Literal["Monday"]
Expand Down
Loading
Loading