Class DurableTaskStep.Execution
- All Implemented Interfaces:
Serializable,Runnable
- Enclosing class:
- DurableTaskStep
This step has two modes, based on pulling or pushing log content from an agent.
In the default (push) mode, Controller.watch(hudson.FilePath, org.jenkinsci.plugins.durabletask.Handler, hudson.model.TaskListener) is used to ask the agent to begin streaming log content.
As new output is detected at regular intervals, it is streamed to the TaskListener,
which in the default StreamTaskListener implementation sends chunks of text over Remoting.
When the process exits, exited(int, byte[]) is called and the step execution also ends.
If Jenkins is restarted in the middle, onResume() starts a new watch task.
Every DurableTaskStep.WATCHING_RECURRENCE_PERIOD, the controller also checks to make sure the process still seems to be running using Controller.exitStatus(hudson.FilePath, hudson.Launcher, hudson.model.TaskListener).
If the agent connection is closed, ws will be stale
(FilePath.channel will be Channel.isClosingOrClosed())
and so getWorkspace() called from check() will call getWorkspaceProblem(java.lang.Exception)
and we will attempt to get a fresh ws as soon as possible, with a new watch.
(The persisted node and remote identify the workspace.)
If the process does not seem to be running after two consecutive checks,
yet no explicit process completion signal was sent,
awaitingAsynchExit will make the step assume that the watch task is broken and the step should fail.
If sending output fails for any reason other than ChannelClosedException,
problem(java.lang.Exception) will attempt to record the issue but permit the step to proceed.
In the older pull mode, available on request by DurableTaskStep.USE_WATCHING or when encountering a noncompliant Controller implementation,
the controller looks for process output (Controller.writeLog(hudson.FilePath, java.io.OutputStream)) and/or exit status in check() at variable intervals,
initially MIN_RECURRENCE_PERIOD but slowing down by RECURRENCE_PERIOD_BACKOFF up to MAX_RECURRENCE_PERIOD.
Any new output will be noted in a change to the state of controller, which gets saved to the step state in turn.
If there is any connection problem to the workspace (including controller restarts and Remoting disconnects),
ws is nulled out and Jenkins waits until a fresh handle is available.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classWorks around the fact thatTerminatoris run beforeJenkins.isTerminating()is set. -
Field Summary
Fields -
Method Summary
Methods inherited from class org.jenkinsci.plugins.workflow.steps.AbstractStepExecutionImpl
injectMethods inherited from class org.jenkinsci.plugins.workflow.steps.StepExecution
acceptAll, acceptAll, applyAll, applyAll, blocksRestart, getContext, getStatusBounded
-
Field Details
-
node
Node.getNodeName()ofws.
-
-
Method Details
-
start
- Specified by:
startin classorg.jenkinsci.plugins.workflow.steps.StepExecution- Throws:
Exception
-
stop
- Overrides:
stopin classorg.jenkinsci.plugins.workflow.steps.StepExecution- Throws:
Exception
-
getStatus
- Overrides:
getStatusin classorg.jenkinsci.plugins.workflow.steps.StepExecution
-
run
public void run()Checks for progress or completion of the external task. -
exited
- Throws:
Exception
-
problem
-
onResume
public void onResume()- Overrides:
onResumein classorg.jenkinsci.plugins.workflow.steps.AbstractStepExecutionImpl
-