Merge branch 'master' of github.com:ClusterCockpit/cc-backend

This commit is contained in:
Lou Knauer 2022-02-16 09:33:35 +01:00
commit dd5d5214d7
3 changed files with 16 additions and 2 deletions

View File

@ -51,7 +51,12 @@ func (r *Resolver) Init() error {
} }
// Helper function for the `jobs` GraphQL-Query. Is also used elsewhere when a list of jobs is needed. // Helper function for the `jobs` GraphQL-Query. Is also used elsewhere when a list of jobs is needed.
func (r *Resolver) queryJobs(ctx context.Context, filters []*model.JobFilter, page *model.PageRequest, order *model.OrderByInput) ([]*schema.Job, int, error) { func (r *Resolver) queryJobs(
ctx context.Context,
filters []*model.JobFilter,
page *model.PageRequest,
order *model.OrderByInput) ([]*schema.Job, int, error) {
query := sq.Select(schema.JobColumns...).From("job") query := sq.Select(schema.JobColumns...).From("job")
query = securityCheck(ctx, query) query = securityCheck(ctx, query)

View File

@ -65,7 +65,9 @@ func LoadData(job *schema.Job, metrics []string, scopes []schema.MetricScope, ct
data := cache.Get(cacheKey(job, metrics, scopes), func() (interface{}, time.Duration, int) { data := cache.Get(cacheKey(job, metrics, scopes), func() (interface{}, time.Duration, int) {
var jd schema.JobData var jd schema.JobData
var err error var err error
if job.State == schema.JobStateRunning || job.MonitoringStatus == schema.MonitoringStatusRunningOrArchiving || !useArchive { if job.State == schema.JobStateRunning ||
job.MonitoringStatus == schema.MonitoringStatusRunningOrArchiving ||
!useArchive {
repo, ok := metricDataRepos[job.Cluster] repo, ok := metricDataRepos[job.Cluster]
if !ok { if !ok {
return fmt.Errorf("no metric data repository configured for '%s'", job.Cluster), 0, 0 return fmt.Errorf("no metric data repository configured for '%s'", job.Cluster), 0, 0

View File

@ -96,6 +96,13 @@ func (r *JobRepository) Stop(
return return
} }
// func (r *JobRepository) Query(
// filters []*model.JobFilter,
// page *model.PageRequest,
// order *model.OrderByInput) ([]*schema.Job, int, error) {
// }
func (r *JobRepository) UpdateMonitoringStatus(job int64, monitoringStatus int32) (err error) { func (r *JobRepository) UpdateMonitoringStatus(job int64, monitoringStatus int32) (err error) {
stmt := sq.Update("job"). stmt := sq.Update("job").
Set("monitoring_status", monitoringStatus). Set("monitoring_status", monitoringStatus).