-
Notifications
You must be signed in to change notification settings - Fork 129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DEVPROD-4573: Query hosts by Running status for Task Queue UI #7690
Conversation
globals.go
Outdated
@@ -956,11 +956,10 @@ var ( | |||
HostStarting, | |||
} | |||
|
|||
// Hosts in "initializing" status aren't actually running yet: | |||
// Hosts in "initializing" and "building" status aren't actually running yet: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not able to open the ticket because of the Jira outage, but is the context for this the idea of omitting building hosts from the task queue page? Can that query instead just use the running status? (That's the only status that's able to run tasks in this list, so its the only status we should consider). The comment as you've edited it here is false; "Building" hosts are running hosts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense, I will update this PR so the host count on the Task Queue page represents the Running status only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with nits
model/host/db.go
Outdated
@@ -232,6 +232,16 @@ func runningHostsQuery(distroID string) bson.M { | |||
return query | |||
} | |||
|
|||
// byRunningStatusQuery produces a query that returns all hosts | |||
// with the running status that belong to the given. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: missing "distro" and the end there i think
model/host/db.go
Outdated
@@ -263,6 +273,11 @@ func CountRunningHosts(ctx context.Context, distroID string) (int, error) { | |||
return num, errors.Wrap(err, "counting running hosts") | |||
} | |||
|
|||
func CountRunningStatusHosts(ctx context.Context, distroID string) (int, error) { | |||
num, err := Count(ctx, byRunningStatusQuery(distroID)) | |||
return num, errors.Wrap(err, "counting Running status hosts") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: shouldn't capitalize running
DEVPROD-4573
Description
These queries hosts by the running status for the Task Queue UI host count. Originally, the hostCount considered hosts with any of these statuses but now it only considers
running
.