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

Add WaitForFinishedJobs measurement #1976

Merged
merged 1 commit into from
Jan 28, 2022

Conversation

alculquicondor
Copy link
Member

What type of PR is this?

/kind feature

What this PR does / why we need it:

Adds a WaitForCompletedJobs measurement and a placeholder test.

Which issue(s) this PR fixes:

Part of #799

kubernetes/enhancements#2214 and kubernetes/enhancements#2879

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Add measurement WaitForCompletedJobs that waits until Jobs complete or fail

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 25, 2022
@wojtek-t
Copy link
Member

/assign @tosi3k @marseel

@alculquicondor alculquicondor changed the title Add WaitForCompletedJobs measurement Add WaitForFinishedJobs measurement Jan 26, 2022
@alculquicondor
Copy link
Member Author

Sorry, I should have added a WIP notice. Thank you for your quick reviews.

The PR is now ready. I have renamed completed as finished to better distinguish from the JobComplete condition. This should allow us to distinguish JobFailed from JobComplete in the future, if we decide to do so.

Copy link
Member

@marseel marseel left a comment

Choose a reason for hiding this comment

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

Only small nit comments, except for that lgtm.

spec:
containers:
- name: {{.Name}}
image: bash
Copy link
Member

Choose a reason for hiding this comment

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

I suspect that this config is just example for this new measurement and you plan to change it later, right?
If we plan to change batch/config.yaml later and add more replicas etc it would be nice to use image stored in gcr. This one is downloaded from docker hub so we might have problem with rate limiting + it's better to add tag of image so each node doesn't need to download image multiple times.

Also do yu plan to change it later to sleep instead of exit?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I plan to change this to a proper load test. But I still would like to have this merged as it serves as proof that the measurement works.

I will request to upload an image soon. I was told I need to verify the license. I might create a simple go code that just exits, otherwise.

I don't think we need sleep for now, although that could be an argument for the command.

} else {
delete(w.finishedJobs, key)
}
w.lock.Unlock()
Copy link
Member

Choose a reason for hiding this comment

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

Can you move it up and do defer w.lock.Unlock()?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

failed++
}
}
w.lock.Unlock()
Copy link
Member

Choose a reason for hiding this comment

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

Let's add defer here too and move it up.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

clusterFramework *framework.Framework
cancel context.CancelFunc
lock sync.Mutex
finishedJobs map[string]batchv1.JobConditionType
Copy link
Member

Choose a reason for hiding this comment

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

Can you add comment that this lock is used for accessing finishedJobs map?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

Copy link
Member Author

@alculquicondor alculquicondor left a comment

Choose a reason for hiding this comment

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

squashed

clusterFramework *framework.Framework
cancel context.CancelFunc
lock sync.Mutex
finishedJobs map[string]batchv1.JobConditionType
Copy link
Member Author

Choose a reason for hiding this comment

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

Done

failed++
}
}
w.lock.Unlock()
Copy link
Member Author

Choose a reason for hiding this comment

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

Done

} else {
delete(w.finishedJobs, key)
}
w.lock.Unlock()
Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@marseel
Copy link
Member

marseel commented Jan 28, 2022

/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 28, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alculquicondor, marseel

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:

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 k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 28, 2022
@k8s-ci-robot k8s-ci-robot merged commit 9f10547 into kubernetes:master Jan 28, 2022
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. 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.

None yet

5 participants