Skip to content
Open
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
21 changes: 20 additions & 1 deletion ax/core/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

from abc import ABC, abstractmethod
from collections.abc import Iterable
from typing import Any, Self, TYPE_CHECKING
from dataclasses import dataclass
from typing import Any, ClassVar, Self, TYPE_CHECKING

from ax.utils.common.base import Base
from ax.utils.common.serialization import SerializationMixin
Expand All @@ -21,9 +22,27 @@
from ax import core # noqa F401


class RunnerConfig:
@dataclass(frozen=True)
class SearchSpaceUpdateArguments:
"""Base arguments for search space updates. Override in RunnerConfig
subclasses to add runner-specific fields."""

pass

@dataclass(frozen=True)
class RunnerUpdateArguments:
"""Base arguments for general runner updates. Override in RunnerConfig
subclasses to add runner-specific fields."""

pass


class Runner(Base, SerializationMixin, ABC):
"""Abstract base class for custom runner classes"""

config_type: ClassVar[type[RunnerConfig]] = RunnerConfig

@property
def staging_required(self) -> bool:
"""Whether the trial goes to staged or running state once deployed."""
Expand Down
22 changes: 22 additions & 0 deletions ax/utils/common/sentinel.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env python3
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

# pyre-strict


class Unset:
"""Sentinel type for distinguishing "not provided" from an explicit ``None``.

Use the module-level ``UNSET`` instance as the default value for
optional fields where ``None`` is a valid, meaningful value and a
separate "not set" state is needed.
"""

def __repr__(self) -> str:
return "UNSET"


UNSET: Unset = Unset()
Loading