repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
mlflow | mlflow/langchain/utils/chat.py | .py | import json
import logging
import time
from collections import defaultdict
from collections.abc import Iterator
from typing import Any
import pydantic
from langchain_core.messages import (
AIMessage,
BaseMessage,
FunctionMessage,
HumanMessage,
SystemMessage,
ToolMessage,
)
from langchain_core.m... | 510 | 18,554 |
mlflow | mlflow/langchain/utils/serialization.py | .py | import inspect
from pydantic import BaseModel
def convert_to_serializable(response):
"""
Convert the response to a JSON serializable format.
LangChain response objects often contains Pydantic objects, which causes an serialization
error when the model is served behind REST endpoint.
"""
# La... | 27 | 879 |
mlflow | mlflow/store/workspace_rest_store_mixin.py | .py | from __future__ import annotations
from mlflow.exceptions import MlflowException
from mlflow.protos import databricks_pb2
from mlflow.utils.server_info import (
SERVER_INFO_ENDPOINT,
SERVER_INFO_WORKSPACES_ENABLED,
ServerInfoRequestError,
fetch_server_info,
)
from mlflow.utils.uri import is_databricks_... | 82 | 2,880 |
mlflow | mlflow/store/__init__.py | .py | from mlflow.store import _unity_catalog # noqa: F401
from mlflow.store.artifact import artifact_repo
from mlflow.store.tracking import abstract_store
__all__ = [
# tracking server meta-data stores
"abstract_store",
# artifact repository stores
"artifact_repo",
]
| 11 | 281 |
mlflow | mlflow/store/workspace_aware_mixin.py | .py | """
Mixin class providing common workspace functionality for stores.
"""
from __future__ import annotations
from mlflow.environment_variables import MLFLOW_ENABLE_WORKSPACES
from mlflow.exceptions import MlflowException
from mlflow.utils.workspace_context import get_request_workspace
from mlflow.utils.workspace_utils... | 64 | 2,174 |
mlflow | mlflow/store/_unity_catalog/registry/uc_native_rest_store.py | .py | """Unity Catalog model-registry store that talks to the native /api/2.1/unity-catalog/* surface.
``UcNativeModelRegistryStore`` subclasses :class:`UcModelRegistryStore` and overrides the
model-registry operations that have a native Unity Catalog equivalent so they issue requests
against the native ``UnityCatalogServic... | 668 | 28,709 |
mlflow | mlflow/store/_unity_catalog/registry/uc_oss_rest_store.py | .py | import functools
import os
import shutil
from contextlib import contextmanager
import mlflow
from mlflow.exceptions import MlflowException
from mlflow.protos.unity_catalog_messages_pb2 import (
READ_WRITE_MODEL_VERSION,
CreateModelVersion,
CreateRegisteredModel,
DeleteModelVersion,
DeleteRegistered... | 505 | 20,110 |
mlflow | mlflow/store/_unity_catalog/registry/prompt_info.py | .py | """
Internal PromptInfo entity for Unity Catalog prompt operations.
This is an implementation detail for the Unity Catalog store and should not be
considered part of the public MLflow API.
"""
class PromptInfo:
"""
Internal entity for prompt information from Unity Catalog. This represents
prompt metadata... | 74 | 2,198 |
mlflow | mlflow/store/_unity_catalog/registry/utils.py | .py | """
Utility functions for converting between Unity Catalog proto and MLflow entities.
"""
import json
from mlflow.entities.model_registry.prompt import Prompt
from mlflow.entities.model_registry.prompt_version import PromptVersion
from mlflow.prompt.constants import PROMPT_MODEL_CONFIG_TAG_KEY, RESPONSE_FORMAT_TAG_KE... | 159 | 5,557 |
mlflow | mlflow/store/_unity_catalog/registry/rest_store.py | .py | import base64
import functools
import json
import logging
import os
import re
import shutil
from contextlib import contextmanager
from dataclasses import dataclass
from typing import Any
import google.protobuf.empty_pb2
from pydantic import BaseModel
import mlflow
from mlflow.entities import Run
from mlflow.entities.... | 1,903 | 78,511 |
mlflow | mlflow/store/_unity_catalog/registry/__init__.py | .py | from mlflow.store._unity_catalog.registry import (
rest_store as rest_store,
)
from mlflow.store._unity_catalog.registry import (
uc_oss_rest_store as uc_oss_rest_store,
)
| 7 | 180 |
mlflow | mlflow/store/_unity_catalog/lineage/constants.py | .py | _DATABRICKS_ORG_ID_HEADER = "x-databricks-org-id"
_DATABRICKS_LINEAGE_ID_HEADER = "X-Databricks-Lineage-Identifier"
| 3 | 116 |
mlflow | mlflow/store/workspace/utils.py | .py | from __future__ import annotations
import logging
from mlflow.entities import Workspace
from mlflow.protos import databricks_pb2
_INVALID_PARAMETER_VALUE_CODE = databricks_pb2.INVALID_PARAMETER_VALUE
_INVALID_PARAMETER_VALUE_NAME = databricks_pb2.ErrorCode.Name(_INVALID_PARAMETER_VALUE_CODE)
_logger = logging.getL... | 44 | 1,340 |
mlflow | mlflow/store/workspace/sqlalchemy_store.py | .py | from __future__ import annotations
import logging
from threading import Lock
from typing import Iterable
from cachetools import TTLCache
from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm import sessionmaker
from mlflow.entities.workspace import TraceArchivalConfig, Workspace, WorkspaceDeletionMode
from m... | 373 | 16,288 |
mlflow | mlflow/store/workspace/rest_store.py | .py | from __future__ import annotations
from urllib.parse import quote
from mlflow.entities import Workspace
from mlflow.entities.workspace import WorkspaceDeletionMode
from mlflow.exceptions import MlflowException, RestException
from mlflow.protos import databricks_pb2
from mlflow.protos.databricks_pb2 import INVALID_STA... | 135 | 5,618 |
mlflow | mlflow/store/workspace/__init__.py | .py | """Public workspace store facade and re-exports."""
from mlflow.entities.workspace import Workspace
from mlflow.store.workspace.abstract_store import AbstractStore
from mlflow.store.workspace.rest_store import RestWorkspaceStore
__all__ = [
"Workspace",
"AbstractStore",
"RestWorkspaceStore",
]
| 12 | 309 |
mlflow | mlflow/store/workspace/abstract_store.py | .py | from __future__ import annotations
import re
from abc import ABC, abstractmethod
from dataclasses import dataclass
from typing import Iterable
from mlflow.entities import Workspace
from mlflow.entities.workspace import TraceArchivalConfig, WorkspaceDeletionMode
from mlflow.exceptions import MlflowException
@datacla... | 181 | 6,732 |
mlflow | mlflow/store/workspace/dbmodels/models.py | .py | from __future__ import annotations
import sqlalchemy as sa
from sqlalchemy import Column, String, Text
from mlflow.entities.workspace import Workspace
from mlflow.store.db.base_sql_model import Base
class SqlWorkspace(Base):
__tablename__ = "workspaces"
# Workspace-aware tables intentionally do not declare... | 37 | 1,402 |
mlflow | mlflow/store/workspace/dbmodels/__init__.py | .py | from mlflow.store.workspace.dbmodels.models import SqlWorkspace
__all__ = ["SqlWorkspace"]
| 4 | 92 |
mlflow | mlflow/store/entities/paged_list.py | .py | from typing import TypeVar
T = TypeVar("T")
class PagedList(list[T]):
"""
Wrapper class around the base Python `List` type. Contains an additional `token` string
attribute that can be passed to the pagination API that returned this list to fetch additional
elements, if any are available
"""
... | 19 | 473 |
mlflow | mlflow/store/entities/__init__.py | .py | from mlflow.store.entities.paged_list import PagedList
__all__ = ["PagedList"]
| 4 | 80 |
mlflow | mlflow/store/fs2db/_utils.py | .py | import logging
from collections.abc import Iterator
from dataclasses import dataclass, fields
from pathlib import Path
from typing import Any
import yaml
from mlflow.store.tracking.file_store import FileStore
_logger = logging.getLogger(__name__)
@dataclass
class MigrationStats:
experiments: int = 0
experi... | 136 | 4,051 |
mlflow | mlflow/store/fs2db/_tracking.py | .py | """
Migrate tracking store entities from FileStore to DB.
FileStore layout:
<mlruns>/
├── <experiment_id>/
│ ├── meta.yaml -> experiments
│ ├── tags/<key> -> experiment_tags
│ ├── <run_uuid>/
│ │ ├── meta.yaml -> runs
│ │ ├─... | 712 | 24,290 |
mlflow | mlflow/store/fs2db/__init__.py | .py | # ruff: noqa: T201
import warnings
from functools import partial
from pathlib import Path
from mlflow.exceptions import MlflowException
def _log(progress: bool, msg: str) -> None:
if progress:
print(msg)
def _resolve_mlruns(source: Path) -> Path:
mlruns = source / "mlruns"
if mlruns.is_dir():
... | 166 | 6,220 |
mlflow | mlflow/store/fs2db/cli.py | .py | from pathlib import Path
import click
from mlflow.store.fs2db import migrate
from mlflow.utils.uri import get_uri_scheme
@click.command("migrate-filestore")
@click.option(
"--source",
required=True,
type=click.Path(exists=True, file_okay=False, resolve_path=True),
help="Root directory containing mlr... | 46 | 1,383 |
mlflow | mlflow/store/fs2db/_registry.py | .py | """
Migrate model registry entities from FileStore to DB.
FileStore layout:
<mlruns>/models/
└── <model_name>/
├── meta.yaml -> registered_models
├── tags/<key> -> registered_model_tags
├── aliases/<alias_name> -> registered_model_aliases
└── version-... | 135 | 4,228 |
mlflow | mlflow/store/tracking/databricks_rest_store.py | .py | import base64
import logging
import time
from collections import defaultdict
from datetime import datetime
from typing import Any
from urllib.parse import quote, urlencode
from opentelemetry.proto.collector.trace.v1.trace_service_pb2 import ExportTraceServiceRequest
from pydantic import BaseModel
from mlflow.entities... | 1,230 | 48,287 |
mlflow | mlflow/store/tracking/sqlalchemy_store.py | .py | from __future__ import annotations
import base64
import hashlib
import json
import logging
import math
import random
import threading
import time
import uuid
from collections import defaultdict
from dataclasses import dataclass, field
from functools import lru_cache, reduce
from pathlib import PurePath
from typing imp... | 10,289 | 440,265 |
mlflow | mlflow/store/tracking/rest_store.py | .py | import functools
import json
import logging
from typing import TYPE_CHECKING, Any
from mlflow.entities.model_registry.prompt_version import PromptVersion
if TYPE_CHECKING:
from mlflow.entities import DatasetRecord, EvaluationDataset
from mlflow.genai.scorers.online.entities import OnlineScoringConfig
from op... | 2,495 | 93,489 |
mlflow | mlflow/store/tracking/__init__.py | .py | """
An MLflow tracking server has two properties related to how data is stored: *backend store* to
record ML experiments, runs, parameters, metrics, etc., and *artifact store* to store run
artifacts like models, plots, images, etc.
Several constants are used by multiple backend store implementations.
"""
# Path to de... | 31 | 1,521 |
mlflow | mlflow/store/tracking/_secret_cache.py | .py | """
Server-side encrypted cache for secrets management.
Implements time-bucketed ephemeral encryption for cached secrets to provide defense-in-depth
and satisfy CWE-316 (https://cwe.mitre.org/data/definitions/316.html).
Security Model and Limitations:
This cache protects against accidental exposure of secrets in log... | 291 | 11,589 |
mlflow | mlflow/store/tracking/abstract_store.py | .py | import bisect
import json
from abc import ABCMeta, abstractmethod
from typing import TYPE_CHECKING, Any, Literal
from mlflow.entities import (
Assessment,
DatasetInput,
DatasetRecord,
Issue,
IssueSeverity,
IssueStatus,
LoggedModel,
LoggedModelInput,
LoggedModelOutput,
LoggedMode... | 2,125 | 81,464 |
mlflow | mlflow/store/tracking/_sql_backend_utils.py | .py | from functools import wraps
from typing import Any, Callable, TypeVar, cast
from mlflow.exceptions import MlflowException
from mlflow.protos.databricks_pb2 import FEATURE_DISABLED
F = TypeVar("F", bound=Callable[..., Any])
def filestore_not_supported(func: F) -> F:
"""
Decorator for FileStore methods that a... | 34 | 1,163 |
mlflow | mlflow/store/tracking/sqlalchemy_workspace_store.py | .py | from __future__ import annotations
import logging
import sqlalchemy
import sqlalchemy.sql.expression as sql
from sqlalchemy.exc import IntegrityError
from sqlalchemy.future import select
from mlflow.entities import (
Experiment,
)
from mlflow.entities.entity_type import EntityAssociationType
from mlflow.entities... | 581 | 22,620 |
mlflow | mlflow/store/tracking/file_store.py | .py | from __future__ import annotations
import hashlib
import json
import logging
import os
import shutil
import sys
import time
import uuid
from collections import defaultdict
from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, NamedTuple, TypedDict
from mlflow.entities import (
Assessment,
D... | 2,917 | 121,333 |
mlflow | mlflow/store/tracking/mcp_server_registry/abstract_mixin.py | .py | from __future__ import annotations
from typing import Any, Literal, TypedDict
from typing_extensions import NotRequired
from mlflow.entities.mcp_access_endpoint import MCPAccessEndpoint
from mlflow.entities.mcp_server import MCPRemoteTransportType, MCPServer, MCPStatus, MCPTool
from mlflow.entities.mcp_server_versio... | 419 | 15,267 |
mlflow | mlflow/store/tracking/mcp_server_registry/sqlalchemy_mixin.py | .py | from __future__ import annotations
import re
import uuid
from dataclasses import asdict, replace
from typing import Any
import sqlalchemy as sa
from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm import contains_eager, subqueryload
from mlflow.entities.mcp_access_endpoint import MCPAccessEndpoint
from mlfl... | 1,567 | 65,089 |
mlflow | mlflow/store/tracking/mcp_server_registry/__init__.py | .py | from mlflow.store.tracking.mcp_server_registry.abstract_mixin import MCPServerRegistryMixin
__all__ = ["MCPServerRegistryMixin"]
| 4 | 130 |
mlflow | mlflow/store/tracking/mcp_server_registry/rest_mixin.py | .py | """REST implementation of MCPServerRegistryMixin."""
from __future__ import annotations
from dataclasses import asdict
from typing import Any
from urllib.parse import quote
from mlflow.entities.mcp_access_endpoint import MCPAccessEndpoint
from mlflow.entities.mcp_server import MCPRemoteTransportType, MCPServer, MCPS... | 380 | 15,393 |
mlflow | mlflow/store/tracking/dbmodels/models.py | .py | import json
import uuid
from typing import Any
import sqlalchemy as sa
from sqlalchemy import (
JSON,
BigInteger,
Boolean,
CheckConstraint,
Column,
Computed,
Float,
ForeignKey,
ForeignKeyConstraint,
Index,
Integer,
LargeBinary,
PrimaryKeyConstraint,
String,
T... | 4,308 | 148,159 |
mlflow | mlflow/store/tracking/dbmodels/initial_models.py | .py | # Snapshot of MLflow DB models as of the 0.9.1 release, prior to the first database migration.
# Used to standardize initial database state.
# Copied with modifications from
# https://github.com/mlflow/mlflow/blob/v0.9.1/mlflow/store/dbmodels/models.py, which
# is the first database schema that users could be running. ... | 244 | 8,248 |
mlflow | mlflow/store/tracking/utils/sql_trace_metrics_utils.py | .py | import json
from dataclasses import dataclass
from datetime import datetime, timezone
from sqlalchemy import Column, Float, and_, case, distinct, exists, func, literal_column, true
from sqlalchemy.orm import aliased
from sqlalchemy.orm.query import Query
from mlflow.entities.entity_type import EntityAssociationType
f... | 906 | 38,213 |
mlflow | mlflow/store/tracking/utils/trace_archival.py | .py | from __future__ import annotations
import logging
from dataclasses import dataclass
from enum import Enum
from mlflow.entities import TraceInfo
from mlflow.exceptions import MlflowException
from mlflow.tracing.constant import TraceExperimentTagKey
from mlflow.utils.validation import (
_parse_trace_archival_durati... | 179 | 5,142 |
mlflow | mlflow/store/tracking/gateway/abstract_mixin.py | .py | from typing import Any
from mlflow.entities import (
FallbackConfig,
GatewayEndpoint,
GatewayEndpointBinding,
GatewayEndpointModelConfig,
GatewayEndpointModelMapping,
GatewayEndpointTag,
GatewayModelDefinition,
GatewaySecretInfo,
RoutingStrategy,
)
from mlflow.entities.gateway_budge... | 692 | 23,815 |
mlflow | mlflow/store/tracking/gateway/sqlalchemy_mixin.py | .py | from __future__ import annotations
import json
import os
import uuid
from typing import Any
from sqlalchemy import case, func
from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm import joinedload
from mlflow.entities import (
FallbackConfig,
GatewayEndpoint,
GatewayEndpointBinding,
GatewayE... | 1,611 | 63,685 |
mlflow | mlflow/store/tracking/gateway/__init__.py | .py | from mlflow.store.tracking.gateway.abstract_mixin import GatewayStoreMixin
__all__ = ["GatewayStoreMixin"]
| 4 | 108 |
mlflow | mlflow/store/tracking/gateway/config_resolver.py | .py | """
Server-side only configuration resolver for Gateway endpoints.
This module provides functions to retrieve decrypted endpoint configurations
for resources. These functions are privileged operations that should only be
called server-side and never exposed to clients via MlflowClient.
"""
import json
from mlflow.ex... | 255 | 9,707 |
mlflow | mlflow/store/tracking/gateway/entities.py | .py | from dataclasses import asdict, dataclass, field
from typing import Any
from mlflow.entities.gateway_endpoint import (
FallbackConfig,
FallbackStrategy,
GatewayModelLinkageType,
RoutingStrategy,
)
@dataclass
class GatewayModelConfig:
"""
Model configuration with decrypted credentials for runt... | 97 | 3,821 |
mlflow | mlflow/store/tracking/gateway/rest_mixin.py | .py | """REST Gateway Store Mixin - Gateway API implementation for REST-based tracking stores."""
from __future__ import annotations
from typing import Any
from mlflow.entities import (
GatewayEndpoint,
GatewayEndpointBinding,
GatewayEndpointModelConfig,
GatewayEndpointModelMapping,
GatewayEndpointTag,... | 818 | 31,112 |
mlflow | mlflow/store/artifact/presigned_url_artifact_repo.py | .py | import json
import os
import posixpath
from mlflow.entities import FileInfo
from mlflow.environment_variables import MLFLOW_MULTIPART_DOWNLOAD_CHUNK_SIZE
from mlflow.exceptions import RestException
from mlflow.protos.databricks_artifacts_pb2 import ArtifactCredentialInfo
from mlflow.protos.databricks_filesystem_servic... | 181 | 7,527 |
mlflow | mlflow/store/artifact/databricks_sdk_models_artifact_repo.py | .py | import logging
import posixpath
from mlflow.entities import FileInfo
from mlflow.environment_variables import (
MLFLOW_MULTIPART_DOWNLOAD_CHUNK_SIZE,
)
from mlflow.store.artifact.cloud_artifact_repo import CloudArtifactRepository
_logger = logging.getLogger(__name__)
def _get_databricks_workspace_client(registr... | 125 | 4,598 |
mlflow | mlflow/store/artifact/r2_artifact_repo.py | .py | from urllib.parse import urlparse
from mlflow.store.artifact.optimized_s3_artifact_repo import OptimizedS3ArtifactRepository
from mlflow.store.artifact.s3_artifact_repo import _get_s3_client
class R2ArtifactRepository(OptimizedS3ArtifactRepository):
"""Stores artifacts on Cloudflare R2."""
def __init__(
... | 74 | 2,836 |
mlflow | mlflow/store/artifact/http_artifact_repo.py | .py | import logging
import os
import posixpath
import time
from concurrent.futures import as_completed
import requests
from requests import HTTPError
from mlflow.entities import FileInfo
from mlflow.entities.multipart_upload import (
CreateMultipartUploadResponse,
MultipartUploadCredential,
MultipartUploadPart... | 388 | 16,141 |
mlflow | mlflow/store/artifact/azure_blob_artifact_repo.py | .py | import base64
import datetime
import os
import posixpath
import re
import urllib.parse
from datetime import timezone
from mlflow.entities import FileInfo
from mlflow.entities.multipart_upload import (
CreateMultipartUploadResponse,
MultipartUploadCredential,
)
from mlflow.environment_variables import MLFLOW_AR... | 297 | 13,214 |
mlflow | mlflow/store/artifact/mlflow_artifacts_repo.py | .py | import logging
import os
import re
import threading
from http import HTTPStatus
from urllib.parse import urlparse, urlunparse
from requests import HTTPError
from mlflow.environment_variables import (
MLFLOW_ENABLE_PROXY_MULTIPART_DOWNLOAD,
MLFLOW_ENABLE_PROXY_MULTIPART_UPLOAD,
MLFLOW_MULTIPART_DOWNLOAD_CH... | 230 | 9,673 |
mlflow | mlflow/store/artifact/gcs_artifact_repo.py | .py | import datetime
import os
import posixpath
import urllib.parse
from typing import Any, NamedTuple
from packaging.version import Version
from mlflow.entities import FileInfo
from mlflow.entities.multipart_upload import (
CreateMultipartUploadResponse,
MultipartUploadCredential,
)
from mlflow.environment_variab... | 308 | 12,372 |
mlflow | mlflow/store/artifact/unity_catalog_oss_models_artifact_repo.py | .py | import base64
from mlflow.exceptions import MlflowException
from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE
from mlflow.protos.unity_catalog_messages_pb2 import (
READ_MODEL_VERSION as MODEL_VERSION_OPERATION_READ_OSS,
)
from mlflow.protos.unity_catalog_messages_pb2 import (
GenerateTemporaryM... | 166 | 7,201 |
mlflow | mlflow/store/artifact/databricks_models_artifact_repo.py | .py | import json
import logging
import os
import posixpath
import mlflow.tracking
from mlflow.entities import FileInfo
from mlflow.environment_variables import (
MLFLOW_ENABLE_MULTIPART_DOWNLOAD,
MLFLOW_MULTIPART_DOWNLOAD_CHUNK_SIZE,
)
from mlflow.exceptions import MlflowException
from mlflow.protos.databricks_pb2 ... | 220 | 10,035 |
mlflow | mlflow/store/artifact/unity_catalog_models_artifact_repo.py | .py | import base64
from mlflow.environment_variables import MLFLOW_ENABLE_UC_NATIVE_MODEL_REGISTRY
from mlflow.exceptions import MlflowException
from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE
from mlflow.protos.databricks_uc_registry_messages_pb2 import (
MODEL_VERSION_OPERATION_READ,
GenerateTemp... | 217 | 10,065 |
mlflow | mlflow/store/artifact/ftp_artifact_repo.py | .py | import ftplib
import os
import posixpath
import urllib.parse
from contextlib import contextmanager
from ftplib import FTP
from urllib.parse import unquote
from mlflow.entities.file_info import FileInfo
from mlflow.exceptions import MlflowException
from mlflow.store.artifact.artifact_repo import ArtifactRepository
from... | 134 | 5,316 |
mlflow | mlflow/store/artifact/databricks_run_artifact_repo.py | .py | import re
from mlflow.store.artifact.databricks_tracking_artifact_repo import (
DatabricksTrackingArtifactRepository,
)
class DatabricksRunArtifactRepository(DatabricksTrackingArtifactRepository):
"""
Artifact repository for interacting with run artifacts in a Databricks workspace.
If operations usin... | 35 | 1,422 |
mlflow | mlflow/store/artifact/artifact_repo.py | .py | import json
import logging
import os
import posixpath
import re
import tempfile
import traceback
import uuid
from abc import ABC, ABCMeta, abstractmethod
from concurrent.futures import ThreadPoolExecutor, as_completed
from contextlib import contextmanager
from pathlib import Path
from typing import TYPE_CHECKING, Any, ... | 833 | 33,271 |
mlflow | mlflow/store/artifact/sftp_artifact_repo.py | .py | import os
import posixpath
import sys
import urllib.parse
from contextlib import contextmanager
from queue import Queue
from mlflow.entities import FileInfo
from mlflow.store.artifact.artifact_repo import ArtifactRepository
# Based on: https://stackoverflow.com/a/58466685
def _put_r_for_windows(sftp, local_dir, remo... | 143 | 5,538 |
mlflow | mlflow/store/artifact/artifact_repository_registry.py | .py | import warnings
from mlflow.exceptions import MlflowException
from mlflow.store.artifact.artifact_repo import ArtifactRepository
from mlflow.store.artifact.azure_blob_artifact_repo import AzureBlobArtifactRepository
from mlflow.store.artifact.azure_data_lake_artifact_repo import AzureDataLakeArtifactRepository
from ml... | 171 | 7,979 |
mlflow | mlflow/store/artifact/databricks_tracking_artifact_repo.py | .py | import logging
import re
from abc import ABC, abstractmethod
from pathlib import Path
from mlflow.entities import FileInfo
from mlflow.exceptions import MlflowException
from mlflow.store.artifact.artifact_repo import ArtifactRepository
from mlflow.store.artifact.databricks_artifact_repo import DatabricksArtifactReposi... | 112 | 5,096 |
mlflow | mlflow/store/artifact/b2_artifact_repo.py | .py | from urllib.parse import urlparse
from mlflow.store.artifact.optimized_s3_artifact_repo import OptimizedS3ArtifactRepository
from mlflow.store.artifact.s3_artifact_repo import _get_s3_client
_B2_USER_AGENT = "b2ai-mlflow"
def _add_b2_user_agent(request, **kwargs):
ua = request.headers.get("User-Agent", "")
... | 91 | 3,224 |
mlflow | mlflow/store/artifact/databricks_artifact_repo.py | .py | import base64
import json
import logging
import os
import posixpath
import tempfile
import uuid
from pathlib import Path
from typing import Any
import requests
import mlflow.tracking
from mlflow.azure.client import (
patch_adls_file_upload,
patch_adls_flush,
put_adls_file_creation,
put_block,
put_... | 938 | 39,084 |
mlflow | mlflow/store/artifact/azure_data_lake_artifact_repo.py | .py | import os
import posixpath
import re
import urllib.parse
import requests
from mlflow.azure.client import patch_adls_file_upload, patch_adls_flush, put_adls_file_creation
from mlflow.entities import FileInfo
from mlflow.environment_variables import (
MLFLOW_ARTIFACT_UPLOAD_DOWNLOAD_TIMEOUT,
MLFLOW_ENABLE_MULTI... | 300 | 12,543 |
mlflow | mlflow/store/artifact/models_artifact_repo.py | .py | import logging
import os
import urllib.parse
from pathlib import Path
import mlflow
from mlflow.exceptions import MlflowException
from mlflow.store.artifact.artifact_repo import ArtifactRepository
from mlflow.store.artifact.databricks_models_artifact_repo import DatabricksModelsArtifactRepository
from mlflow.store.art... | 272 | 11,464 |
mlflow | mlflow/store/artifact/s3_artifact_repo.py | .py | import json
import logging
import os
import posixpath
import urllib.parse
from datetime import datetime, timezone
from functools import lru_cache
from io import BytesIO
from mimetypes import guess_type
from mlflow.entities import FileInfo
from mlflow.entities.multipart_upload import (
CreateMultipartUploadResponse... | 784 | 33,696 |
mlflow | mlflow/store/artifact/databricks_artifact_repo_resources.py | .py | import posixpath
from abc import ABC, abstractmethod
from dataclasses import dataclass, field
from enum import Enum
from typing import Any, Callable
from mlflow.entities.file_info import FileInfo
from mlflow.protos.databricks_artifacts_pb2 import (
DatabricksMlflowArtifactsService,
GetCredentialsForLoggedModel... | 306 | 10,394 |
mlflow | mlflow/store/artifact/databricks_logged_model_artifact_repo.py | .py | import re
from mlflow.store.artifact.databricks_tracking_artifact_repo import (
DatabricksTrackingArtifactRepository,
)
class DatabricksLoggedModelArtifactRepository(DatabricksTrackingArtifactRepository):
"""
Artifact repository for interacting with logged model artifacts in a Databricks workspace.
I... | 37 | 1,453 |
mlflow | mlflow/store/artifact/runs_artifact_repo.py | .py | import logging
import os
import urllib.parse
from typing import Iterator
import mlflow
from mlflow.entities.file_info import FileInfo
from mlflow.entities.logged_model import LoggedModel
from mlflow.exceptions import MlflowException
from mlflow.protos.databricks_pb2 import RESOURCE_DOES_NOT_EXIST
from mlflow.store.art... | 272 | 11,633 |
mlflow | mlflow/store/artifact/optimized_s3_artifact_repo.py | .py | import json
import logging
import os
import posixpath
import urllib.parse
from mimetypes import guess_type
from mlflow.entities import FileInfo
from mlflow.environment_variables import (
MLFLOW_ENABLE_MULTIPART_UPLOAD,
MLFLOW_MULTIPART_UPLOAD_CHUNK_SIZE,
MLFLOW_S3_EXPECTED_BUCKET_OWNER,
MLFLOW_S3_UPLOA... | 409 | 17,354 |
mlflow | mlflow/store/artifact/databricks_sdk_artifact_repo.py | .py | import logging
import posixpath
from concurrent.futures import Future
from pathlib import Path
from typing import TYPE_CHECKING
from packaging.version import Version
from mlflow.entities import FileInfo
from mlflow.environment_variables import MLFLOW_MULTIPART_UPLOAD_CHUNK_SIZE
from mlflow.exceptions import MlflowExc... | 142 | 5,605 |
mlflow | mlflow/store/artifact/hdfs_artifact_repo.py | .py | import os
import posixpath
import urllib.parse
from contextlib import contextmanager
try:
from pyarrow.fs import FileSelector, FileType, HadoopFileSystem
except ImportError:
pass
from mlflow.entities import FileInfo
from mlflow.environment_variables import (
MLFLOW_KERBEROS_TICKET_CACHE,
MLFLOW_KERBER... | 211 | 7,989 |
mlflow | mlflow/store/artifact/cli.py | .py | import logging
import click
from mlflow.artifacts import download_artifacts as _download_artifacts
from mlflow.store.artifact.artifact_repository_registry import get_artifact_repository
from mlflow.tracking import _get_store
from mlflow.utils.proto_json_utils import message_to_json
_logger = logging.getLogger(__name... | 142 | 5,375 |
mlflow | mlflow/store/artifact/local_artifact_repo.py | .py | import asyncio
import os
import shutil
import tempfile
import threading
from contextlib import suppress
from typing import Any, AsyncIterable, BinaryIO, Callable
from mlflow.exceptions import MlflowException
from mlflow.protos.databricks_pb2 import RESOURCE_DOES_NOT_EXIST
from mlflow.store.artifact.artifact_repo impor... | 302 | 12,165 |
mlflow | mlflow/store/artifact/cloud_artifact_repo.py | .py | import logging
import math
import os
import posixpath
import time
from abc import abstractmethod
from concurrent.futures import as_completed
from typing import NamedTuple
from mlflow.environment_variables import (
_MLFLOW_MPD_NUM_RETRIES,
_MLFLOW_MPD_RETRY_INTERVAL_SECONDS,
MLFLOW_ENABLE_MULTIPART_DOWNLOAD... | 330 | 13,307 |
mlflow | mlflow/store/artifact/uc_volume_artifact_repo.py | .py | import mlflow.utils.databricks_utils
from mlflow.environment_variables import MLFLOW_ENABLE_UC_VOLUME_FUSE_ARTIFACT_REPO
from mlflow.exceptions import MlflowException
from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE
from mlflow.store.artifact.databricks_sdk_artifact_repo import DatabricksSdkArtifactRepo... | 82 | 3,629 |
mlflow | mlflow/store/artifact/dbfs_artifact_repo.py | .py | import json
import os
import posixpath
import mlflow.utils.databricks_utils
from mlflow.entities import FileInfo
from mlflow.environment_variables import (
MLFLOW_DISABLE_DATABRICKS_SDK_FOR_RUN_ARTIFACTS,
MLFLOW_ENABLE_DBFS_FUSE_ARTIFACT_REPO,
)
from mlflow.exceptions import MlflowException
from mlflow.protos.... | 265 | 11,587 |
mlflow | mlflow/store/artifact/utils/models.py | .py | import urllib.parse
from pathlib import Path
from typing import NamedTuple
import mlflow.tracking
from mlflow.exceptions import MlflowException
from mlflow.utils.uri import (
get_databricks_profile_uri_from_artifact_uri,
is_databricks_uri,
is_models_uri,
)
_MODELS_URI_SUFFIX_LATEST = "latest"
def is_usi... | 153 | 6,353 |
mlflow | mlflow/store/model_registry/base_rest_store.py | .py | from abc import ABCMeta, abstractmethod
from mlflow.store.model_registry.abstract_store import AbstractStore
from mlflow.utils.rest_utils import (
call_endpoint,
call_endpoints,
)
class BaseRestStore(AbstractStore):
"""
Base class client for a remote model registry server accessed via REST API calls
... | 45 | 1,341 |
mlflow | mlflow/store/model_registry/sqlalchemy_store.py | .py | import logging
import threading
import urllib
import uuid
from typing import Any
import sqlalchemy
from sqlalchemy import select
from sqlalchemy.orm import Session
from mlflow.entities.model_registry.model_version_stages import (
ALL_STAGES,
DEFAULT_STAGES_FOR_GET_LATEST_VERSIONS,
STAGE_ARCHIVED,
STAG... | 1,794 | 74,257 |
mlflow | mlflow/store/model_registry/rest_store.py | .py | import logging
from mlflow.entities.model_registry import ModelVersion, RegisteredModel
from mlflow.entities.webhook import Webhook, WebhookEvent, WebhookStatus, WebhookTestResult
from mlflow.protos.model_registry_pb2 import (
CreateModelVersion,
CreateRegisteredModel,
DeleteModelVersion,
DeleteModelVe... | 596 | 22,257 |
mlflow | mlflow/store/model_registry/__init__.py | .py | # Path to default location for backend when using local FileStore.
DEFAULT_LOCAL_FILE_AND_ARTIFACT_PATH = "./mlruns"
SEARCH_REGISTERED_MODEL_MAX_RESULTS_DEFAULT = 100
SEARCH_REGISTERED_MODEL_MAX_RESULTS_THRESHOLD = 1000
# Some backends have a low maximum results threshold; for example, Databricks only allows
# `max_re... | 11 | 605 |
mlflow | mlflow/store/model_registry/abstract_store.py | .py | import json
import logging
import re
import threading
from abc import ABCMeta, abstractmethod
from time import sleep, time
from typing import Any
from pydantic import BaseModel
from mlflow.entities.logged_model_tag import LoggedModelTag
from mlflow.entities.model_registry import ModelVersionTag, RegisteredModelTag
fr... | 1,313 | 48,103 |
mlflow | mlflow/store/model_registry/sqlalchemy_workspace_store.py | .py | """
Workspace-aware variant of the model registry SQLAlchemy store.
"""
from __future__ import annotations
import logging
from mlflow.store.model_registry.sqlalchemy_store import SqlAlchemyStore
from mlflow.store.workspace_aware_mixin import WorkspaceAwareMixin
_logger = logging.getLogger(__name__)
class Workspac... | 36 | 1,195 |
mlflow | mlflow/store/model_registry/file_store.py | .py | import logging
import os
import shutil
import sys
import time
import urllib
from os.path import join
from mlflow.entities.model_registry import (
ModelVersion,
ModelVersionTag,
RegisteredModel,
RegisteredModelAlias,
RegisteredModelTag,
)
from mlflow.entities.model_registry.model_version_stages impo... | 1,116 | 45,571 |
mlflow | mlflow/store/model_registry/databricks_workspace_model_registry_rest_store.py | .py | import logging
from functools import partial
from urllib.parse import parse_qs, urlparse
import mlflow
from mlflow.environment_variables import MLFLOW_SKIP_SIGNATURE_CHECK_FOR_UC_REGISTRY_MIGRATION
from mlflow.exceptions import MlflowException
from mlflow.protos.databricks_pb2 import (
RESOURCE_ALREADY_EXISTS,
... | 164 | 7,180 |
mlflow | mlflow/store/model_registry/dbmodels/models.py | .py | import sqlalchemy as sa
from cryptography.fernet import Fernet
from sqlalchemy import (
BigInteger,
Column,
ForeignKey,
ForeignKeyConstraint,
Index,
Integer,
PrimaryKeyConstraint,
String,
Text,
TypeDecorator,
)
from sqlalchemy.orm import backref, relationship
from mlflow.entitie... | 385 | 12,284 |
mlflow | mlflow/store/analytics/__init__.py | .py | """
Analytics modules for MLflow store operations.
This package contains analytical algorithms and computations that operate
on MLflow tracking store data, such as trace correlation analysis.
"""
from mlflow.store.analytics.trace_correlation import (
JEFFREYS_PRIOR,
NPMIResult,
TraceCorrelationCounts,
... | 23 | 530 |
mlflow | mlflow/store/analytics/trace_correlation.py | .py | import math
from dataclasses import dataclass
# Recommended smoothing parameter for NPMI calculation
# Using Jeffreys prior (alpha=0.5) to minimize bias while providing robust estimates
JEFFREYS_PRIOR = 0.5
@dataclass
class TraceCorrelationCounts:
"""
Count statistics for trace correlation analysis.
Thi... | 208 | 7,127 |
mlflow | mlflow/store/db_migrations/env.py | .py | from alembic import context
from sqlalchemy import engine_from_config, pool
# this is the Alembic Config object, which provides
# access to the values within the .ini file in use.
config = context.config
# add your model's MetaData object here
# for 'autogenerate' support
# from myapp import mymodel
# target_metadata... | 79 | 2,550 |
mlflow | mlflow/store/db_migrations/versions/c48cb773bb87_reset_default_value_for_is_nan_in_metrics_table_for_mysql.py | .py | """reset_default_value_for_is_nan_in_metrics_table_for_mysql
Create Date: 2021-04-02 15:43:28.466043
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "c48cb773bb87"
down_revision = "39d1c3be5f05"
branch_labels = None
depends_on = None
def upgrade():
# This... | 40 | 1,247 |
mlflow | mlflow/store/db_migrations/versions/c3d6457b6d8a_add_status_details_column_to_jobs_table.py | .py | """add status_details column to jobs table
Create Date: 2026-03-20 09:48:33.248771
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import mssql
# revision identifiers, used by Alembic.
revision = "c3d6457b6d8a"
down_revision = "76601a5f987d"
branch_labels = None
depends_on = None
def _... | 35 | 784 |
mlflow | mlflow/store/db_migrations/versions/400f98739977_add_logged_model_tables.py | .py | """add logged model tables
Create Date: 2025-02-06 22:05:35.542613
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "400f98739977"
down_revision = "0584bdc529eb"
branch_labels = None
depends_on = None
def upgrade():
op.create_table(
"logged_models"... | 122 | 4,796 |
mlflow | mlflow/store/db_migrations/versions/97727af70f4d_creation_time_last_update_time_experiments.py | .py | """Add creation_time and last_update_time to experiments table
Create Date: 2022-08-26 21:16:59.164858
"""
import sqlalchemy as sa
from alembic import op
# revision identifiers, used by Alembic.
revision = "97727af70f4d"
down_revision = "cc1f77228345"
branch_labels = None
depends_on = None
def upgrade():
op.a... | 24 | 529 |
mlflow | mlflow/store/db_migrations/versions/728d730b5ebd_add_registered_model_tags_table.py | .py | """add registered model tags table
Create Date: 2020-06-26 13:30:00.290154
"""
import sqlalchemy as sa
from alembic import op
from mlflow.store.model_registry.dbmodels.models import SqlRegisteredModelTag
# revision identifiers, used by Alembic.
revision = "728d730b5ebd"
down_revision = "0a8213491aaa"
branch_labels... | 37 | 894 |
mlflow | mlflow/store/db_migrations/versions/1a0cddfcaa16_add_webhooks_and_webhook_events_tables.py | .py | """Add webhooks and webhook_events tables
Create Date: 2025-07-07 23:00:00.000000
"""
import sqlalchemy as sa
from alembic import op
from mlflow.store.model_registry.dbmodels.models import SqlWebhook, SqlWebhookEvent
# revision identifiers, used by Alembic.
revision = "1a0cddfcaa16"
down_revision = "de4033877273"
... | 72 | 2,926 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.