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-54514] Document error handling in the 'parallel' step #260

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
2 participants
@ringerc
Copy link
Contributor

commented Nov 7, 2018

@jglick jglick changed the title Document error handling in the 'parallel' step [JENKINS-54514] Document error handling in the 'parallel' step Nov 7, 2018

@ringerc

This comment has been minimized.

Copy link
Contributor Author

commented Nov 7, 2018

The checks failed due to what appears to be network issues with the Windows builder.

@jglick

jglick approved these changes Apr 4, 2019

Copy link
Member

left a comment

Thanks!

</pre>
Takes a map from branch names to closures and runs the closures in
parallel. The optional <code>failFast</code> option terminates
all jobs as soon as any job fails.

This comment has been minimized.

Copy link
@jglick

jglick Apr 4, 2019

Member

Would suggest avoiding the term job in this context as for Jenkins this has the specific meaning of hudson.model.Job, a.k.a. project. Oh, I hear the voice of @bitwiseman in my head telling me to talk less and suggest more, so

Suggested change
all jobs as soon as any job fails.
all branches as soon as any branch fails.
}, secondBranch: {
// do something else
},
failFast: true|false

This comment has been minimized.

Copy link
@jglick

jglick Apr 4, 2019

Member
Suggested change
failFast: true|false
failFast: true

to make this a syntactically legal example.

failFast: true|false
</pre>
Takes a map from branch names to closures and runs the closures in
parallel. The optional <code>failFast</code> option terminates

This comment has been minimized.

Copy link
@jglick

jglick Apr 4, 2019

Member
Suggested change
parallel. The optional <code>failFast</code> option terminates
parallel. The <code>failFast</code> option terminates
depending on <code>failFast</code> mode. Any non-identical exceptions
thrown by other branches are added to the first exception as having been
"suppressed by" the first exception; see
<code>Throwable.addSuppresssed(...)</code>.

This comment has been minimized.

Copy link
@jglick

jglick Apr 4, 2019

Member
Suggested change
<code>Throwable.addSuppresssed(...)</code>.
<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Throwable.html#addSuppressed(java.lang.Throwable)" target="_blank"><code>Throwable.addSuppressed(...)</code></a>.
exception once all branches have finished executing or been terminated,
depending on <code>failFast</code> mode. Any non-identical exceptions
thrown by other branches are added to the first exception as having been
"suppressed by" the first exception; see

This comment has been minimized.

Copy link
@jglick

jglick Apr 4, 2019

Member
Suggested change
"suppressed by" the first exception; see
suppressed by the first exception; see
// Produce a map of args to closures that use each arg
branches = args.collectEntries { arg -&gt; [(arg): {
def out = sh script: "./my-script.sh '${arg}'", returnStdout: true
results &lt;&lt; [(arg): out]

This comment has been minimized.

Copy link
@jglick

jglick Apr 4, 2019

Member
Suggested change
results &lt;&lt; [(arg): out]
results[arg] = out
branches = args.collectEntries { arg -&gt; [(arg): {
def out = sh script: "./my-script.sh '${arg}'", returnStdout: true
results &lt;&lt; [(arg): out]
return null

This comment has been minimized.

Copy link
@jglick

jglick Apr 4, 2019

Member
Suggested change
return null
results &lt;&lt; [(arg): out]
return null
} ] }
branches &lt;&lt; [failFast: true]

This comment has been minimized.

Copy link
@jglick

jglick Apr 4, 2019

Member
Suggested change
branches &lt;&lt; [failFast: true]
branches.failFast = true
the first failed script.
</p>
<p>
Note: Branch closures should just return <code>null</code>. The return

This comment has been minimized.

Copy link
@jglick

jglick Apr 4, 2019

Member
Suggested change
Note: Branch closures should just return <code>null</code>. The return
Note: Branch closures may return <code>null</code> or just nothing specific. The return
value of the <code>parallel</code> step should be ignored.
<code>parallel</code> does capture the return values of closures and
return a map of branch name to return value. But relying on this is not
recommended and the behaviour is subject to change; See JENKINS-26033.

This comment has been minimized.

Copy link
@jglick

jglick Apr 4, 2019

Member
Suggested change
recommended and the behaviour is subject to change; See JENKINS-26033.
recommended and the behaviour is subject to change (JENKINS-26033).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.