-
Notifications
You must be signed in to change notification settings - Fork 136
Make batch workloads first-class #1098
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
Open
nadaverell
wants to merge
7
commits into
main
Choose a base branch
from
execution-run-logs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
617df7c
Add run-aware logs for jobs and workflows
nadaverell c353074
Make batch workloads first-class
nadaverell edc8755
Deepen batch execution UX
nadaverell 45ba20e
Clarify batch run hierarchy
nadaverell 1844cfa
Clarify direct batch run views
nadaverell 1b109f0
Keep batch logs in logs tab
nadaverell 0b76739
Focus application workload drill-in
nadaverell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| package mcp | ||
|
|
||
| import ( | ||
| "strings" | ||
| "testing" | ||
|
|
||
| batchv1 "k8s.io/api/batch/v1" | ||
| corev1 "k8s.io/api/core/v1" | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| ) | ||
|
|
||
| func TestApplyMCPTerminalJobEmptyState(t *testing.T) { | ||
| metadata := mcpWorkloadLogEmptyMetadata{ | ||
| Reason: "no-pods", | ||
| Message: "No pods found for this Job yet.", | ||
| Command: "kubectl logs job/nightly -n ci", | ||
| } | ||
| job := &batchv1.Job{ | ||
| Status: batchv1.JobStatus{ | ||
| Conditions: []batchv1.JobCondition{ | ||
| { | ||
| Type: batchv1.JobComplete, | ||
| Status: corev1.ConditionTrue, | ||
| }, | ||
| }, | ||
| }, | ||
| } | ||
|
|
||
| applyMCPTerminalJobEmptyState(&metadata, job, "ci", "nightly") | ||
|
|
||
| if metadata.Reason != "pods-gone" { | ||
| t.Fatalf("Reason = %q, want pods-gone", metadata.Reason) | ||
| } | ||
| if !strings.Contains(metadata.Message, "finished") || !strings.Contains(metadata.Message, "kubectl logs job/nightly -n ci") { | ||
| t.Fatalf("Message = %q, want terminal kubectl guidance", metadata.Message) | ||
| } | ||
| if metadata.Command != "kubectl logs job/nightly -n ci" { | ||
| t.Fatalf("Command = %q", metadata.Command) | ||
| } | ||
| } | ||
|
|
||
| func TestApplyMCPTerminalWorkflowEmptyStateWithArchiveLogs(t *testing.T) { | ||
| metadata := mcpWorkloadLogEmptyMetadata{ | ||
| Reason: "no-pods", | ||
| Message: "No Workflow pods found yet.", | ||
| Command: "argo logs nightly -n ci", | ||
| } | ||
| workflow := map[string]any{ | ||
| "status": map[string]any{ | ||
| "phase": "Succeeded", | ||
| }, | ||
| "spec": map[string]any{ | ||
| "archiveLogs": true, | ||
| }, | ||
| } | ||
|
|
||
| applyMCPTerminalWorkflowEmptyState(&metadata, workflow, "ci", "nightly") | ||
|
|
||
| if metadata.Reason != "pods-gone" { | ||
| t.Fatalf("Reason = %q, want pods-gone", metadata.Reason) | ||
| } | ||
| if !strings.Contains(metadata.Message, "Archived logs") || !strings.Contains(metadata.Message, "argo logs nightly -n ci") { | ||
| t.Fatalf("Message = %q, want archived-log guidance", metadata.Message) | ||
| } | ||
| if metadata.Command != "argo logs nightly -n ci" { | ||
| t.Fatalf("Command = %q", metadata.Command) | ||
| } | ||
| } | ||
|
|
||
| func TestMCPJobConditionIgnoresRetryCounters(t *testing.T) { | ||
| job := &batchv1.Job{ | ||
| ObjectMeta: metav1.ObjectMeta{ | ||
| Name: "retrying", | ||
| Namespace: "ci", | ||
| }, | ||
| Status: batchv1.JobStatus{ | ||
| Failed: 1, | ||
| }, | ||
| } | ||
|
|
||
| if _, ok := mcpJobCondition(job, batchv1.JobFailed); ok { | ||
| t.Fatal("mcpJobCondition treated failed counter as terminal condition") | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Job logs require pod selector
Medium Severity
Job workload logs resolve pods only via
job.spec.selectorand error when it is nil. Pods for a Job are routinely labeled withbatch.kubernetes.io/job-name(as elsewhere in this repo for hook Jobs), so logs can fail whilekubectl logs job/...still works.Reviewed by Cursor Bugbot for commit 617df7c. Configure here.