Skip to navigation

nemo_gym.sandbox.providers.opensandbox.resource_telemetry

View as Markdown

Translate OpenSandbox resource quantities and inspection into shared Gym types.

Module Contents

Functions

NameDescription
_quantityDecode Kubernetes decimal, binary and exponent quantities to base units.
parse_allocationParse explicit inspection resources; never infer allocation from submission.
resource_amountsNormalize known OSB/Kubernetes resources; vendor resources are not guessed.

Data

_BINARY_EXPONENTS

_DECIMAL_EXPONENTS

API

nemo_gym.sandbox.providers.opensandbox.resource_telemetry._quantity(
value: object
) -> decimal.Decimal

Decode Kubernetes decimal, binary and exponent quantities to base units.

nemo_gym.sandbox.providers.opensandbox.resource_telemetry.parse_allocation(
text: str,
scope: str | None = None

Parse explicit inspection resources; never infer allocation from submission.

Scope can be the OSB control-plane deployment when a cluster ID is unavailable. Only emit a pod designator when both namespace and pod are present.

nemo_gym.sandbox.providers.opensandbox.resource_telemetry.resource_amounts(
resources: collections.abc.Mapping[str, object]

Normalize known OSB/Kubernetes resources; vendor resources are not guessed.

nemo_gym.sandbox.providers.opensandbox.resource_telemetry._BINARY_EXPONENTS = {'Ki': 10, 'Mi': 20, 'Gi': 30, 'Ti': 40, 'Pi': 50, 'Ei': 60}
nemo_gym.sandbox.providers.opensandbox.resource_telemetry._DECIMAL_EXPONENTS = {'n': -9, 'u': -6, 'm': -3, '': 0, 'k': 3, 'K': 3, 'M': 6, 'G': 9, 'T': 12, 'P':...