pyfebiopt.monitoring.client
===========================

.. py:module:: pyfebiopt.monitoring.client

.. autoapi-nested-parse::

   Emit optimization lifecycle events to a monitoring service.



Classes
-------

.. autoapisummary::

   pyfebiopt.monitoring.client.MonitorConfig
   pyfebiopt.monitoring.client.OptimizationMonitorClient


Functions
---------

.. autoapisummary::

   pyfebiopt.monitoring.client.generate_run_id
   pyfebiopt.monitoring.client.display_label_from_run_id


Module Contents
---------------

.. py:function:: generate_run_id(label: str | None = None) -> str

   Produce a fresh run identifier using the provided label.

   :returns: Run identifier combining the label slug and a random suffix.
   :rtype: str


.. py:function:: display_label_from_run_id(run_id: str) -> str

   Return the human label portion of a generated run id.

   :returns: Run id without the generated random suffix when present.
   :rtype: str


.. py:class:: MonitorConfig

   Hold options for the optimization monitoring client.


   .. py:attribute:: socket_path
      :type:  pathlib.Path | None
      :value: None



   .. py:attribute:: run_id
      :type:  str | None
      :value: None



   .. py:attribute:: label
      :type:  str | None
      :value: None



.. py:class:: OptimizationMonitorClient(config: MonitorConfig | None = None)

   Emit optimization lifecycle events to the monitor service.

   Initialize the emitter and run metadata.


   .. py:attribute:: run_id


   .. py:attribute:: label


   .. py:method:: run_started(*, parameters: collections.abc.Mapping[str, Any] | None = None, cases: list[collections.abc.Mapping[str, Any]] | None = None, optimizer: collections.abc.Mapping[str, Any] | None = None, meta: collections.abc.Mapping[str, Any] | None = None) -> None

      Emit the run started event.



   .. py:method:: record_iteration(*, index: int, cost: float, theta: collections.abc.Mapping[str, float], metrics: collections.abc.Mapping[str, Any] | None = None, series: collections.abc.Mapping[str, collections.abc.Mapping[str, Any]] | None = None) -> None

      Emit iteration progress with metrics and series data.



   .. py:method:: run_completed(*, summary: collections.abc.Mapping[str, Any] | None = None, exit_code: int | None = None) -> None

      Announce the completed run with optional summary.



   .. py:method:: run_failed(*, reason: str, exit_code: int | None = None) -> None

      Notify the monitor of a failed run.



   .. py:method:: emit_meta(meta: collections.abc.Mapping[str, Any]) -> None

      Send additional metadata to the monitor.



