Class ConsolidatedRuns
- All Implemented Interfaces:
Saveable
A pipeline has come to an end when nothing of it is running or waiting in the queue any more, blocked items included, and that has been so for a few seconds: the whole chain downstream of the first build counts, or for a Pipeline job the run with the runs it started, as the view shows it. So a batch leaves the agents idle before the next one starts, and jobs that wait for the others to finish, such as a clean-up that the builds of the batch block, get their turn in between. A pipeline that waits for a person at an input step holds its batch until someone answers or the run is stopped; a manual step that nobody triggers does not.
The runs are kept in $JENKINS_HOME/se.diabol.jenkins.pipeline.consolidated.ConsolidatedRuns.xml, the
one going on or the last one per view, so that a run goes on after a restart and a view shows how its last run
went. They are kept apart from the views because a view is a part of its owner's configuration, which a seed job
replaces while a run is going.
Threads: one lock guards the runs. Readers never take it; they get the copy that was published after the last change, because the view model is computed inside the model cache and the cache is emptied from inside the queue.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classMoves the runs on every other second; a tick costs nothing while no run is going.static final recordA pipeline a run is started with. -
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ConsolidatedRunsget()The run of the view that is going on, or else its last one, or null; a copy that nothing changes any more.voidsave()start(String viewKey, String viewName, List<ConsolidatedRuns.Target> targets, int concurrentPipelines, int sleepSeconds, String userId, String userName) Starts a run of the view and its first batch.Stops the view's run: no further batch starts.
-
Constructor Details
-
ConsolidatedRuns
public ConsolidatedRuns()
-
-
Method Details
-
get
-
of
The run of the view that is going on, or else its last one, or null; a copy that nothing changes any more. -
start
public ConsolidatedRun start(String viewKey, String viewName, List<ConsolidatedRuns.Target> targets, int concurrentPipelines, int sleepSeconds, String userId, String userName) throws PipelineException Starts a run of the view and its first batch. The caller has checked that the user may build the targets.- Throws:
PipelineException- when a run of the view is going on already, or there is nothing to run
-
stop
Stops the view's run: no further batch starts. The pipelines that are running go on, and the run ends when they have. Stopping a run that is stopping already gives up waiting for them and ends the run at once, which is the way out when a pipeline can never end, such as one whose job waits in the queue for an agent that is gone.- Throws:
PipelineException- when no run of the view is going on
-
save
public void save()
-