use of hudson.model.Queue.Executable in project hudson-2.x by hudson.
the class Executor method getEstimatedRemainingTime.
/**
* Computes a human-readable text that shows the expected remaining time
* until the build completes.
*/
public String getEstimatedRemainingTime() {
Queue.Executable e = executable;
if (e == null)
return Messages.Executor_NotAvailable();
long d = Executables.getEstimatedDurationFor(e);
if (d < 0)
return Messages.Executor_NotAvailable();
long eta = d - getElapsedTime();
if (eta <= 0)
return Messages.Executor_NotAvailable();
return Util.getTimeSpanString(eta);
}
use of hudson.model.Queue.Executable in project hudson-2.x by hudson.
the class Executor method getEstimatedRemainingTimeMillis.
/**
* The same as {@link #getEstimatedRemainingTime()} but return
* it as a number of milli-seconds.
*/
public long getEstimatedRemainingTimeMillis() {
Queue.Executable e = executable;
if (e == null)
return -1;
long d = Executables.getEstimatedDurationFor(e);
if (d < 0)
return -1;
long eta = d - getElapsedTime();
if (eta <= 0)
return -1;
return eta;
}
use of hudson.model.Queue.Executable in project hudson-2.x by hudson.
the class AbstractProject method getBuildForDeprecatedMethods.
/**
* Various deprecated methods in this class all need the 'current' build. This method returns
* the build suitable for that purpose.
*
* @return An AbstractBuild for deprecated methods to use.
*/
private AbstractBuild getBuildForDeprecatedMethods() {
Executor e = Executor.currentExecutor();
if (e != null) {
Executable exe = e.getCurrentExecutable();
if (exe instanceof AbstractBuild) {
AbstractBuild b = (AbstractBuild) exe;
if (b.getProject() == this)
return b;
}
}
R lb = getLastBuild();
if (lb != null)
return lb;
return null;
}
use of hudson.model.Queue.Executable in project hudson-2.x by hudson.
the class Executor method doStop.
/**
* Stops the current build.
*/
public void doStop(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
Queue.Executable e = executable;
if (e != null) {
Tasks.getOwnerTaskOf(getParentOf(e)).checkAbortPermission();
interrupt();
}
rsp.forwardToPreviousPage(req);
}
use of hudson.model.Queue.Executable in project hudson-2.x by hudson.
the class Executor method getProgress.
/**
* Returns the progress of the current build in the number between 0-100.
*
* @return -1
* if it's impossible to estimate the progress.
*/
@Exported
public int getProgress() {
Queue.Executable e = executable;
if (e == null)
return -1;
long d = Executables.getEstimatedDurationFor(e);
if (d < 0)
return -1;
int num = (int) (getElapsedTime() * 100 / d);
if (num >= 100)
num = 99;
return num;
}
Aggregations