PineForge HPO 1.11.0
Native hyperparameter optimization for PineForge strategies
Loading...
Searching...
No Matches
pineforge_hpo.request_inventory Namespace Reference

Classes

class  RequestInventoryError
 
class  RequestTimeframeError
 

Functions

Mapping[str, Any] read_request_feed_inventory (str|os.PathLike[str]|Mapping[str, Any] artifact_dir_or_manifest)
 
tuple[str,...] admit_request_feed_inventory (Mapping[str, Any]|None inventory, *str plugin_sha256, str generated_cpp_sha256, str chart_timeframe, Mapping[str, Any] fixed_inputs, Mapping[str, ParameterSpec] input_domains)
 

Variables

dict SUPPORT_POLICY
 
 RequestInventoryReason
 
 RequestTimeframeCapability
 

Detailed Description

Pure selected-study admission of producer-bound request-feed dependencies.

Only ``read_request_feed_inventory`` reads artifact files. Neither entry point
loads a plugin, reads feeds, creates a strategy, nor enumerates trial products.
The optional codegen inventory module supplies the wire-token canonicalizer.

Function Documentation

◆ admit_request_feed_inventory()

tuple[str, ...] pineforge_hpo.request_inventory.admit_request_feed_inventory ( Mapping[str, Any] | None  inventory,
*str  plugin_sha256,
str  generated_cpp_sha256,
str  chart_timeframe,
Mapping[str, Any]  fixed_inputs,
Mapping[str, ParameterSpec]  input_domains 
)
Return every reachable request token, sorted, unique and canonical.

Rules from report-v2 section 2 [SOURCE], E/docker/request_feed_inventory.py:
:190-221 requires exactly five schema keys and exact token/input/unknown
entry shapes, with no extras, missing or duplicate JSON keys (duplicates
must be rejected while parsing; ``read_request_feed_inventory`` does so).
:258-264 requires lowercase 64-hex digests and an artifact binding. HPO also
compares the recorded source digest against supplied generated C++ identity.
Null artifact binding is ``unbound``; either differing digest is
``artifact_mismatch``. :239-280 accepts a null primary (chart-unbound),
otherwise requires its canonical token to match the supplied canonical chart.
An ``unknown`` entry always refuses; empty entries is complete and admitted.
Token entries and non-null ``primary_chart_timeframe`` must already equal
codegen's ``canonical_wire_timeframe`` result (:99-157). This is stricter than
the engine resolver, which accepts any spelling that canonicalizes, and
matches codegen's binder ``_is_wire_token`` (canonical == value). Codegen
never emits aliases here, so this rule only refuses hand-edited inventories.
Input values may use aliases, resolve from effective fixed values or declared
defaults, and invalid present values never fall back (:239-280).

Study admission additionally checks every choice of each referenced finite
ParameterSpec domain, independently, before trials. A swept input takes
precedence over any fixed value; no non-enumerable or non-string domain can
prove admission. No Cartesian products are constructed. :283-321 checks the
primary chart policy first, then resolved feed policy; the engine's own
admission remains authoritative. No artifact/feed I/O or library load occurs.

Callers must pass the verified SHA-256 of the plugin file that will be loaded
as ``plugin_sha256`` and of its generated C++ as ``generated_cpp_sha256``
(manifest values verified against the files by the artifact loader).
Admission performs no I/O and compares inventory hashes only with these
supplied values, so its identity check is only as good as those arguments.

Definition at line 280 of file request_inventory.py.

◆ read_request_feed_inventory()

Mapping[str, Any] pineforge_hpo.request_inventory.read_request_feed_inventory ( str | os.PathLike[str] | Mapping[str, Any]  artifact_dir_or_manifest)
Read the manifest block and compare an optional adjacent JSON sidecar.

Pass an artifact directory, a manifest path, or an already parsed manifest
(the last form performs no I/O). The block is required; a sidecar alone never
supplies it. When present, the sidecar must have identical parsed JSON bytes.
Duplicate keys at every JSON depth are invalid, as required by
E/docker/request_feed_inventory.py:160-221 (report-v2 section 2).

A missing block with ``request_identity.request_feed_inventory: null`` is
``producer_unavailable``: the build explicitly lacked the producer. An older
identity without the key is ``missing``. A present null block is ``invalid``.
Ordinary artifact loading never calls this selected-only helper.

Definition at line 151 of file request_inventory.py.

Variable Documentation

◆ RequestInventoryReason

pineforge_hpo.request_inventory.RequestInventoryReason
Initial value:
1= Literal[
2 "missing",
3 "invalid",
4 "unbound",
5 "artifact_mismatch",
6 "chart_mismatch",
7 "unknown",
8 "input_unresolved",
9 "producer_unavailable",
10]

Definition at line 29 of file request_inventory.py.

◆ RequestTimeframeCapability

pineforge_hpo.request_inventory.RequestTimeframeCapability
Initial value:
1= Literal[
2 "selected_window_chart_timeframe",
3 "selected_window_request_feed_timeframe",
4]

Definition at line 39 of file request_inventory.py.

◆ SUPPORT_POLICY

dict pineforge_hpo.request_inventory.SUPPORT_POLICY
Initial value:
1= {
2 "primary_chart_timeframes": ("1", "3", "5", "15", "30", "60", "120", "240"),
3 "preroll": "supported",
4 "request_feed_timeframes": ("1", "D"),
5}

Definition at line 23 of file request_inventory.py.