mlflow-tclake-plugin 2.1.7.dev2__tar.gz → 2.1.7.dev5__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mlflow-tclake-plugin
3
- Version: 2.1.7.dev2
3
+ Version: 2.1.7.dev5
4
4
  Summary: Tclake plugin for MLflow
5
5
  License-File: LICENSE.txt
6
6
  Requires-Dist: mlflow==2.17.2
@@ -71,6 +71,9 @@ TCLAKE_MLFLOW_MODEL_SIGNATURE_KEY = "tclake.mlflow.model_signature"
71
71
  TCLAKE_WEDATA_PROJECT_ID_KEY = "wedata.project"
72
72
  TCLAKE_MLFLOW_MODEL_ARTIFACT_PATH_KEY = "tclake.mlflow.artifact_path"
73
73
  WEDATA_DATASCIENCE_TYPE = "wedata.datascience.type"
74
+ # 这些内置 key 在写入侧被存成无前缀属性(见 _add_tags_to_properties /
75
+ # _add_project_id_to_properties),读回时需要一并还原成 tag,否则调用方拿不到。
76
+ UNPREFIXED_BUILTIN_TAG_KEYS = (WEDATA_DATASCIENCE_TYPE, TCLAKE_WEDATA_PROJECT_ID_KEY)
74
77
 
75
78
 
76
79
  def _set_kv_to_properties(key, value, properties=None):
@@ -216,9 +219,19 @@ def _get_tags_from_properties(properties):
216
219
  if properties is None:
217
220
  return None
218
221
  tags = []
222
+ seen_keys = set()
223
+ # 优先取带前缀的属性:调用方通过 tags 参数显式写入的值
219
224
  for p in properties:
220
225
  if p["Key"].startswith(TCLAKE_MLFLOW_TAG_PREFIX):
221
- tags.append(ModelVersionTag(p["Key"][len(TCLAKE_MLFLOW_TAG_PREFIX):], p["Value"]))
226
+ tag_key = p["Key"][len(TCLAKE_MLFLOW_TAG_PREFIX):]
227
+ if tag_key not in seen_keys:
228
+ seen_keys.add(tag_key)
229
+ tags.append(ModelVersionTag(tag_key, p["Value"]))
230
+ # 再补无前缀存储的内置 key,已由带前缀属性覆盖的不重复添加
231
+ for p in properties:
232
+ if p["Key"] in UNPREFIXED_BUILTIN_TAG_KEYS and p["Key"] not in seen_keys:
233
+ seen_keys.add(p["Key"])
234
+ tags.append(ModelVersionTag(p["Key"], p["Value"]))
222
235
  return tags
223
236
 
224
237
 
@@ -253,6 +266,8 @@ def _get_model_version_name(entity):
253
266
  def _make_model_version(entity, name):
254
267
  properties = entity["Properties"]
255
268
  audit = entity["Audit"]
269
+ # 部分接口响应可能不含 Aliases 字段,缺失时按空列表处理
270
+ aliases = entity.get("Aliases") or []
256
271
  return ModelVersion(
257
272
  name=name,
258
273
  version=_get_model_version(entity["Version"]),
@@ -263,6 +278,7 @@ def _make_model_version(entity, name):
263
278
  run_id=_get_run_id_from_properties(properties),
264
279
  tags=_get_tags_from_properties(properties),
265
280
  run_link=_get_run_link_from_properties(properties),
281
+ aliases=aliases,
266
282
  status="READY",
267
283
  )
268
284
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mlflow-tclake-plugin
3
- Version: 2.1.7.dev2
3
+ Version: 2.1.7.dev5
4
4
  Summary: Tclake plugin for MLflow
5
5
  License-File: LICENSE.txt
6
6
  Requires-Dist: mlflow==2.17.2
@@ -2,7 +2,7 @@ from setuptools import find_packages, setup
2
2
 
3
3
  setup(
4
4
  name="mlflow-tclake-plugin",
5
- version="2.1.7.dev2",
5
+ version="2.1.7.dev5",
6
6
  description="Tclake plugin for MLflow",
7
7
  packages=find_packages(),
8
8
  # Require MLflow as a dependency of the plugin, so that plugin users can simply install