.. index:: pair: class; gpr::track::MlflowRun .. _doxid-classgpr_1_1track_1_1_mlflow_run: class gpr::track::MlflowRun =========================== .. toctree:: :hidden: enum_gpr_track_MlflowRun_Status.rst struct_gpr_track_MlflowRun_Options.rst struct_gpr_track_MlflowRun_PendingMetric.rst Overview ~~~~~~~~ One MLflow run. :ref:`More...` .. ref-code-block:: cpp :class: doxyrest-overview-code-block #include class MlflowRun { public: // enums enum :ref:`Status`; // structs struct :ref:`Options`; struct :ref:`PendingMetric`; // construction :target:`MlflowRun`(const MlflowRun&); :target:`~MlflowRun`(); // methods static std::unique_ptr<:ref:`MlflowRun`> :ref:`start`(const :ref:`Options`& options); :ref:`MlflowRun`& :target:`operator=`(const :ref:`MlflowRun`&); void :target:`logParam`(std::string_view key, std::string_view value); void :target:`logParam`(std::string_view key, double value); void :target:`logParam`(std::string_view key, long value); void :target:`logMetric`(std::string_view key, double value, long step = 0); void :target:`setTag`(std::string_view key, std::string_view value); void :ref:`logArtifact`(const std::filesystem::path& file, const std::string& name = ""); void :ref:`appendRecord`(std::string_view stream, const :ref:`JsonRecord`& record); void :ref:`flush`(); void :target:`finish`(:ref:`Status` status); const std::string& :target:`runId`() const; const std::string& :target:`experimentId`() const; const std::filesystem::path& :target:`runDirectory`() const; bool :target:`streaming`() const; std::string :ref:`identityJson`() const; }; .. _details-classgpr_1_1track_1_1_mlflow_run: Detailed Documentation ~~~~~~~~~~~~~~~~~~~~~~ One MLflow run. It is written directly in the tracking file-store layout under a store directory (mlruns/EXPERIMENT_ID/RUN_ID/{meta.yaml, params,metrics,tags,artifacts}, readable by ``mlflow ui --backend-store-uri `file:// `__``), and streamed to a running tracking server when a tracking URI is given: the run is created there with the same id, metrics/params/tags go out in log-batch requests on :ref:`flush() `, and the record streams are uploaded as artifacts at :ref:`finish() ` when the server proxies artifacts. Metrics carry a step; records are JSON lines appended to a named stream under artifacts/, for the vectors a post-mortem of the surrogate needs. Methods ------- .. index:: pair: function; start .. _doxid-classgpr_1_1track_1_1_mlflow_run_1af0c5262aba36a60fb6c3ed1b79245fd3: .. ref-code-block:: cpp :class: doxyrest-title-code-block static std::unique_ptr<:ref:`MlflowRun`> start(const :ref:`Options`& options) Nullptr when neither a store nor a tracking URI is given. Throws on an unwritable store; a server that cannot be reached disables streaming with a warning and the local store continues. .. index:: pair: function; logArtifact .. _doxid-classgpr_1_1track_1_1_mlflow_run_1a063cf270901a49985ba3a856b2d9e30c: .. ref-code-block:: cpp :class: doxyrest-title-code-block void logArtifact(const std::filesystem::path& file, const std::string& name = "") Copy a file into artifacts/ (optionally under a relative name). .. index:: pair: function; appendRecord .. _doxid-classgpr_1_1track_1_1_mlflow_run_1a42268f2df29b5028b65c697d63c257f4: .. ref-code-block:: cpp :class: doxyrest-title-code-block void appendRecord(std::string_view stream, const :ref:`JsonRecord`& record) Append one JSON line to artifacts/STREAM_NAME.jsonl. .. index:: pair: function; flush .. _doxid-classgpr_1_1track_1_1_mlflow_run_1af13e8c8c0e242dbbc8155f09cce1267d: .. ref-code-block:: cpp :class: doxyrest-title-code-block void flush() Send buffered metrics, params and tags to the tracking server. .. index:: pair: function; identityJson .. _doxid-classgpr_1_1track_1_1_mlflow_run_1aa9572462955c0aebf2749d354c45500a: .. ref-code-block:: cpp :class: doxyrest-title-code-block std::string identityJson() const The run's identity as JSON, for a caller that attaches later (the validation stage of a campaign runner).