hudson.model.Executor.getElapsedTime()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(284)

本文整理了Java中hudson.model.Executor.getElapsedTime()方法的一些代码示例,展示了Executor.getElapsedTime()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Executor.getElapsedTime()方法的具体详情如下:
包路径:hudson.model.Executor
类名称:Executor
方法名:getElapsedTime

Executor.getElapsedTime介绍

暂无

代码示例

代码示例来源:origin: jenkinsci/jenkins

/**
 * The same as {@link #getEstimatedRemainingTime()} but return
 * it as a number of milli-seconds.
 */
public long getEstimatedRemainingTimeMillis() {
  long d = executableEstimatedDuration;
  if (d < 0) {
    return DEFAULT_ESTIMATED_DURATION;
  }
  long eta = d - getElapsedTime();
  if (eta <= 0) {
    return DEFAULT_ESTIMATED_DURATION;
  }
  return eta;
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Gets the string that says how long since this build has started.
 *
 * @return
 *      string like "3 minutes" "1 day" etc.
 */
public String getTimestampString() {
  return Util.getPastTimeString(getElapsedTime());
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * 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() {
  long d = executableEstimatedDuration;
  if (d <= 0) {
    return DEFAULT_ESTIMATED_DURATION;
  }
  int num = (int) (getElapsedTime() * 100 / d);
  if (num >= 100) {
    num = 99;
  }
  return num;
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Returns true if the current build is likely stuck.
 *
 * <p>
 * This is a heuristics based approach, but if the build is suspiciously taking for a long time,
 * this method returns true.
 */
@Exported
public boolean isLikelyStuck() {
  lock.readLock().lock();
  try {
    if (executable == null) {
      return false;
    }
  } finally {
    lock.readLock().unlock();
  }
  long elapsed = getElapsedTime();
  long d = executableEstimatedDuration;
  if (d >= 0) {
    // if it's taking 10 times longer than ETA, consider it stuck
    return d * 10 < elapsed;
  } else {
    // if no ETA is available, a build taking longer than a day is considered stuck
    return TimeUnit.MILLISECONDS.toHours(elapsed) > 24;
  }
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Computes a human-readable text that shows the expected remaining time
 * until the build completes.
 */
public String getEstimatedRemainingTime() {
  long d = executableEstimatedDuration;
  if (d < 0) {
    return Messages.Executor_NotAvailable();
  }
  long eta = d - getElapsedTime();
  if (eta <= 0) {
    return Messages.Executor_NotAvailable();
  }
  return Util.getTimeSpanString(eta);
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * 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;
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

/**
 * Gets the string that says how long since this build has started.
 *
 * @return string like "3 minutes" "1 day" etc.
 */
public String getTimestampString() {
  return Util.getPastTimeString(getElapsedTime());
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * Gets the string that says how long since this build has started.
 *
 * @return
 *      string like "3 minutes" "1 day" etc.
 */
public String getTimestampString() {
  return Util.getPastTimeString(getElapsedTime());
}

代码示例来源:origin: hudson/hudson-2.x

/**
 * Gets the string that says how long since this build has started.
 *
 * @return
 *      string like "3 minutes" "1 day" etc.
 */
public String getTimestampString() {
  return Util.getPastTimeString(getElapsedTime());
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

/**
 * Gets the string that says how long since this build has started.
 *
 * @return
 *      string like "3 minutes" "1 day" etc.
 */
public String getTimestampString() {
  return Util.getPastTimeString(getElapsedTime());
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * 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;
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * Gets the string that says how long since this build has started.
 *
 * @return
 *      string like "3 minutes" "1 day" etc.
 */
public String getTimestampString() {
  return Util.getPastTimeString(getElapsedTime());
}

代码示例来源:origin: hudson/hudson-2.x

/**
 * 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;
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * 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;
}

代码示例来源:origin: hudson/hudson-2.x

/**
 * 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;
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * 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;
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * 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);
}

代码示例来源:origin: hudson/hudson-2.x

/**
 * 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);
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * 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);
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

/**
 * 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);
}

相关文章