pd_cds_api.state
pd_cds_api.state
¶
Client configuration state for the conditions API.
:class:ApiClientState is the single place where connection and payload
preferences live. It is validated (pydantic), safe to share across calls,
and exposes the location of the native executable bundled by the companion
pd_cds_api_bin package.
pd_cds_api.state.ApiClientState
¶
Bases: BaseModel
Connection and payload configuration for one client workflow.
All fields have production defaults, so ApiClientState() is always
usable; the CLI overrides individual fields from its global options and
matching environment variables. Values are validated at construction time.
api_server_url = Field(default=HttpUrl(url='http://dunefrontier.fnal.gov:8000/dune_runcon_prod'), validate_default=True, description='Conditions Database API server URL (Frontier servlet).')
class-attribute
instance-attribute
¶
bin_path = Field(default='pd_cds_api_bin', frozen=True, description='Internal: importlib.resources anchor package holding the native runtime; not user-configurable.')
class-attribute
instance-attribute
¶
cache_proxy_url = Field(default=HttpUrl(url='http://localhost:3128'), validate_default=True, description='Frontier cache proxy used to reach the API server.')
class-attribute
instance-attribute
¶
format = Field(default='csv', description='Response format appended to the query (``csv`` or ``json``); ``None`` omits the parameter entirely.')
class-attribute
instance-attribute
¶
frontier_client_name = Field(default='fn-fileget', frozen=True, description='Internal: file name of the native executable; not user-configurable.')
class-attribute
instance-attribute
¶
frontier_client_path
property
¶
Absolute filesystem path to the executable fn-fileget.
Resolved from the pd_cds_api_bin resource package and cached per
anchor/name; the exec bit is restored defensively when an installer
drops it.
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
The native runtime is not staged/installed. The message names the remediation step (staging script or CI-built wheels). |
frontier_ttl = Field(default=2, description='Frontier proxy cache time-to-live level: 1 = short (fresh fetch), 2 = server default, 3 = forever (immutable historical data). Higher levels trade freshness for latency.')
class-attribute
instance-attribute
¶
proxy_config_url = Field(default='auto', description='Frontier proxy auto-config (PAC) URL passed to the native client: ``auto`` discovers a PAC file via WPAD (``http://wpad/wpad.dat``), ``none`` disables proxy auto-config, or give an ``http://``/``file://`` PAC URL. PAC-derived proxies take priority over ``cache_proxy_url``; an unreachable PAC is fatal to the query in the native client.')
class-attribute
instance-attribute
¶
verbose = Field(default=False, description='Enable verbose output (CLI only; the API ignores it).')
class-attribute
instance-attribute
¶
_validate_proxy_config_url(value)
classmethod
¶
Accept only the forms the native Frontier client understands.
The C client (frontier_config.c) rewrites auto to
http://wpad/wpad.dat and accepts only http:// or
file:// PAC URLs; anything else is a fatal config error at
channel creation, so reject it up front. none is our
client-side disable sentinel and never reaches the connect string.