refactor(controller,xceadmin): drop generic Resource.unit, hardcode bytes for maxmem
Simplification per review feedback on e3b3ffa: a generic schema-driven
unit field touched the capnp wire schema (2 structs), C structs
(xce_resource_t/xce_resval_t), resobj.c's deep-copy/destroy, opget.c's
reply-build lookup, resources.yaml/resources.schema.json, and mapping.py
-- real cross-cutting cost for a mechanism only one resource (maxmem)
actually needs today.
Reverted all of that. The controller CLI (test.c) now just knows
"maxmem" is bytes-valued via a small explicit is_bytes_valued_resource()
name list, and adaptively picks the best-fit human unit at display time
(format_bytes_human, unchanged) -- same observable behavior (resval/
workerlist render maxmem as e.g. "30.90 GB"), zero wire schema surface.
Regenerated the xceadmin golden fixture back to its pre-unit-field size
(5304 bytes, exactly matching the size right after the mxj-only fix,
confirming a clean, complete removal).
Verified: 1095/1095 controller_unit_test (3 runs; one hit the
pre-existing flaky segfault already logged as bug-1553, unrelated),
228/228 xceadmin pytest, clean rebuild of lib/controller/xceadmin/xce_test.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
e3b3ffaa97
commit
5bf123cc20
10 changed files with 36 additions and 58 deletions
|
|
@ -71,11 +71,7 @@ reason -- never a silent drop.
|
|||
runtime (e.g. ``scheduler.c`` copies these three fields straight out
|
||||
of the parsed resource). See :data:`_RESOURCE_VALTYPE`,
|
||||
:data:`_RESOURCE_ORDTYPE`, and the flag constants below for the exact
|
||||
values. ``unit`` is mapped straight through from YAML when present --
|
||||
a display-only hint (e.g. ``"bytes"``) the controller CLI (``resval``/
|
||||
``workerlist``) uses to render a human-readable value; the stored
|
||||
value itself is never converted, only its display. ``idx`` and
|
||||
``lastReport`` remain unset: ``idx`` has no YAML source at all
|
||||
values. ``idx`` and ``lastReport`` remain unset: ``idx`` has no YAML source at all
|
||||
(controller/runtime-assigned), and ``lastReport`` is a runtime
|
||||
timestamp field (epoch seconds of last report) -- excluded by
|
||||
Requirement 9.2's "no timestamp" rule. ``resourcemap`` has no
|
||||
|
|
@ -328,8 +324,6 @@ def _build_resource(item: dict, target: "capnp._DynamicStructBuilder") -> None:
|
|||
if item.get("release"):
|
||||
flags |= _RESOURCE_FLAG_RELEASE
|
||||
target.flags = flags
|
||||
if "unit" in item:
|
||||
target.unit = item["unit"]
|
||||
|
||||
|
||||
def _build_queue(item: dict, target: "capnp._DynamicStructBuilder") -> None:
|
||||
|
|
|
|||
BIN
src/xceadmin/tests/fixtures/full/expected.bin
vendored
BIN
src/xceadmin/tests/fixtures/full/expected.bin
vendored
Binary file not shown.
|
|
@ -173,20 +173,6 @@ def test_map_list_section_noop_on_empty_or_missing_items(cluster_config):
|
|||
assert len(cluster_config.resources) == 0
|
||||
|
||||
|
||||
def test_map_list_section_resources_maps_unit_when_present(cluster_config):
|
||||
items = [
|
||||
{"name": "maxmem", "type": "numeric", "unit": "bytes"},
|
||||
{"name": "maxcpus", "type": "numeric"},
|
||||
]
|
||||
mapping.map_list_section(_spec_for("resources"), items, cluster_config)
|
||||
|
||||
r0, r1 = cluster_config.resources
|
||||
assert r0.unit == "bytes"
|
||||
# Every existing resource has no "unit" key -- must stay unset (empty
|
||||
# Text default), not silently inherit or default to any value.
|
||||
assert r1.unit == ""
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# map_list_section: users.yaml/hosts.yaml -> ugroups/hgroups (named groups)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue