Skip to content

[slice] Refactor OwnerPodsFinished#1172

Open
pajakd wants to merge 1 commit intoAI-Hypercomputer:slice-mainfrom
pajakd:refactor_podsfinished
Open

[slice] Refactor OwnerPodsFinished#1172
pajakd wants to merge 1 commit intoAI-Hypercomputer:slice-mainfrom
pajakd:refactor_podsfinished

Conversation

@pajakd
Copy link
Copy Markdown
Collaborator

@pajakd pajakd commented Apr 8, 2026

Description

Instead of having 3 functions jobSetPodsFinished, jobPodsFinished and lwsPodsFinished lets have a single one that receives the owner kind and reference as an argument.

Issue

Testing

ownerObj = &jobset.JobSet{}
podLabelKey = jobset.JobSetNameKey
logKey = "jobSet"
ownerKind = "JobSet"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we use a constants from the JobSet API?

} else if utilworkload.IsJobOwner(wl) {
owner = metav1.GetControllerOf(wl)
ownerObj = &batchv1.Job{}
podLabelKey = "batch.kubernetes.io/job-name"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we use a constant here?

if err := r.client.List(ctx, pods, opts...); err != nil {
log.Error(err, "Failed to get Pods")
return false, err
if utilworkload.IsJobSetOwner(wl) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It just a nit but I believe in Go it's a good practice to use switch-case statements in such cases

@PBundyra
Copy link
Copy Markdown
Collaborator

PBundyra commented Apr 8, 2026

Besides just a few nits, LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants