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

[JENKINS-12092] Block job by category #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

fluffy88
Copy link

Allow categories to be configured so they are blocking by another category.

In category configuration, add new textbox which takes a comma separated list of category names. Jobs in the category will then be blocked from executing while jobs from any of the listed categories are queued or executing.

@fluffy88
Copy link
Author

Sorry accidentally made this pull request too early.
I have to add new tests for the new functionality and now fix the ones I broke.

Comments on the Jira ticket or pull request are welcome though :)

@jenkinsadmin
Copy link
Member

Thank you for a pull request! Please check this document for how the Jenkins project handles pull requests

@oleg-nenashev oleg-nenashev changed the title JENKINS-12092 Block job by category [WiP] JENKINS-12092 Block job by category Jan 24, 2015
@fluffy88 fluffy88 force-pushed the block_by_category branch 2 times, most recently from fef46c5 to 1e0c878 Compare January 31, 2015 10:43
@fluffy88
Copy link
Author

fluffy88 commented Feb 2, 2015

This is ready for review and merging

@@ -319,20 +322,34 @@ public ListBoxModel doFillCategoryItems() {
private Integer maxConcurrentPerNode;
private Integer maxConcurrentTotal;
private String categoryName;
private String blockingCategories;
private List<String> blockingCategoriesList = new ArrayList<String>();
private List<NodeLabeledPair> nodeLabeledPairs;

@DataBoundConstructor
public ThrottleCategory(String categoryName,
Copy link
Member

Choose a reason for hiding this comment

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

Please save the previous constructor as well. Otherwise the change affects the binary compatibility with previous versions

@fluffy88 fluffy88 force-pushed the block_by_category branch 2 times, most recently from 521f484 to 97fd80b Compare May 6, 2015 14:39
@fluffy88
Copy link
Author

fluffy88 commented May 6, 2015

Woohoo, fixed build failures :)
Sorry about the long delay

@fluffy88 fluffy88 force-pushed the block_by_category branch from 97fd80b to 632ecbd Compare May 6, 2015 15:45
@fluffy88 fluffy88 force-pushed the block_by_category branch from 632ecbd to 7dfb26a Compare May 8, 2015 15:45
@fluffy88
Copy link
Author

@oleg-nenashev any chance of a review for this PR?

}

private boolean isProjectBuilding(AbstractProject<?, ?> project) {
if (project.isBuilding() || project.isInQueue()) {
Copy link
Member

Choose a reason for hiding this comment

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

project.isBuilding() is unreliable for parallel runs; project.isInQueue() causes a full queue lookup with a serious performance impact on cores till 1.610

@oleg-nenashev
Copy link
Member

@fluffy88
Currently I would put the change on hold, because it forces Queue checks for every project and every category => serious performance impact on 1.580.x LTS

We tried to somehow overcome the issue in #27 and #28 , but unfortunately now I have no time to finalize and especially test these changes.

@fluffy88
Copy link
Author

👍 that's okay with me

@jglick jglick changed the title [WiP] JENKINS-12092 Block job by category [JENKINS-12092] Block job by category Jan 4, 2016
@Karanval
Copy link

Karanval commented May 1, 2017

Any chance of this coming out?

@oleg-nenashev
Copy link
Member

1.580.x compatibility is no longer a blocker, hence probably it could be done

@sp-ricard-valverde
Copy link

This would be a nice addition.

In my use case I have build jobs and node provisioning jobs, both with their respective categories.

The build and provisioning category should be able to do concurrent builds with a maximum of 1 per node.

When a provisioning category job runs it should block the build category on a node, so no other build or provisioning category job is running on any other executor for the particular node.

This PR is the best fit for this scenario.
I tried to accomplish this with other plugins but I couldn't find a good match, just this old Exclusive Execution but as I am using Jekins Config as Code it was a no-go.

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

Successfully merging this pull request may close these issues.

6 participants