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/entities/experiment_tag.py | .py | from mlflow.entities._mlflow_object import _MlflowObject
from mlflow.protos.service_pb2 import ExperimentTag as ProtoExperimentTag
class ExperimentTag(_MlflowObject):
"""Tag object associated with an experiment."""
def __init__(self, key, value):
self._key = key
self._value = value
def _... | 36 | 887 |
mlflow | mlflow/entities/logged_model_input.py | .py | from mlflow.entities._mlflow_object import _MlflowObject
from mlflow.protos.service_pb2 import ModelInput as ProtoModelInput
class LoggedModelInput(_MlflowObject):
"""ModelInput object associated with a Run."""
def __init__(self, model_id: str):
self._model_id = model_id
def __eq__(self, other: ... | 27 | 720 |
mlflow | mlflow/entities/gateway_budget_policy.py | .py | from __future__ import annotations
from dataclasses import dataclass
from enum import Enum
from mlflow.entities._mlflow_object import _MlflowObject
from mlflow.protos.service_pb2 import BudgetAction as ProtoBudgetAction
from mlflow.protos.service_pb2 import BudgetDuration as ProtoBudgetDuration
from mlflow.protos.ser... | 190 | 6,599 |
mlflow | mlflow/entities/trace_status.py | .py | from enum import Enum
from opentelemetry import trace as trace_api
from mlflow.entities.trace_state import TraceState
from mlflow.protos.service_pb2 import TraceStatus as ProtoTraceStatus
from mlflow.utils.annotations import deprecated
@deprecated(alternative="mlflow.entities.trace_state.TraceState")
class TraceSta... | 69 | 2,218 |
mlflow | mlflow/entities/dataset_record.py | .py | from __future__ import annotations
import json
from dataclasses import dataclass
from typing import Any
from google.protobuf.json_format import MessageToDict
from mlflow.entities._mlflow_object import _MlflowObject
from mlflow.entities.dataset_record_source import DatasetRecordSource, DatasetRecordSourceType
from ml... | 180 | 7,104 |
mlflow | mlflow/entities/logged_model_status.py | .py | from enum import Enum
from mlflow.exceptions import MlflowException
from mlflow.protos import service_pb2 as pb2
class LoggedModelStatus(str, Enum):
"""Enum for status of an :py:class:`mlflow.entities.LoggedModel`."""
UNSPECIFIED = "UNSPECIFIED"
PENDING = "PENDING"
READY = "READY"
FAILED = "FAIL... | 75 | 2,664 |
mlflow | mlflow/entities/dataset.py | .py | from mlflow.entities._mlflow_object import _MlflowObject
from mlflow.protos.service_pb2 import Dataset as ProtoDataset
class Dataset(_MlflowObject):
"""Dataset object associated with an experiment."""
def __init__(
self,
name: str,
digest: str,
source_type: str,
source... | 91 | 2,432 |
mlflow | mlflow/entities/issue.py | .py | from __future__ import annotations
from dataclasses import dataclass
from enum import Enum
from functools import cached_property
from typing import Any
from mlflow.entities._mlflow_object import _MlflowObject
from mlflow.protos.issues_pb2 import Issue as ProtoIssue
class IssueStatus(str, Enum):
"""Enum for stat... | 188 | 6,308 |
mlflow | mlflow/entities/_mlflow_object.py | .py | import pprint
from abc import abstractmethod
from functools import cached_property
class _MlflowObject:
def __iter__(self):
# Iterate through list of properties and yield as key -> value
for prop in self._properties():
yield prop, self.__getattribute__(prop)
@classmethod
def _... | 56 | 1,473 |
mlflow | mlflow/entities/logged_model.py | .py | from typing import Any
import mlflow.protos.service_pb2 as pb2
from mlflow.entities._mlflow_object import _MlflowObject
from mlflow.entities.logged_model_parameter import LoggedModelParameter
from mlflow.entities.logged_model_status import LoggedModelStatus
from mlflow.entities.logged_model_tag import LoggedModelTag
f... | 229 | 8,003 |
mlflow | mlflow/entities/document.py | .py | from copy import deepcopy
from dataclasses import asdict, dataclass, field
from typing import Any
@dataclass
class Document:
"""
An entity used in MLflow Tracing to represent retrieved documents in a RETRIEVER span.
Args:
page_content: The content of the document.
metadata: A dictionary o... | 49 | 1,372 |
mlflow | mlflow/entities/mcp_server.py | .py | from __future__ import annotations
import re
from dataclasses import dataclass, field
from enum import Enum
from typing import TYPE_CHECKING, Any
from mlflow.exceptions import MlflowException
from mlflow.utils.annotations import experimental
from mlflow.utils.workspace_utils import resolve_entity_workspace_name
if T... | 195 | 6,909 |
mlflow | mlflow/entities/mcp_server_version.py | .py | from __future__ import annotations
from dataclasses import dataclass, field
from typing import Any
from mlflow.entities.mcp_server import MCPStatus, MCPTool
from mlflow.exceptions import MlflowException
from mlflow.utils.annotations import experimental
from mlflow.utils.workspace_utils import resolve_entity_workspace... | 78 | 2,917 |
mlflow | mlflow/entities/span_log_level.py | .py | from __future__ import annotations
from enum import IntEnum
from mlflow.exceptions import MlflowException
from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE
class SpanLogLevel(IntEnum):
"""
Log level (severity) for an MLflow trace span.
The public tracing API accepts a :class:`SpanLogLeve... | 40 | 1,141 |
mlflow | mlflow/entities/param.py | .py | import sys
from mlflow.entities._mlflow_object import _MlflowObject
from mlflow.protos.service_pb2 import Param as ProtoParam
class Param(_MlflowObject):
"""
Parameter object.
"""
def __init__(self, key, value):
if "pyspark.ml" in sys.modules:
import pyspark.ml.param
... | 50 | 1,133 |
mlflow | mlflow/entities/span_status.py | .py | from __future__ import annotations
from dataclasses import dataclass
from enum import Enum
from opentelemetry import trace as trace_api
from opentelemetry.proto.trace.v1.trace_pb2 import Status as OtelStatus
from mlflow.exceptions import MlflowException
from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALU... | 153 | 5,466 |
mlflow | mlflow/entities/webhook.py | .py | from enum import Enum
from typing import Literal, TypeAlias
from typing_extensions import Self
from mlflow.exceptions import MlflowException
from mlflow.protos.webhooks_pb2 import Webhook as ProtoWebhook
from mlflow.protos.webhooks_pb2 import WebhookAction as ProtoWebhookAction
from mlflow.protos.webhooks_pb2 import ... | 453 | 13,969 |
mlflow | mlflow/entities/assessment_source.py | .py | import warnings
from dataclasses import asdict, dataclass
from typing import Any
from mlflow.entities._mlflow_object import _MlflowObject
from mlflow.exceptions import MlflowException
from mlflow.protos.assessments_pb2 import AssessmentSource as ProtoAssessmentSource
from mlflow.protos.databricks_pb2 import INVALID_PA... | 195 | 6,770 |
mlflow | mlflow/entities/dataset_summary.py | .py | from mlflow.protos.service_pb2 import DatasetSummary
class _DatasetSummary:
"""
DatasetSummary object.
This is used to return a list of dataset summaries across one or more experiments in the UI.
"""
def __init__(self, experiment_id, name, digest, context):
self._experiment_id = experime... | 63 | 1,581 |
mlflow | mlflow/entities/run_outputs.py | .py | from typing import Any
from mlflow.entities._mlflow_object import _MlflowObject
from mlflow.entities.logged_model_output import LoggedModelOutput
from mlflow.protos.service_pb2 import RunOutputs as ProtoRunOutputs
class RunOutputs(_MlflowObject):
"""RunOutputs object."""
def __init__(self, model_outputs: li... | 44 | 1,316 |
mlflow | mlflow/entities/model_registry/registered_model_deployment_job_state.py | .py | from mlflow.protos.databricks_uc_registry_messages_pb2 import DeploymentJobConnection
class RegisteredModelDeploymentJobState:
"""Enum for registered model deployment state of an
:py:class:`mlflow.entities.model_registry.RegisteredModel`.
"""
NOT_SET_UP = DeploymentJobConnection.State.Value("NOT_SET_... | 40 | 1,757 |
mlflow | mlflow/entities/model_registry/model_version_deployment_job_state.py | .py | from mlflow.entities.model_registry._model_registry_entity import _ModelRegistryEntity
from mlflow.entities.model_registry.model_version_deployment_job_run_state import (
ModelVersionDeploymentJobRunState,
)
from mlflow.entities.model_registry.registered_model_deployment_job_state import (
RegisteredModelDeploy... | 71 | 2,364 |
mlflow | mlflow/entities/model_registry/model_version_status.py | .py | from mlflow.protos.model_registry_pb2 import ModelVersionStatus as ProtoModelVersionStatus
class ModelVersionStatus:
"""Enum for status of an :py:class:`mlflow.entities.model_registry.ModelVersion`."""
PENDING_REGISTRATION = ProtoModelVersionStatus.Value("PENDING_REGISTRATION")
FAILED_REGISTRATION = Prot... | 36 | 1,523 |
mlflow | mlflow/entities/model_registry/model_version.py | .py | from mlflow.entities.logged_model_parameter import LoggedModelParameter as ModelParam
from mlflow.entities.metric import Metric
from mlflow.entities.model_registry._model_registry_entity import _ModelRegistryEntity
from mlflow.entities.model_registry.model_version_deployment_job_state import (
ModelVersionDeploymen... | 254 | 9,548 |
mlflow | mlflow/entities/model_registry/prompt_version.py | .py | from __future__ import annotations
import json
import re
from typing import Any
from pydantic import BaseModel, Field, ValidationError
from mlflow.entities.model_registry._model_registry_entity import _ModelRegistryEntity
from mlflow.entities.model_registry.model_version_tag import ModelVersionTag
from mlflow.except... | 574 | 22,164 |
mlflow | mlflow/entities/model_registry/registered_model_alias.py | .py | from mlflow.entities.model_registry._model_registry_entity import _ModelRegistryEntity
from mlflow.protos.model_registry_pb2 import RegisteredModelAlias as ProtoRegisteredModelAlias
class RegisteredModelAlias(_ModelRegistryEntity):
"""Alias object associated with a registered model."""
def __init__(self, ali... | 36 | 1,053 |
mlflow | mlflow/entities/model_registry/__init__.py | .py | from mlflow.entities.model_registry.model_version import ModelVersion
from mlflow.entities.model_registry.model_version_deployment_job_state import (
ModelVersionDeploymentJobState,
)
from mlflow.entities.model_registry.model_version_search import ModelVersionSearch
from mlflow.entities.model_registry.model_version... | 31 | 1,284 |
mlflow | mlflow/entities/model_registry/model_version_deployment_job_run_state.py | .py | from mlflow.protos.databricks_uc_registry_messages_pb2 import (
ModelVersionDeploymentJobState as ProtoModelVersionDeploymentJobState,
)
class ModelVersionDeploymentJobRunState:
"""Enum for model version deployment state of an
:py:class:`mlflow.entities.model_registry.ModelVersion`.
"""
NO_VALID_... | 45 | 2,043 |
mlflow | mlflow/entities/model_registry/registered_model_search.py | .py | from mlflow.entities.model_registry import RegisteredModel
class RegisteredModelSearch(RegisteredModel):
def __init__(self, *args, **kwargs):
kwargs["tags"] = []
kwargs["aliases"] = []
super().__init__(*args, **kwargs)
def tags(self):
raise Exception(
"UC Registere... | 26 | 889 |
mlflow | mlflow/entities/model_registry/model_version_search.py | .py | from mlflow.entities.model_registry import ModelVersion
class ModelVersionSearch(ModelVersion):
def __init__(self, *args, **kwargs):
kwargs["tags"] = []
kwargs["aliases"] = []
super().__init__(*args, **kwargs)
def tags(self):
raise Exception(
"UC Model Versions gat... | 26 | 863 |
mlflow | mlflow/entities/model_registry/model_version_tag.py | .py | from mlflow.entities.model_registry._model_registry_entity import _ModelRegistryEntity
from mlflow.protos.model_registry_pb2 import ModelVersionTag as ProtoModelVersionTag
class ModelVersionTag(_ModelRegistryEntity):
"""Tag object associated with a model version."""
def __init__(self, key, value):
se... | 36 | 933 |
mlflow | mlflow/entities/model_registry/registered_model.py | .py | from mlflow.entities.model_registry._model_registry_entity import _ModelRegistryEntity
from mlflow.entities.model_registry.model_version import ModelVersion
from mlflow.entities.model_registry.prompt_version import IS_PROMPT_TAG_KEY
from mlflow.entities.model_registry.registered_model_alias import RegisteredModelAlias
... | 186 | 6,892 |
mlflow | mlflow/entities/model_registry/registered_model_tag.py | .py | from mlflow.entities.model_registry._model_registry_entity import _ModelRegistryEntity
from mlflow.protos.model_registry_pb2 import RegisteredModelTag as ProtoRegisteredModelTag
class RegisteredModelTag(_ModelRegistryEntity):
"""Tag object associated with a registered model."""
def __init__(self, key, value)... | 36 | 948 |
mlflow | mlflow/entities/model_registry/prompt.py | .py | """
Prompt entity for MLflow Model Registry.
This represents a prompt in the registry with its metadata, without version-specific
content like template text. For version-specific content, use PromptVersion.
"""
class Prompt:
"""
Entity representing a prompt in the MLflow Model Registry.
This contains pr... | 72 | 2,151 |
mlflow | mlflow/entities/model_registry/model_version_stages.py | .py | from mlflow.exceptions import MlflowException
from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE
STAGE_NONE = "None"
STAGE_STAGING = "Staging"
STAGE_PRODUCTION = "Production"
STAGE_ARCHIVED = "Archived"
STAGE_DELETED_INTERNAL = "Deleted_Internal"
ALL_STAGES = [STAGE_NONE, STAGE_STAGING, STAGE_PRODUCTIO... | 26 | 831 |
mlflow | mlflow/entities/model_registry/_model_registry_entity.py | .py | from abc import abstractmethod
from mlflow.entities._mlflow_object import _MlflowObject
class _ModelRegistryEntity(_MlflowObject):
@classmethod
@abstractmethod
def from_proto(cls, proto):
pass
def __eq__(self, other):
return dict(self) == dict(other)
| 14 | 287 |
mlflow | mlflow/pytorch/_lightning_autolog.py | .py | import functools
import logging
import os
import tempfile
import warnings
import torch
from packaging.version import Version
import mlflow.pytorch
from mlflow.exceptions import MlflowException
from mlflow.ml_package_versions import _ML_PACKAGE_VERSIONS
from mlflow.models import infer_signature
from mlflow.tracking.fl... | 710 | 29,845 |
mlflow | mlflow/pytorch/pickle_module.py | .py | """
This module imports contents from CloudPickle in a way that is compatible with the
``pickle_module`` parameter of PyTorch's model persistence function: ``torch.save``
(see https://github.com/pytorch/pytorch/blob/692898fe379c9092f5e380797c32305145cd06e1/torch/
serialization.py#L192). It is included as a distinct mod... | 36 | 1,994 |
mlflow | mlflow/pytorch/__init__.py | .py | """
The ``mlflow.pytorch`` module provides an API for logging and loading PyTorch models. This module
exports PyTorch models with the following flavors:
PyTorch (native) format
This is the main flavor that can be loaded back into PyTorch.
:py:mod:`mlflow.pyfunc`
Produced for use by generic pyfunc-based deploym... | 1,393 | 56,781 |
mlflow | mlflow/pytorch/_pytorch_autolog.py | .py | import time
import mlflow
from mlflow.entities import Metric, Param
from mlflow.tracking import MlflowClient
from mlflow.utils.autologging_utils.metrics_queue import (
add_to_metrics_queue,
flush_metrics_queue,
)
def patched_add_hparams(original, self, hparam_dict, metric_dict, *args, **kwargs):
"""use a... | 51 | 1,874 |
mlflow | mlflow/otel/__init__.py | .py | """
The ``mlflow.otel`` module provides generic OTEL-to-MLflow span forwarding.
When enabled, every span produced by any OpenTelemetry-instrumented library
(e.g. Langfuse, OpenInference / Arize Phoenix) is automatically forwarded
to the MLflow backend via the OTLP endpoint.
.. code-block:: python
import mlflow.o... | 184 | 6,695 |
mlflow | mlflow/server/asgi_utils.py | .py | from __future__ import annotations
import os
from starlette.requests import Request as StarletteRequest
def get_routed_asgi_path(request: StarletteRequest) -> str:
"""Return the routed ASGI path for a FastAPI request.
Prefer ``request.scope["path"]`` because Starlette reconstructs
``request.url.path`` ... | 33 | 1,208 |
mlflow | mlflow/server/otel_api.py | .py | """
OpenTelemetry REST API endpoints for MLflow FastAPI server.
This module implements the OpenTelemetry Protocol (OTLP) REST API for ingesting spans
according to the OTel specification:
https://opentelemetry.io/docs/specs/otlp/#otlphttp
Note: This is a minimal implementation that serves as a placeholder for the OTel... | 260 | 10,910 |
mlflow | mlflow/server/__init__.py | .py | import importlib
import logging
import os
import secrets
import shlex
import signal
import sys
import tempfile
import textwrap
import types
import warnings
from pathlib import Path
_logger = logging.getLogger("mlflow.server")
from flask import Flask, Response, send_from_directory
from packaging.version import Version... | 517 | 17,608 |
mlflow | mlflow/server/constants.py | .py | """
Constants used for internal server-to-worker communication.
These are internal environment variables (prefixed with _MLFLOW_SERVER_) used for
communication between the MLflow CLI and forked server processes (gunicorn/uvicorn workers).
They are set by the server and read by workers, and should not be set by end use... | 80 | 3,922 |
mlflow | mlflow/server/handlers.py | .py | # Define all the service endpoint handlers here.
import io
import json
import logging
import os
import pathlib
import posixpath
import re
import tempfile
import threading
import time
import unicodedata
import urllib
from collections.abc import Iterable
from functools import partial, wraps
from typing import Any, Callab... | 8,241 | 304,094 |
mlflow | mlflow/server/gateway_api.py | .py | """
Database-backed Gateway API endpoints for MLflow Server.
This module provides dynamic gateway endpoints that are configured from the database
rather than from a static YAML configuration file. It integrates the AI Gateway
functionality directly into the MLflow tracking server.
"""
import functools
import io
impor... | 1,588 | 63,389 |
mlflow | mlflow/server/security.py | .py | import logging
from http import HTTPStatus
from flask import Flask, Response, request
from flask_cors import CORS
from mlflow.environment_variables import (
MLFLOW_SERVER_DISABLE_SECURITY_MIDDLEWARE,
MLFLOW_SERVER_X_FRAME_OPTIONS,
)
from mlflow.server.security_utils import (
CORS_BLOCKED_MSG,
HEALTH_E... | 127 | 4,596 |
mlflow | mlflow/server/fastapi_app.py | .py | """
FastAPI application wrapper for MLflow server.
This module provides a FastAPI application that wraps the existing Flask application
using WSGIMiddleware to maintain 100% API compatibility while enabling future migration
to FastAPI endpoints.
"""
import inspect
import json
import os
import time
import typing
impo... | 261 | 11,028 |
mlflow | mlflow/server/fastapi_security.py | .py | import logging
from http import HTTPStatus
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from starlette.types import ASGIApp
from mlflow.environment_variables import (
MLFLOW_SERVER_DISABLE_SECURITY_MIDDLEWARE,
MLFLOW_SERVER_X_FRAME_OPTIONS,
)
from mlflow.server.security_utils... | 202 | 7,301 |
mlflow | mlflow/server/artifact_router.py | .py | """
Native FastAPI artifact upload and download endpoints.
When MLflow runs under uvicorn/FastAPI (the default), these endpoints handle
artifact upload and download requests directly via ASGI, bypassing the WSGI
bridge and avoiding full-body buffering. This enables true streaming for large
artifact transfers.
When ML... | 182 | 6,448 |
mlflow | mlflow/server/workspace_helpers.py | .py | from __future__ import annotations
import logging
import os
from flask import Response, request
from mlflow.entities import Workspace
from mlflow.environment_variables import (
MLFLOW_ENABLE_WORKSPACES,
MLFLOW_WORKSPACE_STORE_URI,
)
from mlflow.exceptions import MlflowException
from mlflow.protos import data... | 156 | 5,455 |
mlflow | mlflow/server/security_utils.py | .py | """
Shared security utilities for MLflow server middleware.
This module contains common functions used by both Flask and FastAPI
security implementations.
"""
import fnmatch
from urllib.parse import urlparse
from mlflow.environment_variables import (
MLFLOW_SERVER_ALLOWED_HOSTS,
MLFLOW_SERVER_CORS_ALLOWED_OR... | 171 | 5,294 |
mlflow | mlflow/server/prometheus_exporter.py | .py | from flask import request
from prometheus_flask_exporter.multiprocess import GunicornInternalPrometheusMetrics
from mlflow.version import VERSION
def activate_prometheus_exporter(app):
def mlflow_version(_: request):
return VERSION
return GunicornInternalPrometheusMetrics(
app,
expor... | 18 | 458 |
mlflow | mlflow/server/job_api.py | .py | """
Internal job APIs for UI invocation
"""
import json
from typing import Any
from fastapi import APIRouter, HTTPException
from pydantic import BaseModel
from mlflow.entities._job import Job as JobEntity
from mlflow.entities._job_status import JobStatus
from mlflow.exceptions import MlflowException
job_api_router ... | 136 | 3,657 |
mlflow | mlflow/server/validation.py | .py | from mlflow.exceptions import MlflowException
from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE
def _validate_content_type(flask_request, allowed_content_types: list[str]):
"""
Validates that the request content type is one of the allowed content types.
Args:
flask_request: Flask r... | 31 | 1,095 |
mlflow | mlflow/server/mcp_server_api.py | .py | from __future__ import annotations
import json
from typing import TYPE_CHECKING, Any, Literal
from fastapi import APIRouter, Query, Request
from fastapi.exceptions import RequestValidationError
from fastapi.responses import JSONResponse
from pydantic import (
BaseModel,
ConfigDict,
Field,
field_valida... | 914 | 31,934 |
mlflow | mlflow/server/graphql/graphql_custom_scalars.py | .py | import graphene
from graphql.language.ast import IntValueNode
class LongString(graphene.Scalar):
"""
LongString Scalar type to prevent truncation to max integer in JavaScript.
"""
description = "Long converted to string to prevent truncation to max integer in JavaScript"
@staticmethod
def se... | 25 | 579 |
mlflow | mlflow/server/graphql/autogenerated_graphql_schema.py | .py | # GENERATED FILE. PLEASE DON'T MODIFY.
# Run uv run ./dev/proto_to_graphql/code_generator.py to regenerate.
import graphene
import mlflow
from mlflow.server.graphql.graphql_custom_scalars import LongString
from mlflow.server.graphql.graphql_errors import ApiError
from mlflow.utils.proto_json_utils import parse_dict
c... | 356 | 11,751 |
mlflow | mlflow/server/graphql/graphql_errors.py | .py | import graphene
class ErrorDetail(graphene.ObjectType):
# NOTE: This is not an exhaustive list, might need to add more things in the future if needed.
field = graphene.String()
message = graphene.String()
class ApiError(graphene.ObjectType):
code = graphene.String()
message = graphene.String()
... | 16 | 432 |
mlflow | mlflow/server/graphql/graphql_no_batching.py | .py | from typing import NamedTuple
from graphql.error import GraphQLError
from graphql.execution import ExecutionResult
from graphql.language.ast import DocumentNode, FieldNode
from mlflow.environment_variables import (
MLFLOW_SERVER_GRAPHQL_MAX_ALIASES,
MLFLOW_SERVER_GRAPHQL_MAX_ROOT_FIELDS,
)
_MAX_DEPTH = 10
_M... | 90 | 2,959 |
mlflow | mlflow/server/auth/sqlalchemy_store.py | .py | import logging
import re
from collections.abc import Iterable
from urllib.parse import quote, unquote
from sqlalchemy import and_, or_, select, text
from sqlalchemy.exc import IntegrityError, MultipleResultsFound, NoResultFound
from sqlalchemy.orm import selectinload, sessionmaker
from werkzeug.security import check_p... | 2,240 | 96,889 |
mlflow | mlflow/server/auth/__main__.py | .py | from mlflow.server.auth.cli import commands
if __name__ == "__main__":
commands()
| 5 | 87 |
mlflow | mlflow/server/auth/__init__.py | .py | """
Usage
-----
.. code-block:: bash
mlflow server --app-name basic-auth
"""
from __future__ import annotations
import asyncio
import base64
import functools
import hmac
import importlib
import json
import logging
import os
import re
import secrets
import threading
from dataclasses import asdict, dataclass
from... | 5,774 | 220,958 |
mlflow | mlflow/server/auth/entities.py | .py | from mlflow.exceptions import MlflowException
from mlflow.server.auth.permissions import get_permission
from mlflow.utils.workspace_utils import DEFAULT_WORKSPACE_NAME, resolve_entity_workspace_name
class User:
def __init__(
self,
id_,
username,
password_hash,
is_admin,
... | 574 | 13,943 |
mlflow | mlflow/server/auth/client.py | .py | from mlflow.server.auth.entities import (
GetUserPermissionResult,
Role,
RolePermission,
User,
UserRoleAssignment,
)
from mlflow.server.auth.routes import (
ADD_ROLE_PERMISSION,
ASSIGN_ROLE,
CREATE_ROLE,
CREATE_USER,
DELETE_ROLE,
DELETE_USER,
GET_ROLE,
GET_USER,
G... | 395 | 12,956 |
mlflow | mlflow/server/auth/routes.py | .py | from mlflow.server.handlers import _add_static_prefix, _get_ajax_path, _get_rest_path
HOME = "/"
SIGNUP = "/signup"
CREATE_USER = _get_rest_path("/mlflow/users/create")
AJAX_CREATE_USER = _get_ajax_path("/mlflow/users/create")
CREATE_USER_UI = _get_rest_path("/mlflow/users/create-ui")
GET_USER = _get_rest_path("/mlflo... | 91 | 6,067 |
mlflow | mlflow/server/auth/permissions.py | .py | from dataclasses import dataclass
from mlflow import MlflowException
from mlflow.protos.databricks_pb2 import INVALID_PARAMETER_VALUE
@dataclass
class Permission:
name: str
can_read: bool
can_use: bool
can_update: bool
can_delete: bool
can_manage: bool
READ = Permission(
name="READ",
... | 186 | 6,063 |
mlflow | mlflow/server/auth/cli.py | .py | import click
from mlflow.server.auth.db import cli as db_cli
@click.group()
def commands():
pass
commands.add_command(db_cli.commands)
| 12 | 144 |
mlflow | mlflow/server/auth/config.py | .py | import configparser
from pathlib import Path
from typing import NamedTuple
from mlflow.environment_variables import MLFLOW_AUTH_CONFIG_PATH
DEFAULT_AUTHORIZATION_FUNCTION = "mlflow.server.auth:authenticate_request_basic_auth"
class AuthConfig(NamedTuple):
default_permission: str
database_uri: str
admin_... | 57 | 2,136 |
mlflow | mlflow/server/auth/logo.py | .py | # ruff: noqa: E501
MLFLOW_LOGO = """
<svg width="109" height="40" viewBox="0 0 109 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M0 31.0316V15.5024H3.54258V17.4699C4.43636 15.8756 6.38278 15.045 8.13589 15.045C10.178 15.045 11.9636 15.9713 12.7943 17.7895C14.0096 15.7474 15.8278 15.045 17.8373 15.045C20.... | 15 | 2,660 |
mlflow | mlflow/server/auth/db/utils.py | .py | from pathlib import Path
from alembic.command import stamp, upgrade
from alembic.config import Config
from alembic.migration import MigrationContext
from alembic.script import ScriptDirectory
from sqlalchemy import inspect
from sqlalchemy.engine.base import Engine
INITIAL_REVISION = "8606fa83a998"
def _get_alembic_... | 79 | 2,942 |
mlflow | mlflow/server/auth/db/models.py | .py | from sqlalchemy import (
Boolean,
Column,
ForeignKey,
Index,
Integer,
String,
UniqueConstraint,
)
from sqlalchemy.orm import declarative_base, relationship
from mlflow.server.auth.entities import (
Role,
RolePermission,
User,
UserRoleAssignment,
)
Base = declarative_base()
... | 120 | 3,845 |
mlflow | mlflow/server/auth/db/cli.py | .py | import click
import sqlalchemy
from mlflow.server.auth.db import utils
@click.group(name="db")
def commands():
pass
@commands.command()
@click.option("--url", required=True)
@click.option("--revision", default="head")
def upgrade(url: str, revision: str) -> None:
engine = sqlalchemy.create_engine(url)
... | 19 | 373 |
mlflow | mlflow/server/assistant/session.py | .py | import json
import os
import signal
import tempfile
import uuid
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any, Literal
from mlflow.assistant.types import Message
SESSION_DIR = Path(tempfile.gettempdir()) / "mlflow-assistant-sessions"
@dataclass
class Session:
"""Sessio... | 250 | 8,294 |
mlflow | mlflow/server/assistant/api.py | .py | import asyncio
import enum
import ipaddress
import uuid
from collections.abc import Awaitable, Callable
from pathlib import Path
from typing import Any, AsyncGenerator, Literal
from fastapi import APIRouter, Header, HTTPException, Request
from fastapi.responses import StreamingResponse
from fastapi.routing import APIR... | 828 | 30,925 |
mlflow | mlflow/server/jobs/progress.py | .py | """Job tracking for MLflow jobs."""
from typing import Any
_job_tracker: "JobTracker | NoOpTracker | None" = None
class JobTracker:
"""Tracks job execution by writing directly to database (internal use)."""
def __init__(self, job_id: str):
self.job_id = job_id
def update(self, status_details: ... | 46 | 1,227 |
mlflow | mlflow/server/jobs/utils.py | .py | import errno
import hashlib
import importlib
import inspect
import json
import logging
import os
import shutil
import signal
import subprocess
import sys
import tempfile
import threading
import time
from contextlib import nullcontext
from dataclasses import asdict, dataclass
from datetime import datetime
from pathlib i... | 812 | 29,422 |
mlflow | mlflow/server/jobs/_job_subproc_entry.py | .py | """
This module is used for launching subprocess to execute the job function.
If the job has timeout setting, or the job has pip requirements dependencies,
or the job has extra environment variables setting,
the job is executed as a subprocess.
"""
import importlib
import json
import logging
import os
import threadin... | 105 | 3,510 |
mlflow | mlflow/server/jobs/_job_runner.py | .py | """
This module is used for launching the job runner process.
The job runner will:
* enqueue all unfinished huey tasks when MLflow server is down last time.
* Watch the `_MLFLOW_HUEY_STORAGE_PATH` path,
if new files (named like `XXX.mlflow-huey-store`) are created,
it means a new Huey queue is created, then the jo... | 44 | 1,578 |
mlflow | mlflow/server/jobs/__init__.py | .py | import json
import logging
import os
from dataclasses import dataclass
from types import FunctionType
from typing import Any, Callable, ParamSpec, TypeVar
from mlflow.entities._job import Job as JobEntity
from mlflow.environment_variables import MLFLOW_ENABLE_WORKSPACES
from mlflow.exceptions import MlflowException
fr... | 275 | 9,494 |
mlflow | mlflow/server/jobs/_huey_consumer.py | .py | """
This module is used for launching Huey consumer
the command is like:
```
export _MLFLOW_HUEY_STORAGE_PATH={huey_store_dir}
export _MLFLOW_HUEY_INSTANCE_KEY={huey_instance_key}
huey_consumer.py mlflow.server.jobs.huey_consumer.huey_instance -w {max_workers}
```
It launches the Huey consumer that polls tasks from ... | 39 | 1,142 |
mlflow | mlflow/server/jobs/_periodic_tasks_consumer.py | .py | """
This module is used for launching the periodic tasks Huey consumer.
This is a dedicated consumer that only runs periodic tasks (like the online scoring scheduler).
It is launched by the job runner and runs in a separate process from job execution consumers.
"""
import threading
from mlflow.server.jobs.logging_ut... | 33 | 1,056 |
mlflow | mlflow/server/jobs/logging_utils.py | .py | """Shared logging utilities for MLflow job consumers."""
import logging
from mlflow.utils.logging_utils import get_mlflow_log_level
def configure_logging_for_jobs() -> None:
"""Configure Python logging for job consumers to reduce noise for log levels above DEBUG."""
# Suppress noisy alembic and huey INFO lo... | 14 | 560 |
mlflow | mlflow/paddle/__init__.py | .py | """
The ``mlflow.paddle`` module provides an API for logging and loading paddle models.
This module exports paddle models with the following flavors:
Paddle (native) format
This is the main flavor that can be loaded back into paddle.
:py:mod:`mlflow.pyfunc`
Produced for use by generic pyfunc-based deployment ... | 618 | 21,898 |
mlflow | mlflow/paddle/_paddle_autolog.py | .py | import paddle
import mlflow
from mlflow.tracking.fluent import _initialize_logged_model
from mlflow.utils.autologging_utils import (
BatchMetricsLogger,
ExceptionSafeAbstractClass,
MlflowAutologgingQueueingClient,
get_autologging_config,
)
class __MlflowPaddleCallback(paddle.callbacks.Callback, metac... | 142 | 5,123 |
mlflow | mlflow/ag2/__init__.py | .py | from mlflow.telemetry.events import AutologgingEvent
from mlflow.telemetry.track import _record_event
from mlflow.utils.autologging_utils import autologging_integration
FLAVOR_NAME = "ag2"
def autolog(
log_traces: bool = True,
disable: bool = False,
silent: bool = False,
):
"""
Enables (or disabl... | 60 | 2,367 |
mlflow | mlflow/ag2/ag2_logger.py | .py | import functools
import logging
import time
import uuid
from dataclasses import dataclass, field
from datetime import datetime, timezone
from typing import Any
from autogen import Agent, ConversableAgent
from autogen.logger.base_logger import BaseLogger
from openai.types.chat import ChatCompletion
from mlflow.entitie... | 327 | 12,975 |
mlflow | mlflow/langchain/retriever_chain.py | .py | """Chain for wrapping a retriever."""
from __future__ import annotations
import json
from pathlib import Path
from typing import Any
import yaml
from pydantic import ConfigDict, Field
from mlflow.langchain._compat import (
import_async_callback_manager_for_chain_run,
import_base_retriever,
import_callba... | 167 | 5,649 |
mlflow | mlflow/langchain/databricks_dependencies.py | .py | import importlib
import inspect
import logging
import warnings
from typing import Any, Generator
from mlflow.models.resources import (
DatabricksFunction,
DatabricksServingEndpoint,
DatabricksSQLWarehouse,
DatabricksVectorSearchIndex,
Resource,
)
_logger = logging.getLogger(__name__)
def _get_em... | 439 | 17,896 |
mlflow | mlflow/langchain/api_request_parallel_processor.py | .py | # Based ons: https://github.com/openai/openai-cookbook/blob/6df6ceff470eeba26a56de131254e775292eac22/examples/api_request_parallel_processor.py
# Several changes were made to make it work with MLflow.
# Currently, only chat completion is supported.
"""
API REQUEST PARALLEL PROCESSOR
Using the LangChain API to process... | 334 | 13,118 |
mlflow | mlflow/langchain/runnables.py | .py | from __future__ import annotations
import os
import re
import warnings
from pathlib import Path
from typing import TYPE_CHECKING
import cloudpickle
import yaml
from mlflow.exceptions import MlflowException
from mlflow.langchain.utils.logging import (
_BASE_LOAD_KEY,
_CONFIG_LOAD_KEY,
_MODEL_DATA_FOLDER_N... | 544 | 20,194 |
mlflow | mlflow/langchain/_compat.py | .py | def import_base_retriever():
try:
from langchain.schema import BaseRetriever
return BaseRetriever
except ImportError:
from langchain_core.retrievers import BaseRetriever
return BaseRetriever
def import_document():
try:
from langchain.schema import Document
... | 223 | 5,073 |
mlflow | mlflow/langchain/langchain_tracer.py | .py | import ast
import logging
from contextvars import ContextVar
from typing import Any, Optional, Sequence
from uuid import UUID
import pydantic
from langchain_core.agents import AgentAction, AgentFinish
from langchain_core.callbacks.base import BaseCallbackHandler
from langchain_core.documents import Document
from langc... | 806 | 32,224 |
mlflow | mlflow/langchain/chat_agent_langgraph.py | .py | from __future__ import annotations
import json
from typing import Annotated, Any, TypedDict
from uuid import uuid4
from packaging.version import Version
from mlflow.utils import get_installed_version
try:
from langchain_core.messages import AnyMessage, BaseMessage, convert_to_messages
from langchain_core.ru... | 369 | 14,445 |
mlflow | mlflow/langchain/model.py | .py | """
The ``mlflow.langchain`` module provides an API for logging and loading LangChain models.
This module exports multivariate LangChain models in the langchain flavor and univariate
LangChain models in the pyfunc flavor:
LangChain (native) format
This is the main flavor that can be accessed with LangChain APIs.
:... | 949 | 40,562 |
mlflow | mlflow/langchain/__init__.py | .py | from mlflow.langchain.autolog import autolog
from mlflow.langchain.constants import FLAVOR_NAME
from mlflow.version import IS_TRACING_SDK_ONLY
__all__ = ["autolog", "FLAVOR_NAME"]
# Import model logging APIs only if mlflow skinny or full package is installed,
# i.e., skip if only mlflow-tracing package is installed.
... | 25 | 655 |
mlflow | mlflow/langchain/autolog.py | .py | import logging
from mlflow.langchain.constant import FLAVOR_NAME
from mlflow.telemetry.events import AutologgingEvent
from mlflow.telemetry.track import _record_event
from mlflow.utils.autologging_utils import autologging_integration
from mlflow.utils.autologging_utils.config import AutoLoggingConfig
from mlflow.utils... | 163 | 6,507 |
mlflow | mlflow/langchain/output_parsers.py | .py | from dataclasses import asdict
from typing import Any, AsyncIterator, Iterator
from uuid import uuid4
from langchain_core.messages.base import BaseMessage
from langchain_core.output_parsers.transform import BaseTransformOutputParser
from mlflow.models.rag_signatures import (
ChainCompletionChoice,
Message,
... | 153 | 5,270 |
mlflow | mlflow/langchain/utils/logging.py | .py | """Utility functions for mlflow.langchain."""
import functools
import importlib
import json
import logging
import os
import shutil
import types
from functools import lru_cache
from importlib.util import find_spec
from typing import Any, Callable, NamedTuple
import cloudpickle
import yaml
from packaging.version import... | 635 | 21,745 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.