Skip to content
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

[ui] Fix: Wildcard-datacenter system/sysbatch jobs stopped showing client links/chart #16274

Conversation

philrenaud
Copy link
Contributor

@philrenaud philrenaud commented Feb 28, 2023

Will now return all clients when datacenters = ["*"], relevant clients when ["dc*"], etc. Otherwise will use the same filter as before.

image

@github-actions
Copy link

github-actions bot commented Feb 28, 2023

Ember Asset Size action

As of 9d2f67b

Files that got Bigger 🚨:

File raw gzip
nomad-ui.js +197 B +16 B

Files that stayed the same size 🤷‍:

File raw gzip
vendor.js 0 B 0 B
nomad-ui.css 0 B 0 B
vendor.css 0 B 0 B

@@ -26,7 +26,10 @@ export default function jobClientStatus(nodesKey, jobKey) {

// Filter nodes by the datacenters defined in the job.
const filteredNodes = nodes.filter((n) => {
return job.datacenters.indexOf(n.datacenter) >= 0;
return (
job.datacenters.includes('*') ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* in datacenters is not like namespace, where * is a special wildcard to match all. In datacenters it's actually a glob pattern so, for example, datacenters = ["dc*"] would match dc1 and dc2 but not us-east-1. This check would return all clients, even the ones not matched by the pattern

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh thanks for keeping an eye out. I'll update to match on glob.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to @lgfa29 -- you probably want to extract the logic from _doesMatchPattern into a utility and use it here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, that looks pretty good! If you need some test cases to match with the Go implementation:
https://github.com/ryanuber/go-glob/blob/master/glob_test.go

@github-actions
Copy link

github-actions bot commented Feb 28, 2023

Ember Test Audit comparison

main 9d2f67b change
passes 1467 1485 +18
failures 0 0 0
flaky 0 0 0
duration 10m 53s 772ms 11m 57s 940ms +1m 04s 168ms

@@ -26,7 +26,10 @@ export default function jobClientStatus(nodesKey, jobKey) {

// Filter nodes by the datacenters defined in the job.
const filteredNodes = nodes.filter((n) => {
return job.datacenters.indexOf(n.datacenter) >= 0;
return (
job.datacenters.includes('*') ||
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 to @lgfa29 -- you probably want to extract the logic from _doesMatchPattern into a utility and use it here.

@philrenaud philrenaud force-pushed the 16270-ui-job-status-in-client-panel-always-shows-all-zero-data-when-datacenters-= branch from 51e2248 to df68c96 Compare March 3, 2023 19:03
Copy link
Contributor

@ChaiWithJai ChaiWithJai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. There's a large block of commented code that should be removed.

@philrenaud philrenaud force-pushed the 16270-ui-job-status-in-client-panel-always-shows-all-zero-data-when-datacenters-= branch from 9e57b1f to 9d2f67b Compare March 6, 2023 14:42
@philrenaud philrenaud added the backport/1.5.x backport to 1.5.x release line label Mar 6, 2023
@philrenaud philrenaud merged commit a57f97e into main Mar 6, 2023
@philrenaud philrenaud deleted the 16270-ui-job-status-in-client-panel-always-shows-all-zero-data-when-datacenters-= branch March 6, 2023 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/1.5.x backport to 1.5.x release line
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[UI] "Job Status in Client" panel always shows all zero data when datacenters = ["*"]
3 participants