MLPlatform/example/example_experiment_list.py

34 lines
1.1 KiB
Python

from function.model_manager import ModelManager
# 创建模型管理器实例
manager = ModelManager()
# 获取实验列表
result = manager.get_experiments(
page=2,
page_size=10,
include_deleted=False
)
# 打印结果
print("\nMLFlow实验列表:")
print(f"状态: {result['status']}")
if result['status'] == 'success':
print(f"\n总数: {result['total_count']}")
print(f"当前页: {result['page']}")
print(f"每页数量: {result['page_size']}")
print("\n实验列表:")
for exp in result['experiments']:
print(f"\n实验ID: {exp['experiment_id']}")
print(f"名称: {exp['name']}")
print(f"存储位置: {exp['artifact_location']}")
print(f"状态: {exp['lifecycle_stage']}")
print(f"创建时间: {exp['creation_time']}")
print(f"最后更新: {exp['last_update_time']}")
print(f"运行次数: {exp['runs_count']}")
if exp['tags']:
print("标签:")
for tag_name, tag_value in exp['tags'].items():
print(f" {tag_name}: {tag_value}")
else:
print(f"错误信息: {result['message']}")