Java 类hudson.model.queue.SubTask 实例源码

项目:scoring-load-balancer    文件:NodePreferenceScoringRule.java   
private BuildPreferenceJobProperty getBuildPreferenceJobProperty(SubTask subtask)
{
    if(!(subtask instanceof Job))
    {
        return null;
    }

    if(subtask instanceof MatrixConfiguration)
    {
        MatrixConfiguration conf = (MatrixConfiguration)subtask;
        return conf.getParent().getProperty(BuildPreferenceJobProperty.class);
    }

    Job<?,?> job = (Job<?,?>)subtask;
    return job.getProperty(BuildPreferenceJobProperty.class);

}
项目:jenkins.py    文件:JobPropertyPW.java   
@Override
public Collection<? extends SubTask> getSubTasks() {
    initPython();
    if (pexec.isImplemented(9)) {
        return (Collection) pexec.execPython("get_sub_tasks");
    } else {
        return super.getSubTasks();
    }
}
项目:jenkins-inheritance-plugin    文件:InheritanceProject.java   
/**
 * This needs to be overridden, because {@link AbstractProject} reads the
 * properties field directly; which circumvents inheritance.
 */
@Override
public List<SubTask> getSubTasks() {
    List<SubTask> r = new ArrayList<SubTask>();
    r.add(this);
    for (SubTaskContributor euc : SubTaskContributor.all()) {
        r.addAll(euc.forProject(this));
    }
    for (JobProperty<?> p : this.getAllProperties()) {
        r.addAll(p.getSubTasks());
    }
    return r;
}
项目:hyper-slaves-plugin    文件:HyperSlaveAssignmentAction.java   
@Override
public Label getAssignedLabel(SubTask task) {
    return Label.get(assignedNodeName);
}
项目:yet-another-docker-plugin    文件:MyExecutable.java   
@Nonnull
@Override
public SubTask getParent() {
    return dockerTask;
}
项目:github-integration-plugin    文件:JobRunnerForCause.java   
public synchronized int abortRunning(int number) throws IllegalAccessException {
        int aborted = 0;

        Computer[] computers = getJenkinsInstance().getComputers();
        for (Computer computer : computers) {
            if (isNull(computer)) {
                continue;
            }

            List<Executor> executors = computer.getExecutors();
            executors.addAll(computer.getOneOffExecutors());

            for (Executor executor : executors) {
                if (isNull(executor) || !executor.isBusy() || nonNull(executor.getCauseOfDeath()) ||
                        !getInterruptCauses(executor).isEmpty() || getInterruptStatus(executor) == Result.ABORTED) {
                    continue;
                }

                Queue.Executable executable = executor.getCurrentExecutable();
                final SubTask parent = executable.getParent();

                if (!(executable instanceof Run)) {
                    continue;
                }
                final Run executableRun = (Run) executable;

                if (!(parent instanceof Job)) {
                    continue;
                }
                final Job parentJob = (Job) parent;

                if (!parentJob.getFullName().equals(job.getFullName())) {
                    // name doesn't match
                    continue;
                }

                if (executableRun.getResult() == Result.ABORTED) {
                    // was already aborted
                    continue;
                }

                if (executableRun instanceof MatrixRun) {
                    // the whole MatrixBuild will be aborted
                    continue;
                }
//                if (executable instanceof MatrixBuild) {
//                    final MatrixBuild executable1 = (MatrixBuild) executable;
//                    executable1.doStop()
//                }

                final GitHubPRCause causeAction = (GitHubPRCause) executableRun.getCause(GitHubPRCause.class);
                if (nonNull(causeAction) && causeAction.getNumber() == number) {
                    LOGGER.info("Aborting '{}', by interrupting '{}'", executableRun, executor);
                    executor.interrupt(Result.ABORTED, new NewPRInterruptCause());
                    aborted++;
                }
            }
        }

        return aborted;
    }
项目:deployer-framework-plugin    文件:DeployNowTask.java   
public SubTask getParent() {
    return DeployNowTask.this;
}
项目:docker-plugin    文件:DockerQueueListener.java   
@Override
public Label getAssignedLabel(@Nonnull SubTask task) {
    return new LabelAtom(uuid);
}
项目:jenkins.py    文件:JobPropertyPW.java   
public Collection<? extends SubTask> superGetSubTasks() {
    return super.getSubTasks();
}
项目:scoring-load-balancer    文件:BuildResultScoringRule.java   
/**
 * Scores the nodes depending on build results on those nodes.
 * 
 * @param task
 * @param wc
 * @param m
 * @param nodesScore
 */
@Override
public boolean updateScores(Task task, WorkChunk wc, Mapping m,
        NodesScore nodesScore)
{
    for(SubTask subtask: wc)
    {
        if(!(subtask instanceof AbstractProject))
        {
            return true;
        }

        AbstractProject<?,?> project = (AbstractProject<?, ?>)subtask;

        Set<Node> nodeSet = new HashSet<Node>(nodesScore.getNodes());
        AbstractBuild<?,?> build = project.getLastBuild();
        for(
                int pastNum = 0;
                pastNum < getNumberOfBuilds() && build != null;
                ++pastNum, build = build.getPreviousBuild()
        )
        {
            Node node = build.getBuiltOn();
            if(!nodeSet.contains(node))
            {
                continue;
            }

            int scale = getScale() + getScaleAdjustForOlder() * pastNum;

            if(Result.SUCCESS == build.getResult())
            {
                nodesScore.addScore(node, getScoreForSuccess() * scale);
                nodeSet.remove(node);
            }
            else if(Result.FAILURE == build.getResult())
            {
                nodesScore.addScore(node, getScoreForFailure() * scale);
                nodeSet.remove(node);
            }
            else if(Result.UNSTABLE == build.getResult())
            {
                nodesScore.addScore(node, getScoreForUnstable() * scale);
                nodeSet.remove(node);
            }
        }
    }

    return true;
}
项目:scoring-load-balancer    文件:TriggerOtherProjectProperty.java   
public TriggerOtherProjectProperty(SubTask ... tasks)
{
    subTaskList = Arrays.asList(tasks);
}
项目:scoring-load-balancer    文件:TriggerOtherProjectProperty.java   
@Override
public Collection<? extends SubTask> getSubTasks()
{
    return subTaskList;
}
项目:gearman-plugin    文件:NodeAssignmentAction.java   
@Override
public Label getAssignedLabel(SubTask task) {
    // TODO Auto-generated method stub
    return labelAtom;
}