hudson.model.Queue#Task ( )源码实例Demo

下面列出了hudson.model.Queue#Task ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

@Override
public void onEnterBuildable(final Queue.BuildableItem bi) {
    final Queue.Task job = bi.task;
    if (DockerSwarmCloud.get() != null) {
        final List<String> labels = DockerSwarmCloud.get().getLabels();
        if (job.getAssignedLabel() != null && labels.contains(job.getAssignedLabel().getName())) {
            BuildScheduler.scheduleBuild(bi);
        }
    }
}
 
源代码2 项目: kubernetes-plugin   文件: KubernetesComputer.java
@Override
public void taskCompleted(Executor executor, Queue.Task task, long durationMS) {
    Queue.Executable exec = executor.getCurrentExecutable();
    LOGGER.log(Level.FINE, " Computer {0} completed task {1}", new Object[] {this, exec});

    // May take the agent offline and remove it, in which case getNode()
    // above would return null and we'd not find our DockerSlave anymore.
    super.taskCompleted(executor, task, durationMS);
}
 
@Override
public void taskCompleted(Executor executor, Queue.Task task, long durationMS) {
    LOG.debug("Computer {} taskCompleted", this);

    // May take the slave offline and remove it, in which case getNode()
    // above would return null and we'd not find our DockerSlave anymore.
    super.taskCompleted(executor, task, durationMS);
}
 
源代码4 项目: amazon-ecs-plugin   文件: ECSComputer.java
@Override
public void taskAccepted(Executor executor, Queue.Task task) {
    super.taskAccepted(executor, task);
    LOGGER.log(Level.INFO, "[{0}]: JobName: {1}", new Object[] {this.getName(), task.getDisplayName()});
    LOGGER.log(Level.INFO, "[{0}]: JobUrl: {1}", new Object[] {this.getName(), task.getUrl()});
    LOGGER.log(Level.FINE, "[{0}]: taskAccepted", this);
}
 
@Override
public void taskAccepted(Executor executor, Queue.Task task) {
}
 
@Override
public void taskCompleted(Executor executor, Queue.Task task, long durationMS) {
    this.isTaskCompleted = true;
    getLogger(executor).println("Task completed: " + task.getFullDisplayName());
    done(executor);
}
 
@Override
public void taskCompleted(Executor executor, Queue.Task task, long durationMS) {
    done(executor);
}
 
源代码8 项目: jira-steps-plugin   文件: Site.java
protected Authentication getAuthentication(Item item) {
  return item instanceof Queue.Task ? Tasks.getAuthenticationOf((Queue.Task) item) : ACL.SYSTEM;
}
 
@Override
public void taskCompletedWithProblems(Executor executor, Queue.Task task, long durationMS, Throwable problems) {
    done(executor);
}
 
源代码10 项目: jenkins-nomad   文件: NomadComputer.java
@Override
public void taskCompleted(Executor executor, Queue.Task task, long durationMS) {
    super.taskCompleted(executor, task, durationMS);
    LOGGER.log(Level.INFO, " Computer " + this + ": task completed");
}
 
源代码11 项目: jenkins-nomad   文件: NomadComputer.java
@Override
public void taskCompletedWithProblems(Executor executor, Queue.Task task, long durationMS, Throwable problems) {
    super.taskCompletedWithProblems(executor, task, durationMS, problems);
    LOGGER.log(Level.WARNING, " Computer " + this + " task completed with problems");
}
 
源代码12 项目: amazon-ecs-plugin   文件: ECSComputer.java
@Override
public void taskCompleted(Executor executor, Queue.Task task, long durationMS) {
    super.taskCompleted(executor, task, durationMS);
    LOGGER.log(Level.FINE, "[{0}]: taskCompleted", this);
}
 
/**
 * {@link ComputerLauncher#afterDisconnect(SlaveComputer, TaskListener)}
 * <p>
 * EC2 Fleet plugin overrides this method to detect jobs which were failed because of
 * EC2 instance was terminated/stopped. It could be manual stop or because of Spot marked.
 * In all cases as soon as job aborted because of broken connection and slave is offline
 * it will try to resubmit aborted job back to the queue, so user doesn't need to do that manually
 * and another slave could take it.
 * <p>
 * Implementation details
 * <p>
 * There is no official recommendation about way how to resubmit job according to
 * https://issues.jenkins-ci.org/browse/JENKINS-49707 moreover some of Jenkins code says it impossible.
 * <p>
 * method checks {@link SlaveComputer#getOfflineCause()} for disconnect because of EC2 instance termination
 * it returns
 * <code>
 * result = {[email protected]} "Connection was broken: java.io.IOException:
 * Unexpected termination of the channel\n\tat hudson.remoting.SynchronousCommandTransport$ReaderThread...
 * cause = {[email protected]} "java.io.IOException: Unexpected termination of the channel"
 * timestamp = 1561067177837
 * </code>
 *
 * @param computer computer
 * @param listener listener
 */
@Override
public void afterDisconnect(final SlaveComputer computer, final TaskListener listener) {
    // according to jenkins docs could be null in edge cases, check ComputerLauncher.afterDisconnect
    if (computer == null) return;

    // in some multi-thread edge cases cloud could be null for some time, just be ok with that
    final EC2FleetCloud cloud = ((EC2FleetNodeComputer) computer).getCloud();
    if (cloud == null) {
        LOGGER.warning("Edge case cloud is null for computer " + computer.getDisplayName()
                + " should be autofixed in a few minutes, if no please create issue for plugin");
        return;
    }

    final boolean unexpectedDisconnect = computer.isOffline() && computer.getOfflineCause() instanceof OfflineCause.ChannelTermination;
    if (!cloud.isDisableTaskResubmit() && unexpectedDisconnect) {
        final List<Executor> executors = computer.getExecutors();
        LOGGER.log(LOG_LEVEL, "Unexpected " + computer.getDisplayName()
                + " termination,  resubmit");

        for (Executor executor : executors) {
            if (executor.getCurrentExecutable() != null) {
                executor.interrupt(Result.ABORTED, new EC2TerminationCause(computer.getDisplayName()));

                final Queue.Executable executable = executor.getCurrentExecutable();
                // if executor is not idle
                if (executable != null) {
                    final SubTask subTask = executable.getParent();
                    final Queue.Task task = subTask.getOwnerTask();

                    List<Action> actions = new ArrayList<>();
                    if (executable instanceof Actionable) {
                        actions = ((Actionable) executable).getActions();
                    }

                    Queue.getInstance().schedule2(task, RESCHEDULE_QUIET_PERIOD_SEC, actions);
                    LOGGER.log(LOG_LEVEL, "Unexpected " + computer.getDisplayName()
                            + " termination, resubmit " + task + " with actions " + actions);
                }
            }
        }
        LOGGER.log(LOG_LEVEL, "Unexpected " + computer.getDisplayName()
                + " termination, resubmit finished");
    } else {
        LOGGER.log(LOG_LEVEL, "Unexpected " + computer.getDisplayName()
                + " termination but resubmit disabled, no actions, disableTaskResubmit: "
                + cloud.isDisableTaskResubmit() + ", offline: " + computer.isOffline()
                + ", offlineCause: " + (computer.getOfflineCause() != null ? computer.getOfflineCause().getClass() : "null"));
    }

    // call parent
    super.afterDisconnect(computer, listener);
}
 
源代码14 项目: amazon-ecs-plugin   文件: ECSComputer.java
@Override
public void taskCompletedWithProblems(Executor executor, Queue.Task task, long durationMS, Throwable problems) {
    super.taskCompletedWithProblems(executor, task, durationMS, problems);
    LOGGER.log(Level.FINE, "[{0}]: taskCompletedWithProblems", this);
}
 
源代码15 项目: kubernetes-plugin   文件: KubernetesComputer.java
@Override
public void taskCompletedWithProblems(Executor executor, Queue.Task task, long durationMS, Throwable problems) {
    super.taskCompletedWithProblems(executor, task, durationMS, problems);
    Queue.Executable exec = executor.getCurrentExecutable();
    LOGGER.log(Level.FINE, " Computer {0} completed task {1} with problems", new Object[] {this, exec});
}
 
源代码16 项目: yet-another-docker-plugin   文件: DockerComputer.java
@Override
public void taskAccepted(Executor executor, Queue.Task task) {
    super.taskAccepted(executor, task);
    LOG.debug("Computer {} taskAccepted", this);
}
 
源代码17 项目: yet-another-docker-plugin   文件: DockerComputer.java
@Override
public void taskCompletedWithProblems(Executor executor, Queue.Task task, long durationMS, Throwable problems) {
    LOG.debug("Computer {} taskCompletedWithProblems", this);
    super.taskCompletedWithProblems(executor, task, durationMS, problems);
}
 
@Override
public void taskAccepted(Executor executor, Queue.Task task) {
}
 
@Override
public void taskCompleted(Executor executor, Queue.Task task, long durationMS) {
    done(executor);
}
 
@Override
public void taskCompletedWithProblems(Executor executor, Queue.Task task, long durationMS, Throwable problems) {
    done(executor);
}