Skip to navigation

nemo_gym.tasks.harbor.build_options

View as Markdown

The builds table of the run configuration.

BuildOptions carries whether builds are enabled, which tool to use, the repository to push to and the platform to build for. It is read from a Hydra config mapping and, before the run config exists, from the command line overrides and env.yaml by a side-effect-free Hydra parse. The module depends on the build tool list and the repository variable only.

Module Contents

Classes

NameDescription
BuildOptionsHow prepare treats Dockerfiles outside pull and overlay mode: the builds: configuration block.

Functions

NameDescription
_build_setting-
build_options_from_overridesRead the builds: block from the configuration the command line names, before the run config exists.

Data

BUILDS_KEY

BUILD_SETTINGS

HYDRA_QUIET_OVERRIDES

API

class nemo_gym.tasks.harbor.build_options.BuildOptions(
enabled: bool = True,
tool: str | None = None,
repository: str | None = None,
platform: str | None = None
)
Dataclass

How prepare treats Dockerfiles outside pull and overlay mode: the builds: configuration block.

tool builds them (buildah, podman or docker; default: the first one on PATH that fits, see nemo_gym.tasks.harbor.image_build.detect_tool). repository is the registry path built images are pushed under (default: the NEMO_GYM_BUILD_REPOSITORY variable; unset keeps them local in the Docker daemon). platform is passed to the tool (default linux/amd64). With enabled false nothing is built, and the tasks that need a build are skipped with the loader’s message.

enabled
bool = True
platform
str | None = None
repository
str | None = None
tool
str | None = None
config: collections.abc.Mapping[str, typing.Any] | None
classmethod

The builds: block of a merged configuration dict, applied over the defaults.

config is the merged global configuration (env.yaml, --config files and ++builds.<setting>=<value> overrides) or any dict shaped like it; a missing block keeps every default. Unknown settings and values of the wrong type are refused.

nemo_gym.tasks.harbor.build_options._build_setting(
block: collections.abc.Mapping[str, typing.Any],
name: str
) -> str | None
nemo_gym.tasks.harbor.build_options.build_options_from_overrides(
overrides: list[str]

Read the builds: block from the configuration the command line names, before the run config exists.

Preparation builds images before the run config can be written, so the global configuration is not composed yet. This merges the sources the user controls, in the global config’s order (the files the +config_paths tokens name, from --config and the asset selectors, then env.yaml, then the +/++ overrides), and reads the block from the result. The full global config is still parsed once, at dispatch, with the run config added.

nemo_gym.tasks.harbor.build_options.BUILDS_KEY = 'builds'
nemo_gym.tasks.harbor.build_options.BUILD_SETTINGS = ('tool', 'repository', 'platform', 'enabled')
nemo_gym.tasks.harbor.build_options.HYDRA_QUIET_OVERRIDES = ('hydra.run.dir=.', 'hydra.output_subdir=null', 'hydra/job_logging=none', 'hydra...