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

Allow to specify runPolicy for BuildConfig #8453

Merged
merged 1 commit into from
May 2, 2016

Conversation

mfojtik
Copy link
Contributor

@mfojtik mfojtik commented Apr 11, 2016

  • Add runPolicy=Parallel | Serial | SerialLatestOnly into the BuildConfig.
    • The Parallel represents current behavior.
    • The Serial means the builds will be execute sequentially.
    • The SerialLatestOnly means that only the latest build will be executed and previous non-running builds will be cancelled.

The Serial will be default when this PR gets merged. This will be documented for users.

@mfojtik
Copy link
Contributor Author

mfojtik commented Apr 11, 2016

@bparees @smarterclayton this is an very early draft of the API additions needed for https://trello.com/c/Wz8FFwko/849-13-single-threaded-builds. Would appreciate quick review before I jump into actual implementation.

// make the build created from this build requests be the only build in the
// queue. This option is valid only for build configurations with "recent"
// build scheduling policy.
SkipBuildsInQueue *bool
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@smarterclayton @bparees maybe this deserves a better name ;-)

Copy link
Contributor

Choose a reason for hiding this comment

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

What does Jenkins call this flag? How many flags do they have? What about jenkins pipeline and concourse?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jstrachan && @jimmidyson to the rescue :-)

Copy link
Contributor

Choose a reason for hiding this comment

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

There isn't a direct equivalent afaik. There's also accelerated build which will run the new build immediately, but not cancel the other builds. It's all possible of course :) @jstrachan Do you know any different?

Copy link
Contributor

Choose a reason for hiding this comment

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

not seen anything else equivalent I'm afraid

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jimmidyson @jstrachan thanks guys, we are opting out this option and have one parallel and serial builds for now.

Copy link
Contributor

Choose a reason for hiding this comment

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

not sure this is the way we want to expose that behavior anyway. i think the use case is more like:

  1. i started a build
  2. i look at the build queue and see it's full of garbage
  3. i run "oc skip-builds" (name tbd) which skips all the queued builds except the most recent one (mine).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bparees iow.

oc skip-build --to ruby-10

Copy link
Contributor

Choose a reason for hiding this comment

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

--to is fancy :) but sure.

@mfojtik mfojtik force-pushed the serial-builds branch 3 times, most recently from 8fa4671 to e22db83 Compare April 11, 2016 17:30
@@ -86,6 +86,10 @@ type BuildStatus struct {
// Cancelled describes if a cancel event was triggered for the build.
Cancelled bool

// Position represents the build position in the build queue. Only applies to
// build configurations with "serial" or "recent" scheduling policy.
Position *int64
Copy link
Contributor

Choose a reason for hiding this comment

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

going to use the build number annotation instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, already updated this pull.

@mfojtik mfojtik changed the title WIP: Initial API draft for serial builds WIP: Initial implementation of serial builds Apr 12, 2016
@mfojtik
Copy link
Contributor Author

mfojtik commented Apr 12, 2016

@bparees @smarterclayton PTAL. I did some initial implementation for serial builds.

It works, but it is not ideal.. The builds are executed sequentially based on the build number we store in the annotation.
The problem is that the time for retrying the new build handling seems very long. When one build finishes, it took about ~30 seconds when the next build is scheduled. I dunno if this is something we can tweak (build completion force trigger handing builds in New state).

Also the BuildController has 30 minutes retry timeout... does that mean if I have big queue for builds and they will not finish in 30 minutes, they will be marked as failed? Another solution would be to have separate controller that handle only "serial" builds.

@mfojtik
Copy link
Contributor Author

mfojtik commented Apr 12, 2016

@mfojtik mfojtik force-pushed the serial-builds branch 2 times, most recently from 978f35b to bacdafb Compare April 12, 2016 10:12
@bparees
Copy link
Contributor

bparees commented Apr 12, 2016

When one build finishes, it took about ~30 seconds when the next build is scheduled. I dunno if this is something we can tweak (build completion force trigger handing builds in New state).

that should definitely be done. I guess i didn't put it in the card but i was assuming that controller should, on seeing a build enter a terminal state, revisit the queue and pick the next build.

doesn't solve the "stuck build that is waiting for an IST" scenario though.

@mfojtik
Copy link
Contributor Author

mfojtik commented Apr 12, 2016

@bparees it basically means that an event of "complete" build should kick HandleBuild() for all queued builds....

@@ -17354,6 +17354,10 @@
},
"description": "Triggers determine how new Builds can be launched from a BuildConfig. If no triggers are defined, a new build can only occur as a result of an explicit client build creation."
},
"schedulePolicy": {
"$ref": "v1.BuildSchedulePolicy",
"description": "SchedulePolicy describes how the new build created from this build configuration will be scheduled for execution. This is optional, if not specified we default to \"parallel\"."
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we would default to serial?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@smarterclayton right. I was thinking about that and I think it make sense. Serial is also default in Jenkins.

Copy link
Contributor

Choose a reason for hiding this comment

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

i was thinking we'd default to parallel for backwards compatibility reasons.

i'm ok w/ changing it, but we need to acknowledge we're changing the default behavior for users.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@smarterclayton i found the schedulePolicy long to type ;-) WDYT about changing that just to schedule: parallel ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@smarterclayton should we still default to Serial or SerialLatestOnly? I think Serial will be "safe" default.

@bparees
Copy link
Contributor

bparees commented Apr 12, 2016

@bparees it basically means that an event of "complete" build should kick HandleBuild() for all queued builds....

not just complete. also failed, canceled, etc.

@mfojtik
Copy link
Contributor Author

mfojtik commented Apr 12, 2016

@bparees made some improvements in the last commit, https://www.youtube.com/watch?v=0MpmnYebdHw

@smarterclayton
Copy link
Contributor

I think you guys need to define what skipped is before we argue about how
it's represented in the API :)

On Tue, Apr 12, 2016 at 3:44 PM, Michal Fojtik [email protected]
wrote:

@bparees https://github.com/bparees made some improvements in the last
commit, https://www.youtube.com/watch?v=0MpmnYebdHw


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#8453 (comment)

if nextBuild != nil {
glog.Infof("Queue: The next build is %s", nextBuild.Name)
switch build.Status.Phase {
case buildapi.BuildPhaseError, buildapi.BuildPhaseFailed, buildapi.BuildPhaseComplete, buildapi.BuildPhaseCancelled:
Copy link
Contributor

Choose a reason for hiding this comment

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

pkg/build/util/util.go:IsBuildComplete

@bparees
Copy link
Contributor

bparees commented Apr 12, 2016

I think you guys need to define what skipped is before we argue about how it's represented in the API :)

to me, skipped is a reason. canceled is the state.

canceled - because the user canceled it
canceled - because it was auto-skipped due to the presence of a newer build (function we are not implementing yet)
canceled - because the user requested we skip queued builds and run the most recent one instead

@mfojtik
Copy link
Contributor Author

mfojtik commented Apr 13, 2016

@bparees +1 we don't want to introduce new phase, so we have to live with existing phases. The best fit for "skipped" is cancelled with a good reason (Ben described the reasons).

// SchedulePolicy describes how the new build created from this build
// configuration will be scheduled for execution.
// This is optional, if not specified we default to "parallel".
SchedulePolicy *BuildSchedulePolicy
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@smarterclayton API question... do you think this field should be here or in BuildSpec? I think it should be higher level (same as Triggers), WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

Since this doesn't apply to Builds, it makes sense to me that it is not part of BuildSpec.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

right. I think it should live on BuildConfig as it is now.

Copy link
Contributor

Choose a reason for hiding this comment

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

but renamed i guess per the type renaming below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bparees yes as soon as we decide the name :-)

@mfojtik mfojtik added this to the 1.2.x milestone Apr 13, 2016
@mfojtik mfojtik changed the title WIP: Initial implementation of serial builds Initial implementation of serial builds Apr 13, 2016
@mfojtik
Copy link
Contributor Author

mfojtik commented Apr 28, 2016

[test]

@mfojtik mfojtik force-pushed the serial-builds branch 2 times, most recently from 181125a to d3c2897 Compare April 28, 2016 13:00
@mfojtik
Copy link
Contributor Author

mfojtik commented Apr 29, 2016

[test]

(integration flake)

@mfojtik
Copy link
Contributor Author

mfojtik commented Apr 29, 2016

@smarterclayton @bparees merge while it is green :-)

@jimmidyson
Copy link
Contributor

@mfojtik Don't you make me rebase #7949 again!

@bparees
Copy link
Contributor

bparees commented Apr 29, 2016

@mfojtik still needs api approved label from @smarterclayton

@smarterclayton
Copy link
Contributor

Approved, thanks for following process :)

@bparees
Copy link
Contributor

bparees commented Apr 29, 2016

lgtm but we'll let @jimmidyson's PR merge first :) (it just got tagged)

@mfojtik
Copy link
Contributor Author

mfojtik commented May 2, 2016

@bparees rebased... will wait for tests to pass :-)

@mfojtik
Copy link
Contributor Author

mfojtik commented May 2, 2016

[test]

@openshift-bot
Copy link
Contributor

Evaluated for origin testonlyextended up to bd47008

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/testonlyextended SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin_extended/132/) (Extended Tests: core(using build configuration))

@mfojtik
Copy link
Contributor Author

mfojtik commented May 2, 2016

ok jenkins, [test] again.

@openshift-bot
Copy link
Contributor

Evaluated for origin test up to bd47008

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/3525/)

@mfojtik
Copy link
Contributor Author

mfojtik commented May 2, 2016

[merge]

(tests are flaking but nothing related to this PR)

@openshift-bot
Copy link
Contributor

openshift-bot commented May 2, 2016

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/merge_pull_requests_origin/5779/) (Image: devenv-rhel7_4075)

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to bd47008

@smarterclayton
Copy link
Contributor

Are all the flakes known?

On May 2, 2016, at 11:32 AM, Michal Fojtik [email protected] wrote:

[merge]

(tests are flaking but nothing related to this PR)


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#8453 (comment)

@mfojtik
Copy link
Contributor Author

mfojtik commented May 2, 2016

Yes as far I know (s2i quota, mysql passtrough)
On May 2, 2016 18:04, "Clayton Coleman" [email protected] wrote:

Are all the flakes known?

On May 2, 2016, at 11:32 AM, Michal Fojtik [email protected]
wrote:

[merge]

(tests are flaking but nothing related to this PR)


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#8453 (comment)


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#8453 (comment)

@openshift-bot openshift-bot merged commit 7e857e7 into openshift:master May 2, 2016
@mfojtik mfojtik deleted the serial-builds branch September 5, 2018 21:08
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.

10 participants