fix: resolve all ruff lint errors
This commit is contained in:
@@ -20,13 +20,13 @@ Usage:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
from .client import (
|
from .client import (
|
||||||
|
MLflowConfig,
|
||||||
|
ensure_experiment,
|
||||||
get_mlflow_client,
|
get_mlflow_client,
|
||||||
get_tracking_uri,
|
get_tracking_uri,
|
||||||
ensure_experiment,
|
|
||||||
MLflowConfig,
|
|
||||||
)
|
)
|
||||||
from .tracker import MLflowTracker
|
|
||||||
from .inference_tracker import InferenceMetricsTracker
|
from .inference_tracker import InferenceMetricsTracker
|
||||||
|
from .tracker import MLflowTracker
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
"get_mlflow_client",
|
"get_mlflow_client",
|
||||||
|
|||||||
@@ -30,19 +30,16 @@ Usage:
|
|||||||
import argparse
|
import argparse
|
||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
from typing import Optional
|
|
||||||
|
|
||||||
from .client import get_mlflow_client, health_check
|
from .client import get_mlflow_client, health_check
|
||||||
from .experiment_comparison import (
|
from .experiment_comparison import (
|
||||||
ExperimentAnalyzer,
|
ExperimentAnalyzer,
|
||||||
compare_experiments,
|
|
||||||
promotion_recommendation,
|
|
||||||
get_inference_performance_report,
|
get_inference_performance_report,
|
||||||
|
promotion_recommendation,
|
||||||
)
|
)
|
||||||
from .model_registry import (
|
from .model_registry import (
|
||||||
list_model_versions,
|
|
||||||
get_production_model,
|
|
||||||
generate_kserve_yaml,
|
generate_kserve_yaml,
|
||||||
|
list_model_versions,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -246,7 +243,8 @@ def cmd_models(args):
|
|||||||
else:
|
else:
|
||||||
print(f"Model: {args.model}")
|
print(f"Model: {args.model}")
|
||||||
for v in versions:
|
for v in versions:
|
||||||
print(f" v{v['version']} ({v['stage']}): {v['description'][:50] if v['description'] else 'No description'}")
|
desc = v["description"][:50] if v["description"] else "No description"
|
||||||
|
print(f" v{v['version']} ({v['stage']}): {desc}")
|
||||||
else:
|
else:
|
||||||
# List all models
|
# List all models
|
||||||
models = client.search_registered_models()
|
models = client.search_registered_models()
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ Provides a configured MLflow client for all integrations in the LLM workflows.
|
|||||||
Supports both in-cluster and external access patterns.
|
Supports both in-cluster and external access patterns.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
|
||||||
import logging
|
import logging
|
||||||
|
import os
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
from typing import Optional, Dict, Any
|
from typing import Any, Dict, Optional
|
||||||
|
|
||||||
import mlflow
|
import mlflow
|
||||||
from mlflow.tracking import MlflowClient
|
from mlflow.tracking import MlflowClient
|
||||||
|
|||||||
@@ -35,19 +35,15 @@ Usage:
|
|||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
|
||||||
import json
|
|
||||||
import logging
|
import logging
|
||||||
from datetime import datetime, timedelta
|
|
||||||
from typing import Optional, Dict, Any, List, Tuple, Union
|
|
||||||
from dataclasses import dataclass, field
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
from dataclasses import dataclass, field
|
||||||
|
from datetime import datetime, timedelta
|
||||||
|
from typing import Any, Dict, List, Optional, Tuple
|
||||||
|
|
||||||
import mlflow
|
from mlflow.entities import Experiment, Run
|
||||||
from mlflow.tracking import MlflowClient
|
|
||||||
from mlflow.entities import Run, Experiment
|
|
||||||
|
|
||||||
from .client import get_mlflow_client, MLflowConfig
|
from .client import get_mlflow_client
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -9,20 +9,19 @@ complement OTel metrics with MLflow experiment tracking for
|
|||||||
longer-term analysis and model comparison.
|
longer-term analysis and model comparison.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
|
||||||
import time
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
import logging
|
||||||
from typing import Optional, Dict, Any, List
|
import time
|
||||||
from dataclasses import dataclass, field
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from concurrent.futures import ThreadPoolExecutor
|
from concurrent.futures import ThreadPoolExecutor
|
||||||
|
from dataclasses import dataclass, field
|
||||||
from functools import partial
|
from functools import partial
|
||||||
|
from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
import mlflow
|
import mlflow
|
||||||
from mlflow.tracking import MlflowClient
|
from mlflow.tracking import MlflowClient
|
||||||
|
|
||||||
from .client import get_mlflow_client, ensure_experiment, MLflowConfig
|
from .client import MLflowConfig, ensure_experiment, get_mlflow_client
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -34,9 +34,9 @@ Usage in a Kubeflow Pipeline:
|
|||||||
end_mlflow_run(run_id=run_info.outputs["run_id"])
|
end_mlflow_run(run_id=run_info.outputs["run_id"])
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from kfp import dsl
|
from typing import Any, Dict, List, NamedTuple
|
||||||
from typing import Dict, Any, List, Optional, NamedTuple
|
|
||||||
|
|
||||||
|
from kfp import dsl
|
||||||
|
|
||||||
# MLflow component image with all required dependencies
|
# MLflow component image with all required dependencies
|
||||||
MLFLOW_IMAGE = "python:3.13-slim"
|
MLFLOW_IMAGE = "python:3.13-slim"
|
||||||
@@ -76,9 +76,10 @@ def create_mlflow_run(
|
|||||||
NamedTuple with run_id, experiment_id, and artifact_uri
|
NamedTuple with run_id, experiment_id, and artifact_uri
|
||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
|
from collections import namedtuple
|
||||||
|
|
||||||
import mlflow
|
import mlflow
|
||||||
from mlflow.tracking import MlflowClient
|
from mlflow.tracking import MlflowClient
|
||||||
from collections import namedtuple
|
|
||||||
|
|
||||||
# Set tracking URI
|
# Set tracking URI
|
||||||
mlflow.set_tracking_uri(mlflow_tracking_uri)
|
mlflow.set_tracking_uri(mlflow_tracking_uri)
|
||||||
@@ -248,9 +249,10 @@ def log_dict_artifact(
|
|||||||
"""
|
"""
|
||||||
import json
|
import json
|
||||||
import tempfile
|
import tempfile
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
import mlflow
|
import mlflow
|
||||||
from mlflow.tracking import MlflowClient
|
from mlflow.tracking import MlflowClient
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
mlflow.set_tracking_uri(mlflow_tracking_uri)
|
mlflow.set_tracking_uri(mlflow_tracking_uri)
|
||||||
client = MlflowClient()
|
client = MlflowClient()
|
||||||
@@ -290,8 +292,8 @@ def end_mlflow_run(
|
|||||||
The run_id
|
The run_id
|
||||||
"""
|
"""
|
||||||
import mlflow
|
import mlflow
|
||||||
from mlflow.tracking import MlflowClient
|
|
||||||
from mlflow.entities import RunStatus
|
from mlflow.entities import RunStatus
|
||||||
|
from mlflow.tracking import MlflowClient
|
||||||
|
|
||||||
mlflow.set_tracking_uri(mlflow_tracking_uri)
|
mlflow.set_tracking_uri(mlflow_tracking_uri)
|
||||||
client = MlflowClient()
|
client = MlflowClient()
|
||||||
@@ -339,9 +341,10 @@ def log_training_metrics(
|
|||||||
"""
|
"""
|
||||||
import json
|
import json
|
||||||
import tempfile
|
import tempfile
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
import mlflow
|
import mlflow
|
||||||
from mlflow.tracking import MlflowClient
|
from mlflow.tracking import MlflowClient
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
mlflow.set_tracking_uri(mlflow_tracking_uri)
|
mlflow.set_tracking_uri(mlflow_tracking_uri)
|
||||||
client = MlflowClient()
|
client = MlflowClient()
|
||||||
@@ -479,9 +482,10 @@ def log_evaluation_results(
|
|||||||
"""
|
"""
|
||||||
import json
|
import json
|
||||||
import tempfile
|
import tempfile
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
import mlflow
|
import mlflow
|
||||||
from mlflow.tracking import MlflowClient
|
from mlflow.tracking import MlflowClient
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
mlflow.set_tracking_uri(mlflow_tracking_uri)
|
mlflow.set_tracking_uri(mlflow_tracking_uri)
|
||||||
client = MlflowClient()
|
client = MlflowClient()
|
||||||
|
|||||||
@@ -36,18 +36,15 @@ Usage:
|
|||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
|
||||||
import json
|
|
||||||
import yaml
|
|
||||||
import logging
|
import logging
|
||||||
from typing import Optional, Dict, Any, List
|
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
|
from typing import Any, Dict, List, Optional
|
||||||
|
|
||||||
import mlflow
|
import mlflow
|
||||||
from mlflow.tracking import MlflowClient
|
import yaml
|
||||||
from mlflow.entities.model_registry import ModelVersion
|
from mlflow.entities.model_registry import ModelVersion
|
||||||
|
|
||||||
from .client import get_mlflow_client, MLflowConfig
|
from .client import get_mlflow_client
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -5,19 +5,17 @@ Provides a high-level interface for logging experiments, parameters,
|
|||||||
metrics, and artifacts from Kubeflow Pipeline components.
|
metrics, and artifacts from Kubeflow Pipeline components.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
|
||||||
import json
|
|
||||||
import time
|
|
||||||
import logging
|
import logging
|
||||||
from pathlib import Path
|
import os
|
||||||
from typing import Optional, Dict, Any, List, Union
|
import time
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
|
from typing import Any, Dict, Optional, Union
|
||||||
|
|
||||||
import mlflow
|
import mlflow
|
||||||
from mlflow.tracking import MlflowClient
|
from mlflow.tracking import MlflowClient
|
||||||
|
|
||||||
from .client import get_mlflow_client, ensure_experiment, MLflowConfig
|
from .client import MLflowConfig, ensure_experiment, get_mlflow_client
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
@@ -8,12 +8,12 @@ import pytest
|
|||||||
def test_package_imports() -> None:
|
def test_package_imports() -> None:
|
||||||
"""All public symbols are importable."""
|
"""All public symbols are importable."""
|
||||||
from mlflow_utils import ( # noqa: F401
|
from mlflow_utils import ( # noqa: F401
|
||||||
|
InferenceMetricsTracker,
|
||||||
MLflowConfig,
|
MLflowConfig,
|
||||||
MLflowTracker,
|
MLflowTracker,
|
||||||
InferenceMetricsTracker,
|
ensure_experiment,
|
||||||
get_mlflow_client,
|
get_mlflow_client,
|
||||||
get_tracking_uri,
|
get_tracking_uri,
|
||||||
ensure_experiment,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -48,8 +48,8 @@ def test_kfp_components_importable() -> None:
|
|||||||
|
|
||||||
def test_model_registry_importable() -> None:
|
def test_model_registry_importable() -> None:
|
||||||
from mlflow_utils.model_registry import ( # noqa: F401
|
from mlflow_utils.model_registry import ( # noqa: F401
|
||||||
register_model_for_kserve,
|
|
||||||
generate_kserve_manifest,
|
generate_kserve_manifest,
|
||||||
|
register_model_for_kserve,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user