forked from xiaohei/taiji-AI-PAD
更新资源积分
This commit is contained in:
@@ -3341,9 +3341,19 @@ async def list_platform_agent_allocations(
|
||||
|
||||
result = await db.execute(query)
|
||||
|
||||
# 查询所有模板配置,用于获取管理员设置的CPU和内存
|
||||
template_configs_result = await db.execute(select(PlatformAgentTemplateConfig))
|
||||
template_configs = {config.template_name: config for config in template_configs_result.scalars().all()}
|
||||
|
||||
data = []
|
||||
for quota, channel in result.all():
|
||||
display_info = TEMPLATE_DISPLAY_INFO.get(quota.template_name, {})
|
||||
|
||||
# 从模板配置中获取管理员设置的CPU和内存限制
|
||||
template_config = template_configs.get(quota.template_name)
|
||||
cpu_limit = template_config.cpu_limit if template_config and template_config.cpu_limit else "100m"
|
||||
memory_limit = template_config.memory_limit if template_config and template_config.memory_limit else "256Mi"
|
||||
|
||||
data.append({
|
||||
"id": str(quota.id),
|
||||
"channelId": str(quota.target_id),
|
||||
@@ -3353,6 +3363,8 @@ async def list_platform_agent_allocations(
|
||||
"podQuota": quota.pod_quota,
|
||||
"podUsed": quota.pod_used,
|
||||
"podRemaining": quota.pod_quota - quota.pod_used,
|
||||
"cpuLimit": cpu_limit,
|
||||
"memoryLimit": memory_limit,
|
||||
"allocatedAt": quota.allocated_at.isoformat() if quota.allocated_at else None,
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user