public class ConcurrentJobMonitor extends Object implements Iterable<SubmittedJob>
It provides statistics and a textual description of the aggregate state of execution across all jobs.
Constructor and Description |
---|
ConcurrentJobMonitor(long totalNumberJobs) |
Modifier and Type | Method and Description |
---|---|
void |
add(SubmittedJob job)
Adds a job to be considered in the aggregate view.
|
String |
currentStateDescription()
A human-understandable string describing the aggregate state.
|
TaskStatistics |
deriveStatistics()
Derive statistics on the aggregate state of jobs.
|
Optional<String> |
describeUncompletedJobs(int fewerThanThreshold)
A string that describes all jobs that are not tey completed, but only if there are fewer than
a certain number.
|
long |
getTotalNumberJobs()
The total number of submitted jobs to be executed.
|
Iterator<SubmittedJob> |
iterator() |
long |
numberCompletedFailureJobs()
The number of jobs that have completed in a state of failure.
|
long |
numberCompletedJobs()
The number of jobs that have completed, regardless of failure state.
|
long |
numberCompletedSuccessfullyJobs()
The number of jobs that have completed in a state of success.
|
long |
numberExecutingJobs()
The number of jobs that are currently executing.
|
long |
numberUncompletedJobs()
The number of jobs that remain uncompleted.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public void add(SubmittedJob job)
job
- the job.public String currentStateDescription()
It features:
The string is shortened using abbreviations to help fit in a line of console outut.
public Optional<String> describeUncompletedJobs(int fewerThanThreshold)
The string shows the number and a short-name for each job, and the number of seconds for which it is has been executing.
The string shows the jobs on one long line, without using newlines.
fewerThanThreshold
- a description is only shown if the total number of executing tasks
is less than this threshold.Optional.empty()
.public long numberUncompletedJobs()
public long numberCompletedJobs()
This includes both jobs that have completed successfully and with failure.
public long numberCompletedSuccessfullyJobs()
public long numberCompletedFailureJobs()
public long numberExecutingJobs()
public TaskStatistics deriveStatistics()
TaskStatistics
capturing the state at the point it was
executed.public Iterator<SubmittedJob> iterator()
iterator
in interface Iterable<SubmittedJob>
public long getTotalNumberJobs()
Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.