@@ -35,7 +35,7 @@ func (r ResourceSpecification) ConvertToRes() *ResourceSpecificationRes { | |||||
SourceSpecId: r.SourceSpecId, | SourceSpecId: r.SourceSpecId, | ||||
AccCardsNum: r.AccCardsNum, | AccCardsNum: r.AccCardsNum, | ||||
CpuCores: r.CpuCores, | CpuCores: r.CpuCores, | ||||
MemGiB: r.GPUMemGiB, | |||||
MemGiB: r.MemGiB, | |||||
ShareMemGiB: r.ShareMemGiB, | ShareMemGiB: r.ShareMemGiB, | ||||
GPUMemGiB: r.GPUMemGiB, | GPUMemGiB: r.GPUMemGiB, | ||||
UnitPrice: r.UnitPrice, | UnitPrice: r.UnitPrice, | ||||
@@ -5,6 +5,7 @@ | |||||
package cron | package cron | ||||
import ( | import ( | ||||
"code.gitea.io/gitea/services/cloudbrain/resource" | |||||
"context" | "context" | ||||
"time" | "time" | ||||
@@ -207,6 +208,17 @@ func registerSyncCloudbrainStatus() { | |||||
}) | }) | ||||
} | } | ||||
func registerSyncResourceSpecs() { | |||||
RegisterTaskFatal("sync_grampus_specs", &BaseConfig{ | |||||
Enabled: true, | |||||
RunAtStart: true, | |||||
Schedule: "0 0 1 * * ?", | |||||
}, func(ctx context.Context, _ *models.User, _ Config) error { | |||||
resource.SyncGrampusQueueAndSpecs() | |||||
return nil | |||||
}) | |||||
} | |||||
func initBasicTasks() { | func initBasicTasks() { | ||||
registerUpdateMirrorTask() | registerUpdateMirrorTask() | ||||
registerRepoHealthCheck() | registerRepoHealthCheck() | ||||
@@ -227,4 +239,5 @@ func initBasicTasks() { | |||||
registerSyncCloudbrainStatus() | registerSyncCloudbrainStatus() | ||||
registerHandleOrgStatistic() | registerHandleOrgStatistic() | ||||
registerSyncResourceSpecs() | |||||
} | } |
@@ -102,6 +102,10 @@ func SyncGrampusQueue(doerId int64) error { | |||||
} | } | ||||
} | } | ||||
//todo 调试两个虎鲸接口,注意批量update是否有问题。确定上架时有没有检查queue是否被删除 | |||||
return models.SyncGrampusQueues(queueUpdateList, queueInsertList, existIds) | return models.SyncGrampusQueues(queueUpdateList, queueInsertList, existIds) | ||||
} | } | ||||
func SyncGrampusQueueAndSpecs() { | |||||
SyncGrampusQueue(0) | |||||
SyncGrampusSpecs(0) | |||||
} |