mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-25 12:59:06 +01:00
Initial attempt to update footprints in transaction
This commit is contained in:
parent
e267481f71
commit
508978d586
@ -24,7 +24,8 @@ func ArchiveJob(job *schema.Job, ctx context.Context) (*schema.JobMeta, error) {
|
||||
}
|
||||
|
||||
scopes := []schema.MetricScope{schema.MetricScopeNode}
|
||||
if job.NumNodes <= 8 { // FIXME: Add a config option for this
|
||||
// FIXME: Add a config option for this
|
||||
if job.NumNodes <= 8 {
|
||||
// This will add the native scope if core scope is not available
|
||||
scopes = append(scopes, schema.MetricScopeCore)
|
||||
}
|
||||
|
@ -25,6 +25,12 @@ func RegisterFootprintWorker() {
|
||||
func() {
|
||||
s := time.Now()
|
||||
log.Printf("Update Footprints started at %s", s.Format(time.RFC3339))
|
||||
|
||||
t, err := jobRepo.TransactionInit()
|
||||
if err != nil {
|
||||
log.Errorf("Failed TransactionInit %v", err)
|
||||
}
|
||||
|
||||
for _, cluster := range archive.Clusters {
|
||||
jobs, err := jobRepo.FindRunningJobs(cluster.Name)
|
||||
if err != nil {
|
||||
@ -87,12 +93,22 @@ func RegisterFootprintWorker() {
|
||||
log.Errorf("Update job (dbid: %d) failed at update Energy step: %s", job.ID, err.Error())
|
||||
continue
|
||||
}
|
||||
if err := jobRepo.Execute(stmt); err != nil {
|
||||
log.Errorf("Update job (dbid: %d) failed at db execute: %s", job.ID, err.Error())
|
||||
|
||||
query, args, err := stmt.ToSql()
|
||||
if err != nil {
|
||||
log.Errorf("Failed in ToSQL conversion %v", err)
|
||||
continue
|
||||
}
|
||||
jobRepo.TransactionAdd(t, query, args)
|
||||
// if err := jobRepo.Execute(stmt); err != nil {
|
||||
// log.Errorf("Update job (dbid: %d) failed at db execute: %s", job.ID, err.Error())
|
||||
// continue
|
||||
// }
|
||||
}
|
||||
|
||||
jobRepo.TransactionCommit(t)
|
||||
}
|
||||
jobRepo.TransactionEnd(t)
|
||||
log.Printf("Update Footprints is done and took %s", time.Since(s))
|
||||
}))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user