code
stringlengths
66
870k
docstring
stringlengths
19
26.7k
func_name
stringlengths
1
138
language
stringclasses
1 value
repo
stringlengths
7
68
path
stringlengths
5
324
url
stringlengths
46
389
license
stringclasses
7 values
def link_prompts_to_trace(self, prompt_versions: list[PromptVersion], trace_id: str) -> None: """ Link multiple prompt versions to a trace. Default implementation sets a tag on the trace. Stores can override with custom behavior. Args: prompt_versions: List of PromptVersion...
Link multiple prompt versions to a trace. Default implementation sets a tag on the trace. Stores can override with custom behavior. Args: prompt_versions: List of PromptVersion objects to link. trace_id: Trace ID to link to each prompt version.
link_prompts_to_trace
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def set_prompt_version_tag( self, name: str, version: Union[str, int], key: str, value: str ) -> None: """ Set a tag on a prompt version. Default implementation: uses set_model_version_tag on the underlying ModelVersion. Unity Catalog store implementations may override this ...
Set a tag on a prompt version. Default implementation: uses set_model_version_tag on the underlying ModelVersion. Unity Catalog store implementations may override this method. Args: name: Name of the prompt. version: Version number of the prompt. ke...
set_prompt_version_tag
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def delete_prompt_version_tag(self, name: str, version: Union[str, int], key: str) -> None: """ Delete a tag from a prompt version. Default implementation: uses delete_model_version_tag on the underlying ModelVersion. Unity Catalog store implementations may override this method. ...
Delete a tag from a prompt version. Default implementation: uses delete_model_version_tag on the underlying ModelVersion. Unity Catalog store implementations may override this method. Args: name: Name of the prompt. version: Version number of the prompt. ...
delete_prompt_version_tag
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def link_prompt_version_to_model(self, name: str, version: str, model_id: str) -> None: """ Link a prompt version to a model. Default implementation sets a tag. Stores can override with custom behavior. Args: name: Name of the prompt. version: Version of the pro...
Link a prompt version to a model. Default implementation sets a tag. Stores can override with custom behavior. Args: name: Name of the prompt. version: Version of the prompt to link. model_id: ID of the model to link to.
link_prompt_version_to_model
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def link_prompt_version_to_run(self, name: str, version: str, run_id: str) -> None: """ Link a prompt version to a run. Default implementation sets a tag. Stores can override with custom behavior. Args: name: Name of the prompt. version: Version of the prompt to...
Link a prompt version to a run. Default implementation sets a tag. Stores can override with custom behavior. Args: name: Name of the prompt. version: Version of the prompt to link. run_id: ID of the run to link to.
link_prompt_version_to_run
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def _update_linked_prompts_tag( self, current_tag_value: str, new_prompt_entries: list[dict[str, Any]] ) -> str: """ Utility method to update linked prompts tag value with new entries. Args: current_tag_value: Current JSON string value of the linked prompts tag ...
Utility method to update linked prompts tag value with new entries. Args: current_tag_value: Current JSON string value of the linked prompts tag new_prompt_entries: List of prompt entry dicts to add Returns: Updated JSON string with new entries added (avoid...
_update_linked_prompts_tag
python
mlflow/mlflow
mlflow/store/model_registry/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/abstract_store.py
Apache-2.0
def __init__(self, root_directory=None): """ Create a new FileStore with the given root directory. """ super().__init__() self.root_directory = local_file_uri_to_path(root_directory or _default_root_dir()) # Create models directory if needed if not exists(self.mo...
Create a new FileStore with the given root directory.
__init__
python
mlflow/mlflow
mlflow/store/model_registry/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/file_store.py
Apache-2.0
def _check_root_dir(self): """ Run checks before running directory operations. """ if not exists(self.root_directory): raise Exception(f"'{self.root_directory}' does not exist.") if not is_directory(self.root_directory): raise Exception(f"'{self.root_direc...
Run checks before running directory operations.
_check_root_dir
python
mlflow/mlflow
mlflow/store/model_registry/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/file_store.py
Apache-2.0
def update_registered_model(self, name, description, deployment_job_id=None): """ Update description of the registered model. Args: name: Registered model name. description: New description. deployment_job_id: Optional deployment job ID. Returns: ...
Update description of the registered model. Args: name: Registered model name. description: New description. deployment_job_id: Optional deployment job ID. Returns: A single updated :py:class:`mlflow.entities.model_registry.RegisteredModel` obje...
update_registered_model
python
mlflow/mlflow
mlflow/store/model_registry/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/file_store.py
Apache-2.0
def rename_registered_model(self, name, new_name): """ Rename the registered model. Args: name: Registered model name. new_name: New proposed name. Returns: A single updated :py:class:`mlflow.entities.model_registry.RegisteredModel` object. ...
Rename the registered model. Args: name: Registered model name. new_name: New proposed name. Returns: A single updated :py:class:`mlflow.entities.model_registry.RegisteredModel` object.
rename_registered_model
python
mlflow/mlflow
mlflow/store/model_registry/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/file_store.py
Apache-2.0
def create_model_version( self, name, source, run_id=None, tags=None, run_link=None, description=None, local_model_path=None, model_id: Optional[str] = None, ) -> ModelVersion: """ Create a new model version from given source an...
Create a new model version from given source and run ID. Args: name: Registered model name. source: URI indicating the location of the model artifacts. run_id: Run ID from MLflow tracking server that generated the model. tags: A list of :py:class:`mlflow...
create_model_version
python
mlflow/mlflow
mlflow/store/model_registry/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/file_store.py
Apache-2.0
def update_model_version(self, name, version, description) -> ModelVersion: """ Update metadata associated with a model version in backend. Args: name: Registered model name. version: Registered model version. description: New model description. Retu...
Update metadata associated with a model version in backend. Args: name: Registered model name. version: Registered model version. description: New model description. Returns: A single :py:class:`mlflow.entities.model_registry.ModelVersion` objec...
update_model_version
python
mlflow/mlflow
mlflow/store/model_registry/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/file_store.py
Apache-2.0
def transition_model_version_stage( self, name, version, stage, archive_existing_versions ) -> ModelVersion: """ Update model version stage. Args: name: Registered model name. version: Registered model version. stage: New desired stage for this mo...
Update model version stage. Args: name: Registered model name. version: Registered model version. stage: New desired stage for this model version. archive_existing_versions: If this flag is set to ``True``, all existing model versions in ...
transition_model_version_stage
python
mlflow/mlflow
mlflow/store/model_registry/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/file_store.py
Apache-2.0
def delete_model_version(self, name, version): """ Delete model version in backend. Args: name: Registered model name. version: Registered model version. Returns: None """ model_version = self._fetch_file_model_version_if_exists(name=...
Delete model version in backend. Args: name: Registered model name. version: Registered model version. Returns: None
delete_model_version
python
mlflow/mlflow
mlflow/store/model_registry/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/file_store.py
Apache-2.0
def _read_yaml(root, file_name, retries=2): """ Read data from yaml file and return as dictionary, retrying up to a specified number of times if the file contents are unexpectedly empty due to a concurrent write. Args: root: Directory name. file_name: Fil...
Read data from yaml file and return as dictionary, retrying up to a specified number of times if the file contents are unexpectedly empty due to a concurrent write. Args: root: Directory name. file_name: File name. Expects to have '.yaml' extension. ...
_read_yaml
python
mlflow/mlflow
mlflow/store/model_registry/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/file_store.py
Apache-2.0
def _await_model_version_creation(self, mv, await_creation_for): """ Does not wait for the model version to become READY as a successful creation will immediately place the model version in a READY state. """
Does not wait for the model version to become READY as a successful creation will immediately place the model version in a READY state.
_await_model_version_creation
python
mlflow/mlflow
mlflow/store/model_registry/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/file_store.py
Apache-2.0
def create_registered_model(self, name, tags=None, description=None, deployment_job_id=None): """ Create a new registered model in backend store. Args: name: Name of the new model. This is expected to be unique in the backend store. tags: A list of :py:class:`mlflow.enti...
Create a new registered model in backend store. Args: name: Name of the new model. This is expected to be unique in the backend store. tags: A list of :py:class:`mlflow.entities.model_registry.RegisteredModelTag` instances associated with this registered model. ...
create_registered_model
python
mlflow/mlflow
mlflow/store/model_registry/rest_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/rest_store.py
Apache-2.0
def search_registered_models( self, filter_string=None, max_results=None, order_by=None, page_token=None ): """ Search for registered models in backend that satisfy the filter criteria. Args: filter_string: Filter query string, defaults to searching all registered models...
Search for registered models in backend that satisfy the filter criteria. Args: filter_string: Filter query string, defaults to searching all registered models. max_results: Maximum number of registered models desired. order_by: List of column names with ASC|DESC an...
search_registered_models
python
mlflow/mlflow
mlflow/store/model_registry/rest_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/rest_store.py
Apache-2.0
def __init__(self, db_uri): """ Create a database backed store. Args: db_uri: The SQLAlchemy database URI string to connect to the database. See the `SQLAlchemy docs <https://docs.sqlalchemy.org/en/latest/core/engines.html#database-urls>`_ ...
Create a database backed store. Args: db_uri: The SQLAlchemy database URI string to connect to the database. See the `SQLAlchemy docs <https://docs.sqlalchemy.org/en/latest/core/engines.html#database-urls>`_ for format specifications. MLflow ...
__init__
python
mlflow/mlflow
mlflow/store/model_registry/sqlalchemy_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/sqlalchemy_store.py
Apache-2.0
def _get_eager_registered_model_query_options(): """ A list of SQLAlchemy query options that can be used to eagerly load the following registered model attributes when fetching a registered model: ``registered_model_tags``. """ # Use a subquery load rather than a joined l...
A list of SQLAlchemy query options that can be used to eagerly load the following registered model attributes when fetching a registered model: ``registered_model_tags``.
_get_eager_registered_model_query_options
python
mlflow/mlflow
mlflow/store/model_registry/sqlalchemy_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/sqlalchemy_store.py
Apache-2.0
def _get_eager_model_version_query_options(): """ A list of SQLAlchemy query options that can be used to eagerly load the following model version attributes when fetching a model version: ``model_version_tags``. """ # Use a subquery load rather than a joined load in order...
A list of SQLAlchemy query options that can be used to eagerly load the following model version attributes when fetching a model version: ``model_version_tags``.
_get_eager_model_version_query_options
python
mlflow/mlflow
mlflow/store/model_registry/sqlalchemy_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/sqlalchemy_store.py
Apache-2.0
def create_registered_model(self, name, tags=None, description=None, deployment_job_id=None): """ Create a new registered model in backend store. Args: name: Name of the new model. This is expected to be unique in the backend store. tags: A list of :py:class:`mlflow.enti...
Create a new registered model in backend store. Args: name: Name of the new model. This is expected to be unique in the backend store. tags: A list of :py:class:`mlflow.entities.model_registry.RegisteredModelTag` instances associated with this registered model. ...
create_registered_model
python
mlflow/mlflow
mlflow/store/model_registry/sqlalchemy_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/sqlalchemy_store.py
Apache-2.0
def _get_registered_model(cls, session, name, eager=False): # noqa: D417 """ Args: eager: If ``True``, eagerly loads the registered model's tags. If ``False``, these attributes are not eagerly loaded and will be loaded when their corresponding object properti...
Args: eager: If ``True``, eagerly loads the registered model's tags. If ``False``, these attributes are not eagerly loaded and will be loaded when their corresponding object properties are accessed from the resulting ``SqlRegisteredModel`` object.
_get_registered_model
python
mlflow/mlflow
mlflow/store/model_registry/sqlalchemy_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/sqlalchemy_store.py
Apache-2.0
def _update_query_to_exclude_prompts( cls, query: Any, tag_filters: dict[str, list[Any]], dialect: str, main_db_model: Union[SqlModelVersion, SqlRegisteredModel], tag_db_model: Union[SqlModelVersionTag, SqlRegisteredModelTag], ): """ Update query to ex...
Update query to exclude all prompt rows and return only normal model or model versions. Prompts and normal models are distinguished by the `mlflow.prompt.is_prompt` tag. The search API should only return normal models by default. However, simply filtering rows using the tag like this d...
_update_query_to_exclude_prompts
python
mlflow/mlflow
mlflow/store/model_registry/sqlalchemy_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/sqlalchemy_store.py
Apache-2.0
def _parse_search_registered_models_order_by(cls, order_by_list): """Sorts a set of registered models based on their natural ordering and an overriding set of order_bys. Registered models are naturally ordered first by name ascending. """ clauses = [] observed_order_by_clauses = ...
Sorts a set of registered models based on their natural ordering and an overriding set of order_bys. Registered models are naturally ordered first by name ascending.
_parse_search_registered_models_order_by
python
mlflow/mlflow
mlflow/store/model_registry/sqlalchemy_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/sqlalchemy_store.py
Apache-2.0
def get_latest_versions(self, name, stages=None): """ Latest version models for each requested stage. If no ``stages`` argument is provided, returns the latest version for each stage. Args: name: Registered model name. stages: List of desired stages. If input lis...
Latest version models for each requested stage. If no ``stages`` argument is provided, returns the latest version for each stage. Args: name: Registered model name. stages: List of desired stages. If input list is None, return latest versions for each st...
get_latest_versions
python
mlflow/mlflow
mlflow/store/model_registry/sqlalchemy_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/sqlalchemy_store.py
Apache-2.0
def _get_sql_model_version(cls, session, name, version, eager=False): # noqa: D417 """ Args: eager: If ``True``, eagerly loads the model version's tags. If ``False``, these attributes are not eagerly loaded and will be loaded when their corresponding object p...
Args: eager: If ``True``, eagerly loads the model version's tags. If ``False``, these attributes are not eagerly loaded and will be loaded when their corresponding object properties are accessed from the resulting ``SqlModelVersion`` object.
_get_sql_model_version
python
mlflow/mlflow
mlflow/store/model_registry/sqlalchemy_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/sqlalchemy_store.py
Apache-2.0
def _get_sql_model_version_including_deleted(self, name, version): """ Private method to retrieve model versions including those that are internally deleted. Used in tests to verify redaction behavior on deletion. Args: name: Registered model name. version: Regis...
Private method to retrieve model versions including those that are internally deleted. Used in tests to verify redaction behavior on deletion. Args: name: Registered model name. version: Registered model version. Returns: A single :py:class:`mlflow....
_get_sql_model_version_including_deleted
python
mlflow/mlflow
mlflow/store/model_registry/sqlalchemy_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/sqlalchemy_store.py
Apache-2.0
def _parse_search_model_versions_order_by(cls, order_by_list): """Sorts a set of model versions based on their natural ordering and an overriding set of order_bys. Model versions are naturally ordered first by name ascending, then by version ascending. """ clauses = [] ob...
Sorts a set of model versions based on their natural ordering and an overriding set of order_bys. Model versions are naturally ordered first by name ascending, then by version ascending.
_parse_search_model_versions_order_by
python
mlflow/mlflow
mlflow/store/model_registry/sqlalchemy_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/model_registry/sqlalchemy_store.py
Apache-2.0
def create_experiment(self, name, artifact_location, tags): """ Create a new experiment. If an experiment with the given name already exists, throws exception. Args: name: Desired name for an experiment. artifact_location: Base location for artifacts in runs. May...
Create a new experiment. If an experiment with the given name already exists, throws exception. Args: name: Desired name for an experiment. artifact_location: Base location for artifacts in runs. May be None. tags: Experiment tags to set upon experiment crea...
create_experiment
python
mlflow/mlflow
mlflow/store/tracking/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/abstract_store.py
Apache-2.0
def get_experiment(self, experiment_id): """ Fetch the experiment by ID from the backend store. Args: experiment_id: String id for the experiment Returns: A single :py:class:`mlflow.entities.Experiment` object if it exists, otherwise raises an except...
Fetch the experiment by ID from the backend store. Args: experiment_id: String id for the experiment Returns: A single :py:class:`mlflow.entities.Experiment` object if it exists, otherwise raises an exception.
get_experiment
python
mlflow/mlflow
mlflow/store/tracking/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/abstract_store.py
Apache-2.0
def get_experiment_by_name(self, experiment_name): """ Fetch the experiment by name from the backend store. Args: experiment_name: Name of experiment Returns: A single :py:class:`mlflow.entities.Experiment` object if it exists. """
Fetch the experiment by name from the backend store. Args: experiment_name: Name of experiment Returns: A single :py:class:`mlflow.entities.Experiment` object if it exists.
get_experiment_by_name
python
mlflow/mlflow
mlflow/store/tracking/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/abstract_store.py
Apache-2.0
def delete_experiment(self, experiment_id): """ Delete the experiment from the backend store. Deleted experiments can be restored until permanently deleted. Args: experiment_id: String id for the experiment. """
Delete the experiment from the backend store. Deleted experiments can be restored until permanently deleted. Args: experiment_id: String id for the experiment.
delete_experiment
python
mlflow/mlflow
mlflow/store/tracking/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/abstract_store.py
Apache-2.0
def restore_experiment(self, experiment_id): """ Restore deleted experiment unless it is permanently deleted. Args: experiment_id: String id for the experiment. """
Restore deleted experiment unless it is permanently deleted. Args: experiment_id: String id for the experiment.
restore_experiment
python
mlflow/mlflow
mlflow/store/tracking/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/abstract_store.py
Apache-2.0
def rename_experiment(self, experiment_id, new_name): """ Update an experiment's name. The new name must be unique. Args: experiment_id: String id for the experiment. new_name: New name for the experiment. """
Update an experiment's name. The new name must be unique. Args: experiment_id: String id for the experiment. new_name: New name for the experiment.
rename_experiment
python
mlflow/mlflow
mlflow/store/tracking/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/abstract_store.py
Apache-2.0
def get_run(self, run_id): """ Fetch the run from backend store. The resulting :py:class:`Run <mlflow.entities.Run>` contains a collection of run metadata - :py:class:`RunInfo <mlflow.entities.RunInfo>`, as well as a collection of run parameters, tags, and metrics - :py:class:`Ru...
Fetch the run from backend store. The resulting :py:class:`Run <mlflow.entities.Run>` contains a collection of run metadata - :py:class:`RunInfo <mlflow.entities.RunInfo>`, as well as a collection of run parameters, tags, and metrics - :py:class:`RunData <mlflow.entities.RunData>`. In t...
get_run
python
mlflow/mlflow
mlflow/store/tracking/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/abstract_store.py
Apache-2.0
def update_run_info(self, run_id, run_status, end_time, run_name): """ Update the metadata of the specified run. Returns: mlflow.entities.RunInfo: Describing the updated run. """
Update the metadata of the specified run. Returns: mlflow.entities.RunInfo: Describing the updated run.
update_run_info
python
mlflow/mlflow
mlflow/store/tracking/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/abstract_store.py
Apache-2.0
def create_run(self, experiment_id, user_id, start_time, tags, run_name): """ Create a run under the specified experiment ID, setting the run's status to "RUNNING" and the start time to the current time. Args: experiment_id: String id of the experiment for this run. ...
Create a run under the specified experiment ID, setting the run's status to "RUNNING" and the start time to the current time. Args: experiment_id: String id of the experiment for this run. user_id: ID of the user launching this run. start_time: Start time of...
create_run
python
mlflow/mlflow
mlflow/store/tracking/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/abstract_store.py
Apache-2.0
def delete_run(self, run_id): """ Delete a run. Args: run_id: The ID of the run to delete. """
Delete a run. Args: run_id: The ID of the run to delete.
delete_run
python
mlflow/mlflow
mlflow/store/tracking/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/abstract_store.py
Apache-2.0
def restore_run(self, run_id): """ Restore a run. Args: run_id: The ID of the run to restore. """
Restore a run. Args: run_id: The ID of the run to restore.
restore_run
python
mlflow/mlflow
mlflow/store/tracking/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/abstract_store.py
Apache-2.0
def start_trace( self, experiment_id: str, timestamp_ms: int, request_metadata: dict[str, str], tags: dict[str, str], ) -> TraceInfoV2: """ Start an initial TraceInfo object in the backend store. Args: experiment_id: String id of the exper...
Start an initial TraceInfo object in the backend store. Args: experiment_id: String id of the experiment for this run. timestamp_ms: Start time of the trace, in milliseconds since the UNIX epoch. request_metadata: Metadata of the trace. tags: Tags of the...
start_trace
python
mlflow/mlflow
mlflow/store/tracking/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/abstract_store.py
Apache-2.0
def end_trace( self, request_id: str, timestamp_ms: int, status: TraceStatus, request_metadata: dict[str, str], tags: dict[str, str], ) -> TraceInfoV2: """ Update the TraceInfo object in the backend store with the completed trace info. Args: ...
Update the TraceInfo object in the backend store with the completed trace info. Args: request_id : Unique string identifier of the trace. timestamp_ms: End time of the trace, in milliseconds. The execution time field in the TraceInfo will be calculated by subtra...
end_trace
python
mlflow/mlflow
mlflow/store/tracking/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/abstract_store.py
Apache-2.0
def delete_traces( self, experiment_id: str, max_timestamp_millis: Optional[int] = None, max_traces: Optional[int] = None, request_ids: Optional[list[str]] = None, ) -> int: """ Delete traces based on the specified criteria. - Either `max_timestamp_mi...
Delete traces based on the specified criteria. - Either `max_timestamp_millis` or `request_ids` must be specified, but not both. - `max_traces` can't be specified if `request_ids` is specified. Args: experiment_id: ID of the associated experiment. max_timestamp...
delete_traces
python
mlflow/mlflow
mlflow/store/tracking/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/abstract_store.py
Apache-2.0
def search_traces( self, experiment_ids: list[str], filter_string: Optional[str] = None, max_results: int = SEARCH_TRACES_DEFAULT_MAX_RESULTS, order_by: Optional[list[str]] = None, page_token: Optional[str] = None, model_id: Optional[str] = None, sql_wareh...
Return traces that match the given list of search expressions within the experiments. Args: experiment_ids: List of experiment ids to scope the search. filter_string: A search filter string. max_results: Maximum number of traces desired. order_by: List o...
search_traces
python
mlflow/mlflow
mlflow/store/tracking/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/abstract_store.py
Apache-2.0
def set_experiment_tag(self, experiment_id, tag): """ Set a tag for the specified experiment Args: experiment_id: String id for the experiment. tag: :py:class:`mlflow.entities.ExperimentTag` instance to set. """
Set a tag for the specified experiment Args: experiment_id: String id for the experiment. tag: :py:class:`mlflow.entities.ExperimentTag` instance to set.
set_experiment_tag
python
mlflow/mlflow
mlflow/store/tracking/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/abstract_store.py
Apache-2.0
def get_metric_history(self, run_id, metric_key, max_results=None, page_token=None): """ Return a list of metric objects corresponding to all values logged for a given metric within a run. Args: run_id: Unique identifier for run. metric_key: Metric name within th...
Return a list of metric objects corresponding to all values logged for a given metric within a run. Args: run_id: Unique identifier for run. metric_key: Metric name within the run. max_results: Maximum number of metric history events (steps) to return per pa...
get_metric_history
python
mlflow/mlflow
mlflow/store/tracking/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/abstract_store.py
Apache-2.0
def get_metric_history_bulk_interval_from_steps(self, run_id, metric_key, steps, max_results): """ Return a list of metric objects corresponding to all values logged for a given metric within a run for the specified steps. Args: run_id: Unique identifier for run. ...
Return a list of metric objects corresponding to all values logged for a given metric within a run for the specified steps. Args: run_id: Unique identifier for run. metric_key: Metric name within the run. steps: List of steps for which to return metrics. ...
get_metric_history_bulk_interval_from_steps
python
mlflow/mlflow
mlflow/store/tracking/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/abstract_store.py
Apache-2.0
def search_runs( self, experiment_ids, filter_string, run_view_type, max_results=SEARCH_MAX_RESULTS_DEFAULT, order_by=None, page_token=None, ): """ Return runs that match the given list of search expressions within the experiments. Arg...
Return runs that match the given list of search expressions within the experiments. Args: experiment_ids: List of experiment ids to scope the search. filter_string: A search filter string. run_view_type: ACTIVE_ONLY, DELETED_ONLY, or ALL runs. max_result...
search_runs
python
mlflow/mlflow
mlflow/store/tracking/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/abstract_store.py
Apache-2.0
def _search_runs( self, experiment_ids, filter_string, run_view_type, max_results, order_by, page_token, ): """ Return runs that match the given list of search expressions within the experiments, as well as a pagination token (indicatin...
Return runs that match the given list of search expressions within the experiments, as well as a pagination token (indicating where the next page should start). Subclasses of ``AbstractStore`` should implement this method to support pagination instead of ``search_runs``. See ``...
_search_runs
python
mlflow/mlflow
mlflow/store/tracking/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/abstract_store.py
Apache-2.0
def log_batch(self, run_id, metrics, params, tags): """ Log multiple metrics, params, and tags for the specified run Args: run_id: String id for the run metrics: List of :py:class:`mlflow.entities.Metric` instances to log params: List of :py:class:`mlflow.ent...
Log multiple metrics, params, and tags for the specified run Args: run_id: String id for the run metrics: List of :py:class:`mlflow.entities.Metric` instances to log params: List of :py:class:`mlflow.entities.Param` instances to log tags: List of :py:cla...
log_batch
python
mlflow/mlflow
mlflow/store/tracking/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/abstract_store.py
Apache-2.0
def log_batch_async(self, run_id, metrics, params, tags) -> RunOperations: """ Log multiple metrics, params, and tags for the specified run in async fashion. This API does not offer immediate consistency of the data. When API returns, data is accepted but not persisted/processed by back ...
Log multiple metrics, params, and tags for the specified run in async fashion. This API does not offer immediate consistency of the data. When API returns, data is accepted but not persisted/processed by back end. Data would be processed in near real time fashion. Args: ...
log_batch_async
python
mlflow/mlflow
mlflow/store/tracking/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/abstract_store.py
Apache-2.0
def log_inputs( self, run_id: str, datasets: Optional[list[DatasetInput]] = None, models: Optional[list[LoggedModelInput]] = None, ): """ Log inputs, such as datasets, to the specified run. Args: run_id: String id for the run datasets:...
Log inputs, such as datasets, to the specified run. Args: run_id: String id for the run datasets: List of :py:class:`mlflow.entities.DatasetInput` instances to log as inputs to the run. models: List of :py:class:`mlflow.entities.LoggedModelInput` ins...
log_inputs
python
mlflow/mlflow
mlflow/store/tracking/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/abstract_store.py
Apache-2.0
def create_logged_model( self, experiment_id: str, name: Optional[str] = None, source_run_id: Optional[str] = None, tags: Optional[list[LoggedModelTag]] = None, params: Optional[list[LoggedModelParameter]] = None, model_type: Optional[str] = None, ) -> LoggedM...
Create a new logged model. Args: experiment_id: ID of the experiment to which the model belongs. name: Name of the model. If not specified, a random name will be generated. source_run_id: ID of the run that produced the model. tags: Tags to set on the mo...
create_logged_model
python
mlflow/mlflow
mlflow/store/tracking/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/abstract_store.py
Apache-2.0
def search_logged_models( self, experiment_ids: list[str], filter_string: Optional[str] = None, datasets: Optional[list[dict[str, Any]]] = None, max_results: Optional[int] = None, order_by: Optional[list[dict[str, Any]]] = None, page_token: Optional[str] = None, ...
Search for logged models that match the specified search criteria. Args: experiment_ids: List of experiment ids to scope the search. filter_string: A search filter string. datasets: List of dictionaries to specify datasets on which to apply metrics filters. ...
search_logged_models
python
mlflow/mlflow
mlflow/store/tracking/abstract_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/abstract_store.py
Apache-2.0
def __init__(self, root_directory=None, artifact_root_uri=None): """ Create a new FileStore with the given root directory and a given default artifact root URI. """ super().__init__() self.root_directory = local_file_uri_to_path(root_directory or _default_root_dir()) if n...
Create a new FileStore with the given root directory and a given default artifact root URI.
__init__
python
mlflow/mlflow
mlflow/store/tracking/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/file_store.py
Apache-2.0
def get_experiment(self, experiment_id): """ Fetch the experiment. Note: This API will search for active as well as deleted experiments. Args: experiment_id: Integer id for the experiment Returns: A single Experiment object if it exists, otherwise raises...
Fetch the experiment. Note: This API will search for active as well as deleted experiments. Args: experiment_id: Integer id for the experiment Returns: A single Experiment object if it exists, otherwise raises an Exception.
get_experiment
python
mlflow/mlflow
mlflow/store/tracking/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/file_store.py
Apache-2.0
def _get_deleted_runs(self, older_than=0): """ Get all deleted run ids. Args: older_than: get runs that is older than this variable in number of milliseconds. defaults to 0 ms to get all deleted runs. """ current_time = get_current_time_millis...
Get all deleted run ids. Args: older_than: get runs that is older than this variable in number of milliseconds. defaults to 0 ms to get all deleted runs.
_get_deleted_runs
python
mlflow/mlflow
mlflow/store/tracking/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/file_store.py
Apache-2.0
def _find_experiment_folder(self, run_path): """ Given a run path, return the parent directory for its experiment. """ parent = get_parent_dir(run_path) if os.path.basename(parent) == FileStore.TRASH_FOLDER_NAME: return get_parent_dir(parent) return parent
Given a run path, return the parent directory for its experiment.
_find_experiment_folder
python
mlflow/mlflow
mlflow/store/tracking/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/file_store.py
Apache-2.0
def create_run(self, experiment_id, user_id, start_time, tags, run_name): """ Creates a run with the specified attributes. """ experiment_id = FileStore.DEFAULT_EXPERIMENT_ID if experiment_id is None else experiment_id experiment = self.get_experiment(experiment_id) if ex...
Creates a run with the specified attributes.
create_run
python
mlflow/mlflow
mlflow/store/tracking/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/file_store.py
Apache-2.0
def get_run(self, run_id): """ Note: Will get both active and deleted runs. """ _validate_run_id(run_id) run_info = self._get_run_info(run_id) if run_info is None: raise MlflowException( f"Run '{run_id}' metadata is in invalid state.", ...
Note: Will get both active and deleted runs.
get_run
python
mlflow/mlflow
mlflow/store/tracking/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/file_store.py
Apache-2.0
def get_metric_history(self, run_id, metric_key, max_results=None, page_token=None): """ Return all logged values for a given metric. Args: run_id: Unique identifier for run. metric_key: Metric name within the run. max_results: An indicator for paginated resu...
Return all logged values for a given metric. Args: run_id: Unique identifier for run. metric_key: Metric name within the run. max_results: An indicator for paginated results. This functionality is not implemented for FileStore and is unused in this s...
get_metric_history
python
mlflow/mlflow
mlflow/store/tracking/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/file_store.py
Apache-2.0
def _validate_new_param_value(self, param_path, param_key, run_id, new_value): """ When logging a parameter with a key that already exists, this function is used to enforce immutability by verifying that the specified parameter value matches the existing value. :raises: py:class:...
When logging a parameter with a key that already exists, this function is used to enforce immutability by verifying that the specified parameter value matches the existing value. :raises: py:class:`mlflow.exceptions.MlflowException` if the specified new parameter value ...
_validate_new_param_value
python
mlflow/mlflow
mlflow/store/tracking/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/file_store.py
Apache-2.0
def set_experiment_tag(self, experiment_id, tag): """ Set a tag for the specified experiment Args: experiment_id: String ID of the experiment tag: ExperimentRunTag instance to log """ _validate_tag_name(tag.key) experiment = self.get_experiment(ex...
Set a tag for the specified experiment Args: experiment_id: String ID of the experiment tag: ExperimentRunTag instance to log
set_experiment_tag
python
mlflow/mlflow
mlflow/store/tracking/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/file_store.py
Apache-2.0
def delete_tag(self, run_id, key): """ Delete a tag from a run. This is irreversible. Args: run_id: String ID of the run. key: Name of the tag. """ _validate_run_id(run_id) run_info = self._get_run_info(run_id) check_run_is_active(run_info...
Delete a tag from a run. This is irreversible. Args: run_id: String ID of the run. key: Name of the tag.
delete_tag
python
mlflow/mlflow
mlflow/store/tracking/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/file_store.py
Apache-2.0
def log_inputs( self, run_id: str, datasets: Optional[list[DatasetInput]] = None, models: Optional[list[LoggedModelInput]] = None, ): """ Log inputs, such as datasets and models, to the specified run. Args: run_id: String id for the run ...
Log inputs, such as datasets and models, to the specified run. Args: run_id: String id for the run datasets: List of :py:class:`mlflow.entities.DatasetInput` instances to log as inputs to the run. models: List of :py:class:`mlflow.entities.LoggedMode...
log_inputs
python
mlflow/mlflow
mlflow/store/tracking/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/file_store.py
Apache-2.0
def log_outputs(self, run_id: str, models: list[LoggedModelOutput]): """ Log outputs, such as models, to the specified run. Args: run_id: String id for the run models: List of :py:class:`mlflow.entities.LoggedModelOutput` instances to log as outputs of th...
Log outputs, such as models, to the specified run. Args: run_id: String id for the run models: List of :py:class:`mlflow.entities.LoggedModelOutput` instances to log as outputs of the run. Returns: None.
log_outputs
python
mlflow/mlflow
mlflow/store/tracking/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/file_store.py
Apache-2.0
def _search_datasets(self, experiment_ids) -> list[_DatasetSummary]: """ Return all dataset summaries associated to the given experiments. Args: experiment_ids: List of experiment ids to scope the search Returns: A List of :py:class:`mlflow.entities.DatasetSumma...
Return all dataset summaries associated to the given experiments. Args: experiment_ids: List of experiment ids to scope the search Returns: A List of :py:class:`mlflow.entities.DatasetSummary` entities.
_search_datasets
python
mlflow/mlflow
mlflow/store/tracking/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/file_store.py
Apache-2.0
def _save_trace_info(self, trace_info: TraceInfoV2, trace_dir, overwrite=False): """ TraceInfo is saved into `traces` folder under the experiment, each trace is saved in the folder named by its request_id. `request_metadata` and `tags` folder store their key-value pairs such that each ...
TraceInfo is saved into `traces` folder under the experiment, each trace is saved in the folder named by its request_id. `request_metadata` and `tags` folder store their key-value pairs such that each key is the file name, and value is written as the string value. Detailed direc...
_save_trace_info
python
mlflow/mlflow
mlflow/store/tracking/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/file_store.py
Apache-2.0
def _convert_trace_info_to_dict(self, trace_info: TraceInfoV2): """ Convert trace info to a dictionary for persistence. Drop request_metadata and tags as they're saved into separate files. """ trace_info_dict = trace_info.to_dict() trace_info_dict.pop("request_metadata", ...
Convert trace info to a dictionary for persistence. Drop request_metadata and tags as they're saved into separate files.
_convert_trace_info_to_dict
python
mlflow/mlflow
mlflow/store/tracking/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/file_store.py
Apache-2.0
def get_trace_info(self, request_id: str, should_query_v3: bool = False) -> TraceInfoV2: """ Get the trace matching the `request_id`. Args: request_id: String id of the trace to fetch. should_query_v3: If True, the backend store will query the V3 API for the trace info. ...
Get the trace matching the `request_id`. Args: request_id: String id of the trace to fetch. should_query_v3: If True, the backend store will query the V3 API for the trace info. TODO: Remove this flag once the V3 API is the default in OSS. Returns: ...
get_trace_info
python
mlflow/mlflow
mlflow/store/tracking/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/file_store.py
Apache-2.0
def set_trace_tag(self, request_id: str, key: str, value: str): """ Set a tag on the trace with the given request_id. Args: request_id: The ID of the trace. key: The string key of the tag. value: The string value of the tag. """ trace_dir = se...
Set a tag on the trace with the given request_id. Args: request_id: The ID of the trace. key: The string key of the tag. value: The string value of the tag.
set_trace_tag
python
mlflow/mlflow
mlflow/store/tracking/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/file_store.py
Apache-2.0
def delete_trace_tag(self, request_id: str, key: str): """ Delete a tag on the trace with the given request_id. Args: request_id: The ID of the trace. key: The string key of the tag. """ _validate_tag_name(key) trace_dir = self._find_trace_dir(req...
Delete a tag on the trace with the given request_id. Args: request_id: The ID of the trace. key: The string key of the tag.
delete_trace_tag
python
mlflow/mlflow
mlflow/store/tracking/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/file_store.py
Apache-2.0
def search_traces( self, experiment_ids: list[str], filter_string: Optional[str] = None, max_results: int = SEARCH_TRACES_DEFAULT_MAX_RESULTS, order_by: Optional[list[str]] = None, page_token: Optional[str] = None, model_id: Optional[str] = None, sql_wareh...
Return traces that match the given list of search expressions within the experiments. Args: experiment_ids: List of experiment ids to scope the search. filter_string: A search filter string. Supported filter keys are `name`, `status`, `timestamp_ms` a...
search_traces
python
mlflow/mlflow
mlflow/store/tracking/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/file_store.py
Apache-2.0
def log_logged_model_params(self, model_id: str, params: list[LoggedModelParameter]): """ Set parameters on the specified logged model. Args: model_id: ID of the model. params: Parameters to set on the model. Returns: None """ for par...
Set parameters on the specified logged model. Args: model_id: ID of the model. params: Parameters to set on the model. Returns: None
log_logged_model_params
python
mlflow/mlflow
mlflow/store/tracking/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/file_store.py
Apache-2.0
def finalize_logged_model(self, model_id: str, status: LoggedModelStatus) -> LoggedModel: """ Finalize a model by updating its status. Args: model_id: ID of the model to finalize. status: Final status to set on the model. Returns: The updated model. ...
Finalize a model by updating its status. Args: model_id: ID of the model to finalize. status: Final status to set on the model. Returns: The updated model.
finalize_logged_model
python
mlflow/mlflow
mlflow/store/tracking/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/file_store.py
Apache-2.0
def set_logged_model_tags(self, model_id: str, tags: list[LoggedModelTag]) -> None: """ Set tags on the specified logged model. Args: model_id: ID of the model. tags: Tags to set on the model. Returns: None """ model = self.get_logged...
Set tags on the specified logged model. Args: model_id: ID of the model. tags: Tags to set on the model. Returns: None
set_logged_model_tags
python
mlflow/mlflow
mlflow/store/tracking/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/file_store.py
Apache-2.0
def delete_logged_model_tag(self, model_id: str, key: str) -> None: """ Delete a tag on the specified logged model. Args: model_id: ID of the model. key: The string key of the tag. Returns: None """ _validate_tag_name(key) mod...
Delete a tag on the specified logged model. Args: model_id: ID of the model. key: The string key of the tag. Returns: None
delete_logged_model_tag
python
mlflow/mlflow
mlflow/store/tracking/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/file_store.py
Apache-2.0
def search_logged_models( self, experiment_ids: list[str], filter_string: Optional[str] = None, datasets: Optional[list[str]] = None, max_results: Optional[int] = None, order_by: Optional[list[dict[str, Any]]] = None, page_token: Optional[str] = None, ) -> Pag...
Search for logged models that match the specified search criteria. Args: experiment_ids: List of experiment ids to scope the search. filter_string: A search filter string. datasets: List of dictionaries to specify datasets on which to apply metrics filters. ...
search_logged_models
python
mlflow/mlflow
mlflow/store/tracking/file_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/file_store.py
Apache-2.0
def create_experiment(self, name, artifact_location=None, tags=None): """ Create a new experiment. If an experiment with the given name already exists, throws exception. Args: name: Desired name for an experiment. artifact_location: Location to store run artifact...
Create a new experiment. If an experiment with the given name already exists, throws exception. Args: name: Desired name for an experiment. artifact_location: Location to store run artifacts. tags: A list of :py:class:`mlflow.entities.ExperimentTag` instance...
create_experiment
python
mlflow/mlflow
mlflow/store/tracking/rest_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/rest_store.py
Apache-2.0
def get_experiment(self, experiment_id): """ Fetch the experiment from the backend store. Args: experiment_id: String id for the experiment Returns: A single :py:class:`mlflow.entities.Experiment` object if it exists, otherwise raises an Exception. ...
Fetch the experiment from the backend store. Args: experiment_id: String id for the experiment Returns: A single :py:class:`mlflow.entities.Experiment` object if it exists, otherwise raises an Exception.
get_experiment
python
mlflow/mlflow
mlflow/store/tracking/rest_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/rest_store.py
Apache-2.0
def get_run(self, run_id): """ Fetch the run from backend store Args: run_id: Unique identifier for the run Returns: A single Run object if it exists, otherwise raises an Exception """ req_body = message_to_json(GetRun(run_uuid=run_id, run_id=run...
Fetch the run from backend store Args: run_id: Unique identifier for the run Returns: A single Run object if it exists, otherwise raises an Exception
get_run
python
mlflow/mlflow
mlflow/store/tracking/rest_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/rest_store.py
Apache-2.0
def update_run_info(self, run_id, run_status, end_time, run_name): """Updates the metadata of the specified run.""" req_body = message_to_json( UpdateRun( run_uuid=run_id, run_id=run_id, status=run_status, end_time=end_time, ...
Updates the metadata of the specified run.
update_run_info
python
mlflow/mlflow
mlflow/store/tracking/rest_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/rest_store.py
Apache-2.0
def create_run(self, experiment_id, user_id, start_time, tags, run_name): """ Create a run under the specified experiment ID, setting the run's status to "RUNNING" and the start time to the current time. Args: experiment_id: ID of the experiment for this run. use...
Create a run under the specified experiment ID, setting the run's status to "RUNNING" and the start time to the current time. Args: experiment_id: ID of the experiment for this run. user_id: ID of the user launching this run. start_time: timestamp of the ini...
create_run
python
mlflow/mlflow
mlflow/store/tracking/rest_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/rest_store.py
Apache-2.0
def start_trace_v3(self, trace: Trace) -> TraceInfo: """ Start a trace using the V3 API format. NB: This method is named "Start" for internal reason in the backend, but actually should be called at the end of the trace. We will migrate this to "CreateTrace" API in the future to ...
Start a trace using the V3 API format. NB: This method is named "Start" for internal reason in the backend, but actually should be called at the end of the trace. We will migrate this to "CreateTrace" API in the future to avoid confusion. Args: trace: The Trace obj...
start_trace_v3
python
mlflow/mlflow
mlflow/store/tracking/rest_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/rest_store.py
Apache-2.0
def end_trace( self, request_id: str, timestamp_ms: int, status: TraceStatus, request_metadata: dict[str, str], tags: dict[str, str], ) -> TraceInfoV2: """ Update the TraceInfo object in the backend store with the completed trace info. Args: ...
Update the TraceInfo object in the backend store with the completed trace info. Args: request_id: Unique string identifier of the trace. timestamp_ms: End time of the trace, in milliseconds. The execution time field in the TraceInfo will be calculated by subtrac...
end_trace
python
mlflow/mlflow
mlflow/store/tracking/rest_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/rest_store.py
Apache-2.0
def _is_databricks_tracking_uri(self): """ Check if the tracking URI associated with this store is a Databricks URI. """ from mlflow.tracking._tracking_service.utils import get_tracking_uri from mlflow.utils.uri import is_databricks_uri try: tracking_uri = ge...
Check if the tracking URI associated with this store is a Databricks URI.
_is_databricks_tracking_uri
python
mlflow/mlflow
mlflow/store/tracking/rest_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/rest_store.py
Apache-2.0
def get_assessment(self, trace_id: str, assessment_id: str) -> Assessment: """ Get an assessment entity from the backend store. """ is_databricks = self._is_databricks_tracking_uri() req_body = message_to_json( GetAssessmentRequest(trace_id=trace_id, assessment_id=ass...
Get an assessment entity from the backend store.
get_assessment
python
mlflow/mlflow
mlflow/store/tracking/rest_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/rest_store.py
Apache-2.0
def create_assessment(self, assessment: Assessment) -> Assessment: """ Create an assessment entity in the backend store. Args: assessment: The assessment to log (without an assessment_id). Returns: The created Assessment object. """ is_databricks...
Create an assessment entity in the backend store. Args: assessment: The assessment to log (without an assessment_id). Returns: The created Assessment object.
create_assessment
python
mlflow/mlflow
mlflow/store/tracking/rest_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/rest_store.py
Apache-2.0
def update_assessment( self, trace_id: str, assessment_id: str, name: Optional[str] = None, expectation: Optional[Expectation] = None, feedback: Optional[Feedback] = None, rationale: Optional[str] = None, metadata: Optional[dict[str, str]] = None, ) ->...
Update an existing assessment entity in the backend store. Args: trace_id: The ID of the trace. assessment_id: The ID of the assessment to update. name: The updated name of the assessment. expectation: The updated expectation value of the assessment. ...
update_assessment
python
mlflow/mlflow
mlflow/store/tracking/rest_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/rest_store.py
Apache-2.0
def delete_assessment(self, trace_id: str, assessment_id: str): """ Delete an assessment associated with a trace. Args: trace_id: String ID of the trace. assessment_id: String ID of the assessment to delete. """ is_databricks = self._is_databricks_trackin...
Delete an assessment associated with a trace. Args: trace_id: String ID of the trace. assessment_id: String ID of the assessment to delete.
delete_assessment
python
mlflow/mlflow
mlflow/store/tracking/rest_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/rest_store.py
Apache-2.0
def log_metric(self, run_id: str, metric: Metric): """ Log a metric for the specified run Args: run_id: String id for the run metric: Metric instance to log """ req_body = message_to_json( LogMetric( run_uuid=run_id, ...
Log a metric for the specified run Args: run_id: String id for the run metric: Metric instance to log
log_metric
python
mlflow/mlflow
mlflow/store/tracking/rest_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/rest_store.py
Apache-2.0
def log_param(self, run_id, param): """ Log a param for the specified run Args: run_id: String id for the run param: Param instance to log """ req_body = message_to_json( LogParam(run_uuid=run_id, run_id=run_id, key=param.key, value=param.valu...
Log a param for the specified run Args: run_id: String id for the run param: Param instance to log
log_param
python
mlflow/mlflow
mlflow/store/tracking/rest_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/rest_store.py
Apache-2.0
def set_tag(self, run_id, tag): """ Set a tag for the specified run Args: run_id: String ID of the run tag: RunTag instance to log """ req_body = message_to_json( SetTag(run_uuid=run_id, run_id=run_id, key=tag.key, value=tag.value) ) ...
Set a tag for the specified run Args: run_id: String ID of the run tag: RunTag instance to log
set_tag
python
mlflow/mlflow
mlflow/store/tracking/rest_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/rest_store.py
Apache-2.0
def get_metric_history(self, run_id, metric_key, max_results=None, page_token=None): """ Return all logged values for a given metric. Args: run_id: Unique identifier for run. metric_key: Metric name within the run. max_results: Maximum number of metric histor...
Return all logged values for a given metric. Args: run_id: Unique identifier for run. metric_key: Metric name within the run. max_results: Maximum number of metric history events (steps) to return per paged query. Only supported in 'databricks' backe...
get_metric_history
python
mlflow/mlflow
mlflow/store/tracking/rest_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/rest_store.py
Apache-2.0
def log_logged_model_params(self, model_id: str, params: list[LoggedModelParameter]) -> None: """ Log parameters for a logged model in batches of 100. Args: model_id: ID of the model to log parameters for. params: List of parameters to log. Returns: ...
Log parameters for a logged model in batches of 100. Args: model_id: ID of the model to log parameters for. params: List of parameters to log. Returns: None
log_logged_model_params
python
mlflow/mlflow
mlflow/store/tracking/rest_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/rest_store.py
Apache-2.0
def get_logged_model(self, model_id: str) -> LoggedModel: """ Fetch the logged model with the specified ID. Args: model_id: ID of the model to fetch. Returns: The fetched model. """ endpoint = get_logged_model_endpoint(model_id) response_...
Fetch the logged model with the specified ID. Args: model_id: ID of the model to fetch. Returns: The fetched model.
get_logged_model
python
mlflow/mlflow
mlflow/store/tracking/rest_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/rest_store.py
Apache-2.0
def log_inputs( self, run_id: str, datasets: Optional[list[DatasetInput]] = None, models: Optional[list[LoggedModelInput]] = None, ): """ Log inputs, such as datasets, to the specified run. Args: run_id: String id for the run datasets:...
Log inputs, such as datasets, to the specified run. Args: run_id: String id for the run datasets: List of :py:class:`mlflow.entities.DatasetInput` instances to log as inputs to the run. models: List of :py:class:`mlflow.entities.LoggedModelInput` ins...
log_inputs
python
mlflow/mlflow
mlflow/store/tracking/rest_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/rest_store.py
Apache-2.0
def _create_default_experiment(self, session): """ MLflow UI and client code expects a default experiment with ID 0. This method uses SQL insert statement to create the default experiment as a hack, since experiment table uses 'experiment_id' column is a PK and is also set to auto increm...
MLflow UI and client code expects a default experiment with ID 0. This method uses SQL insert statement to create the default experiment as a hack, since experiment table uses 'experiment_id' column is a PK and is also set to auto increment. MySQL and other implementation do not allow v...
_create_default_experiment
python
mlflow/mlflow
mlflow/store/tracking/sqlalchemy_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/sqlalchemy_store.py
Apache-2.0
def _get_experiment(self, session, experiment_id, view_type, eager=False): # noqa: D417 """ Args: eager: If ``True``, eagerly loads the experiments's tags. If ``False``, these tags are not eagerly loaded and will be loaded if/when their corresponding object p...
Args: eager: If ``True``, eagerly loads the experiments's tags. If ``False``, these tags are not eagerly loaded and will be loaded if/when their corresponding object properties are accessed from the resulting ``SqlExperiment`` object.
_get_experiment
python
mlflow/mlflow
mlflow/store/tracking/sqlalchemy_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/sqlalchemy_store.py
Apache-2.0
def _get_eager_experiment_query_options(): """ A list of SQLAlchemy query options that can be used to eagerly load the following experiment attributes when fetching an experiment: ``tags``. """ return [ # Use a subquery load rather than a joined load in order to minim...
A list of SQLAlchemy query options that can be used to eagerly load the following experiment attributes when fetching an experiment: ``tags``.
_get_eager_experiment_query_options
python
mlflow/mlflow
mlflow/store/tracking/sqlalchemy_store.py
https://github.com/mlflow/mlflow/blob/master/mlflow/store/tracking/sqlalchemy_store.py
Apache-2.0