mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2025-06-08 00:23:48 +02:00
Fix bug with job columns
This commit is contained in:
parent
f14bdb3068
commit
8d6ae85b0d
@ -51,25 +51,30 @@ func GetJobRepository() *JobRepository {
|
|||||||
return jobRepoInstance
|
return jobRepoInstance
|
||||||
}
|
}
|
||||||
|
|
||||||
// var jobColumns []string = []string{
|
|
||||||
// "job.id", "job.job_id", "job.hpc_user", "job.project", "job.cluster", "job.subcluster", "job.start_time", "job.cluster_partition", "job.array_job_id",
|
|
||||||
// "job.num_nodes", "job.num_hwthreads", "job.num_acc", "job.exclusive", "job.monitoring_status", "job.smt", "job.job_state",
|
|
||||||
// "job.duration", "job.walltime", "job.resources", "job.footprint", "job.energy",
|
|
||||||
// }
|
|
||||||
|
|
||||||
var jobColumns []string = []string{
|
var jobColumns []string = []string{
|
||||||
"id", "job_id", "hpc_user", "project", "cluster", "subcluster", "start_time",
|
"job.id", "job.job_id", "job.hpc_user", "job.project", "job.cluster", "job.subcluster",
|
||||||
"cluster_partition", "array_job_id", "num_nodes", "num_hwthreads", "num_acc",
|
"job.start_time", "job.cluster_partition", "job.array_job_id", "job.num_nodes",
|
||||||
"exclusive", "monitoring_status", "smt", "job_state", "duration", "walltime",
|
"job.num_hwthreads", "job.num_acc", "job.exclusive", "job.monitoring_status",
|
||||||
"resources", "footprint", "energy",
|
"job.smt", "job.job_state", "job.duration", "job.walltime", "job.resources",
|
||||||
|
"job.footprint", "job.energy",
|
||||||
|
}
|
||||||
|
|
||||||
|
var jobCacheColumns []string = []string{
|
||||||
|
"jobcache.id", "jobcache.job_id", "jobcache.hpc_user", "jobcache.project", "jobcache.cluster",
|
||||||
|
"jobcache.subcluster", "jobcache.start_time", "jobcache.cluster_partition",
|
||||||
|
"jobcache.array_job_id", "jobcache.num_nodes", "jobcache.num_hwthreads",
|
||||||
|
"jobcache.num_acc", "jobcache.exclusive", "jobcache.monitoring_status", "jobcache.smt",
|
||||||
|
"jobcache.job_state", "jobcache.duration", "jobcache.walltime", "jobcache.resources",
|
||||||
|
"jobcache.footprint", "jobcache.energy",
|
||||||
}
|
}
|
||||||
|
|
||||||
func scanJob(row interface{ Scan(...any) error }) (*schema.Job, error) {
|
func scanJob(row interface{ Scan(...any) error }) (*schema.Job, error) {
|
||||||
job := &schema.Job{}
|
job := &schema.Job{}
|
||||||
|
|
||||||
if err := row.Scan(
|
if err := row.Scan(
|
||||||
&job.ID, &job.JobID, &job.User, &job.Project, &job.Cluster, &job.SubCluster, &job.StartTimeUnix, &job.Partition, &job.ArrayJobId,
|
&job.ID, &job.JobID, &job.User, &job.Project, &job.Cluster, &job.SubCluster,
|
||||||
&job.NumNodes, &job.NumHWThreads, &job.NumAcc, &job.Exclusive, &job.MonitoringStatus, &job.SMT, &job.State,
|
&job.StartTimeUnix, &job.Partition, &job.ArrayJobId, &job.NumNodes, &job.NumHWThreads,
|
||||||
|
&job.NumAcc, &job.Exclusive, &job.MonitoringStatus, &job.SMT, &job.State,
|
||||||
&job.Duration, &job.Walltime, &job.RawResources, &job.RawFootprint, &job.Energy); err != nil {
|
&job.Duration, &job.Walltime, &job.RawResources, &job.RawFootprint, &job.Energy); err != nil {
|
||||||
log.Warnf("Error while scanning rows (Job): %v", err)
|
log.Warnf("Error while scanning rows (Job): %v", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -50,7 +50,7 @@ func (r *JobRepository) SyncJobs() ([]*schema.Job, error) {
|
|||||||
r.Mutex.Lock()
|
r.Mutex.Lock()
|
||||||
defer r.Mutex.Unlock()
|
defer r.Mutex.Unlock()
|
||||||
|
|
||||||
query := sq.Select(jobColumns...).From("job_cache")
|
query := sq.Select(jobCacheColumns...).From("job_cache")
|
||||||
|
|
||||||
rows, err := query.RunWith(r.stmtCache).Query()
|
rows, err := query.RunWith(r.stmtCache).Query()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -48,7 +48,7 @@ func (r *JobRepository) FindCached(
|
|||||||
cluster *string,
|
cluster *string,
|
||||||
startTime *int64,
|
startTime *int64,
|
||||||
) (*schema.Job, error) {
|
) (*schema.Job, error) {
|
||||||
q := sq.Select(jobColumns...).From("job_cache").
|
q := sq.Select(jobCacheColumns...).From("job_cache").
|
||||||
Where("job_cache.job_id = ?", *jobId)
|
Where("job_cache.job_id = ?", *jobId)
|
||||||
|
|
||||||
if cluster != nil {
|
if cluster != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user