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

Verbose logging of cache and queues #1528

Merged
merged 1 commit into from
Jan 2, 2024

Conversation

alculquicondor
Copy link
Contributor

@alculquicondor alculquicondor commented Dec 28, 2023

What type of PR is this?

/kind feature

What this PR does / why we need it:

Produces a dump of the cache into the logs at log level 5.

A dump of the cache and queues can be logged on demand using SIGUSR2, regardless of the log level.

Refactored some existing dump methods used for testing to use slices for better performance and simpler formatting.

Which issue(s) this PR fixes:

Fixes #1438 #1437

Special notes for your reviewer:

Does this PR introduce a user-facing change?

At log level 6, the usage of ClusterQueues and cohorts is included in logs.

The status of the internal cache and queues is also logged on demand when a SIGUSR2 is sent to kueue, regardless of the log level.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/feature Categorizes issue or PR as related to a new feature. labels Dec 28, 2023
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Dec 28, 2023
Copy link

netlify bot commented Dec 28, 2023

Deploy Preview for kubernetes-sigs-kueue canceled.

Name Link
🔨 Latest commit aa40831
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-kueue/deploys/65942567ceceed00080e07f3

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 28, 2023
Copy link
Member

@tenzen-y tenzen-y left a comment

Choose a reason for hiding this comment

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

Generally, lgtm

}

func logSnapshotIfVerbose(log logr.Logger, s *cache.Snapshot) {
if logV := log.V(5); logV.Enabled() {
Copy link
Member

Choose a reason for hiding this comment

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

IIRC, our max log level is 6. So is it better to use V(6) here and Line 37 as well?

log.V(6).Info("The job is no longer active, clear the workloads admission")

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Change-Id: Iabd963a1dfcad8730949e945d85bef64fcd4017c
Copy link
Member

@tenzen-y tenzen-y left a comment

Choose a reason for hiding this comment

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

Thanks.
/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 2, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alculquicondor, tenzen-y

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [alculquicondor,tenzen-y]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 755a673fe5d9f86f7e1230d38cd6867928f5419f

@k8s-ci-robot k8s-ci-robot merged commit c6e02bd into kubernetes-sigs:main Jan 2, 2024
14 checks passed
@k8s-ci-robot k8s-ci-robot added this to the v0.6 milestone Jan 2, 2024
@alculquicondor
Copy link
Contributor Author

alculquicondor commented Jan 2, 2024

Btw, this is how the dump looks:

{"level":"info","ts":"2024-01-02T19:00:43.567480487Z","logger":"dumper","caller":"debugger/debugger.go:59","msg":"Started dump"}
{"level":"info","ts":"2024-01-02T19:00:43.56753785Z","logger":"dumper","caller":"cache/snapshot.go:67","msg":"Found ClusterQueue","clusterQueue":{"name":"cluster-queue"},"cohort":"<none>","resourceGroups":[{"CoveredResources":{"cpu":{},"memory":{}},"Flavors":[{"Name":"default-flavor","Resources":{"cpu":{"Nominal":9000,"BorrowingLimit":null},"memory":{"Nominal":38654705664,"BorrowingLimit":null}}}],"LabelKeys":null}],"usage":{"default-flavor":{"cpu":3000,"memory":629145600}},"workloads":["default/job-sample-job-rphvr-2168d"]}
{"level":"info","ts":"2024-01-02T19:00:43.567775516Z","logger":"dumper","caller":"queue/dumper.go:32","msg":"Found pending and inadmissible workloads in ClusterQueue","clusterQueue":{"name":"cluster-queue"},"pending":[],"inadmissible":[]}
{"level":"info","ts":"2024-01-02T19:00:43.567789748Z","logger":"dumper","caller":"debugger/debugger.go:63","msg":"Ended dump"}

I'm preparing another PR with instructions on how to produce it.

@tenzen-y
Copy link
Member

tenzen-y commented Jan 2, 2024

Btw, this is how the dump looks:

{"level":"info","ts":"2024-01-02T19:00:43.567480487Z","logger":"dumper","caller":"debugger/debugger.go:59","msg":"Started dump"}
{"level":"info","ts":"2024-01-02T19:00:43.56753785Z","logger":"dumper","caller":"cache/snapshot.go:67","msg":"Found ClusterQueue","clusterQueue":{"name":"cluster-queue"},"cohort":"<none>","resourceGroups":[{"CoveredResources":{"cpu":{},"memory":{}},"Flavors":[{"Name":"default-flavor","Resources":{"cpu":{"Nominal":9000,"BorrowingLimit":null},"memory":{"Nominal":38654705664,"BorrowingLimit":null}}}],"LabelKeys":null}],"usage":{"default-flavor":{"cpu":3000,"memory":629145600}},"workloads":["default/job-sample-job-rphvr-2168d"]}
{"level":"info","ts":"2024-01-02T19:00:43.567775516Z","logger":"dumper","caller":"queue/dumper.go:32","msg":"Found pending and inadmissible workloads in ClusterQueue","clusterQueue":{"name":"cluster-queue"},"pending":[],"inadmissible":[]}
{"level":"info","ts":"2024-01-02T19:00:43.567789748Z","logger":"dumper","caller":"debugger/debugger.go:63","msg":"Ended dump"}

I'm preparing another PR with instructions on how to produce it.

It's great to see. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Log information about clusterqueue status during scheduling
3 participants