expops 0.1.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- expops-0.1.3.dist-info/METADATA +826 -0
- expops-0.1.3.dist-info/RECORD +86 -0
- expops-0.1.3.dist-info/WHEEL +5 -0
- expops-0.1.3.dist-info/entry_points.txt +3 -0
- expops-0.1.3.dist-info/licenses/LICENSE +674 -0
- expops-0.1.3.dist-info/top_level.txt +1 -0
- mlops/__init__.py +0 -0
- mlops/__main__.py +11 -0
- mlops/_version.py +34 -0
- mlops/adapters/__init__.py +12 -0
- mlops/adapters/base.py +86 -0
- mlops/adapters/config_schema.py +89 -0
- mlops/adapters/custom/__init__.py +3 -0
- mlops/adapters/custom/custom_adapter.py +447 -0
- mlops/adapters/plugin_manager.py +113 -0
- mlops/adapters/sklearn/__init__.py +3 -0
- mlops/adapters/sklearn/adapter.py +94 -0
- mlops/cluster/__init__.py +3 -0
- mlops/cluster/controller.py +496 -0
- mlops/cluster/process_runner.py +91 -0
- mlops/cluster/providers.py +258 -0
- mlops/core/__init__.py +95 -0
- mlops/core/custom_model_base.py +38 -0
- mlops/core/dask_networkx_executor.py +1265 -0
- mlops/core/executor_worker.py +1239 -0
- mlops/core/experiment_tracker.py +81 -0
- mlops/core/graph_types.py +64 -0
- mlops/core/networkx_parser.py +135 -0
- mlops/core/payload_spill.py +278 -0
- mlops/core/pipeline_utils.py +162 -0
- mlops/core/process_hashing.py +216 -0
- mlops/core/step_state_manager.py +1298 -0
- mlops/core/step_system.py +956 -0
- mlops/core/workspace.py +99 -0
- mlops/environment/__init__.py +10 -0
- mlops/environment/base.py +43 -0
- mlops/environment/conda_manager.py +307 -0
- mlops/environment/factory.py +70 -0
- mlops/environment/pyenv_manager.py +146 -0
- mlops/environment/setup_env.py +31 -0
- mlops/environment/system_manager.py +66 -0
- mlops/environment/utils.py +105 -0
- mlops/environment/venv_manager.py +134 -0
- mlops/main.py +527 -0
- mlops/managers/project_manager.py +400 -0
- mlops/managers/reproducibility_manager.py +575 -0
- mlops/platform.py +996 -0
- mlops/reporting/__init__.py +16 -0
- mlops/reporting/context.py +187 -0
- mlops/reporting/entrypoint.py +292 -0
- mlops/reporting/kv_utils.py +77 -0
- mlops/reporting/registry.py +50 -0
- mlops/runtime/__init__.py +9 -0
- mlops/runtime/context.py +34 -0
- mlops/runtime/env_export.py +113 -0
- mlops/storage/__init__.py +12 -0
- mlops/storage/adapters/__init__.py +9 -0
- mlops/storage/adapters/gcp_kv_store.py +778 -0
- mlops/storage/adapters/gcs_object_store.py +96 -0
- mlops/storage/adapters/memory_store.py +240 -0
- mlops/storage/adapters/redis_store.py +438 -0
- mlops/storage/factory.py +199 -0
- mlops/storage/interfaces/__init__.py +6 -0
- mlops/storage/interfaces/kv_store.py +118 -0
- mlops/storage/path_utils.py +38 -0
- mlops/templates/premier-league/charts/plot_metrics.js +70 -0
- mlops/templates/premier-league/charts/plot_metrics.py +145 -0
- mlops/templates/premier-league/charts/requirements.txt +6 -0
- mlops/templates/premier-league/configs/cluster_config.yaml +13 -0
- mlops/templates/premier-league/configs/project_config.yaml +207 -0
- mlops/templates/premier-league/data/England CSV.csv +12154 -0
- mlops/templates/premier-league/models/premier_league_model.py +638 -0
- mlops/templates/premier-league/requirements.txt +8 -0
- mlops/templates/sklearn-basic/README.md +22 -0
- mlops/templates/sklearn-basic/charts/plot_metrics.py +85 -0
- mlops/templates/sklearn-basic/charts/requirements.txt +3 -0
- mlops/templates/sklearn-basic/configs/project_config.yaml +64 -0
- mlops/templates/sklearn-basic/data/train.csv +14 -0
- mlops/templates/sklearn-basic/models/model.py +62 -0
- mlops/templates/sklearn-basic/requirements.txt +10 -0
- mlops/web/__init__.py +3 -0
- mlops/web/server.py +585 -0
- mlops/web/ui/index.html +52 -0
- mlops/web/ui/mlops-charts.js +357 -0
- mlops/web/ui/script.js +1244 -0
- mlops/web/ui/styles.css +248 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import json
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from typing import Any, Dict, Optional
|
|
6
|
+
|
|
7
|
+
from mlops.core.workspace import resolve_relative_path
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def export_kv_env(
|
|
11
|
+
backend_cfg: dict[str, Any] | None,
|
|
12
|
+
*,
|
|
13
|
+
workspace_root: Optional[Path] = None,
|
|
14
|
+
project_root: Optional[Path] = None,
|
|
15
|
+
) -> dict[str, str]:
|
|
16
|
+
"""Return environment variables required for the configured KV backend.
|
|
17
|
+
|
|
18
|
+
This is used at process boundaries (chart subprocesses, cluster submissions, etc.).
|
|
19
|
+
"""
|
|
20
|
+
if not isinstance(backend_cfg, dict):
|
|
21
|
+
return {}
|
|
22
|
+
|
|
23
|
+
env: dict[str, str] = {}
|
|
24
|
+
typ = str(backend_cfg.get("type") or "").strip().lower()
|
|
25
|
+
if not typ:
|
|
26
|
+
return env
|
|
27
|
+
|
|
28
|
+
if typ in {"memory", "inmemory", "in-memory", "mem"}:
|
|
29
|
+
env["MLOPS_KV_BACKEND"] = "memory"
|
|
30
|
+
return env
|
|
31
|
+
|
|
32
|
+
if typ == "redis":
|
|
33
|
+
env["MLOPS_KV_BACKEND"] = "redis"
|
|
34
|
+
if backend_cfg.get("host") is not None:
|
|
35
|
+
env["MLOPS_REDIS_HOST"] = str(backend_cfg.get("host"))
|
|
36
|
+
if backend_cfg.get("port") is not None:
|
|
37
|
+
env["MLOPS_REDIS_PORT"] = str(backend_cfg.get("port"))
|
|
38
|
+
if backend_cfg.get("db") is not None:
|
|
39
|
+
env["MLOPS_REDIS_DB"] = str(backend_cfg.get("db"))
|
|
40
|
+
if backend_cfg.get("password") is not None:
|
|
41
|
+
env["MLOPS_REDIS_PASSWORD"] = str(backend_cfg.get("password"))
|
|
42
|
+
return env
|
|
43
|
+
|
|
44
|
+
if typ == "gcp":
|
|
45
|
+
env["MLOPS_KV_BACKEND"] = "gcp"
|
|
46
|
+
if backend_cfg.get("gcp_project") is not None:
|
|
47
|
+
env["GOOGLE_CLOUD_PROJECT"] = str(backend_cfg.get("gcp_project"))
|
|
48
|
+
if backend_cfg.get("emulator_host") is not None:
|
|
49
|
+
env["FIRESTORE_EMULATOR_HOST"] = str(backend_cfg.get("emulator_host"))
|
|
50
|
+
|
|
51
|
+
creds = backend_cfg.get("credentials_json")
|
|
52
|
+
if creds:
|
|
53
|
+
try:
|
|
54
|
+
p = resolve_relative_path(
|
|
55
|
+
str(creds),
|
|
56
|
+
project_root=project_root,
|
|
57
|
+
workspace_root=workspace_root,
|
|
58
|
+
)
|
|
59
|
+
env["GOOGLE_APPLICATION_CREDENTIALS"] = str(p)
|
|
60
|
+
except Exception:
|
|
61
|
+
env["GOOGLE_APPLICATION_CREDENTIALS"] = str(creds)
|
|
62
|
+
return env
|
|
63
|
+
|
|
64
|
+
# Unknown backend type: do not emit anything.
|
|
65
|
+
return env
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def export_run_env(run_context: Any) -> dict[str, str]:
|
|
69
|
+
"""Return a baseline env mapping for a run-scoped context."""
|
|
70
|
+
env: dict[str, str] = {}
|
|
71
|
+
|
|
72
|
+
workspace_root = getattr(run_context, "workspace_root", None)
|
|
73
|
+
project_root = getattr(run_context, "project_root", None)
|
|
74
|
+
|
|
75
|
+
if workspace_root is not None:
|
|
76
|
+
env["MLOPS_WORKSPACE_DIR"] = str(workspace_root)
|
|
77
|
+
|
|
78
|
+
project_id = getattr(run_context, "project_id", None)
|
|
79
|
+
if project_id:
|
|
80
|
+
env["MLOPS_PROJECT_ID"] = str(project_id)
|
|
81
|
+
|
|
82
|
+
run_id = getattr(run_context, "run_id", None)
|
|
83
|
+
if run_id:
|
|
84
|
+
env["MLOPS_RUN_ID"] = str(run_id)
|
|
85
|
+
|
|
86
|
+
runtime_python = getattr(run_context, "runtime_python", None)
|
|
87
|
+
if runtime_python:
|
|
88
|
+
env["MLOPS_RUNTIME_PYTHON"] = str(runtime_python)
|
|
89
|
+
|
|
90
|
+
reporting_python = getattr(run_context, "reporting_python", None)
|
|
91
|
+
if reporting_python:
|
|
92
|
+
env["MLOPS_REPORTING_PYTHON"] = str(reporting_python)
|
|
93
|
+
|
|
94
|
+
reporting_cfg = getattr(run_context, "reporting_config", None)
|
|
95
|
+
if isinstance(reporting_cfg, dict):
|
|
96
|
+
try:
|
|
97
|
+
env["MLOPS_REPORTING_CONFIG"] = json.dumps(reporting_cfg)
|
|
98
|
+
except Exception:
|
|
99
|
+
pass
|
|
100
|
+
|
|
101
|
+
backend_cfg = getattr(run_context, "cache_backend", None)
|
|
102
|
+
if isinstance(backend_cfg, dict):
|
|
103
|
+
env.update(export_kv_env(backend_cfg, workspace_root=workspace_root, project_root=project_root))
|
|
104
|
+
|
|
105
|
+
return env
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
__all__ = [
|
|
109
|
+
"export_kv_env",
|
|
110
|
+
"export_run_env",
|
|
111
|
+
]
|
|
112
|
+
|
|
113
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from .interfaces.kv_store import KeyValueEventStore, ObjectStore
|
|
4
|
+
from .path_utils import decode_probe_path, encode_probe_path
|
|
5
|
+
|
|
6
|
+
__all__ = [
|
|
7
|
+
"KeyValueEventStore",
|
|
8
|
+
"ObjectStore",
|
|
9
|
+
"encode_probe_path",
|
|
10
|
+
"decode_probe_path",
|
|
11
|
+
]
|
|
12
|
+
|