Package hudson.model

Examples of hudson.model.Queue$BuildableItem


            // doing this early allows InitStrategy to set environment upfront
            final InitStrategy is = InitStrategy.get(Thread.currentThread().getContextClassLoader());

            Trigger.timer = new Timer("Jenkins cron thread");
            queue = new Queue(CONSISTENT_HASH?LoadBalancer.CONSISTENT_HASH:LoadBalancer.DEFAULT);

            try {
                dependencyGraph = DependencyGraph.EMPTY;
            } catch (InternalError e) {
                if(e.getMessage().contains("window server")) {
View Full Code Here


    @Initializer(after=JOB_LOADED)
    public static void installDefaultQueueSorter() {
        ExtensionList<QueueSorter> all = all();
        if (all.isEmpty())  return;

        Queue q = Jenkins.getInstance().getQueue();
        if (q.getSorter()!=null)        return; // someone has already installed something. leave that alone.

        q.setSorter(all.get(0));
        if (all.size()>1)
            LOGGER.warning("Multiple QueueSorters are registered. Only the first one is used and the rest are ignored: "+all);
    }
View Full Code Here

            } catch (AbortException e) {
                logger.println(e.getMessage());
                return Result.FAILURE;
            } finally {
                // if the build was aborted in the middle. Cancel all the configuration builds.
                Queue q = Jenkins.getInstance().getQueue();
                synchronized(q) {// avoid micro-locking in q.cancel.
                    final int n = getNumber();
                    for (MatrixConfiguration c : p.getActiveConfigurations()) {
                        if(q.cancel(c))
                            logger.println(Messages.MatrixBuild_Cancelled(ModelHyperlinkNote.encodeTo(c)));
                        MatrixRun b = c.getBuildByNumber(n);
                        if(b!=null && b.isBuilding()) {// executor can spend some time in post production state, so only cancel in-progress builds.
                            Executor exe = b.getExecutor();
                            if(exe!=null) {
View Full Code Here

        }
    }

    public void cancelSubBuilds(PrintStream logger) {
        Queue q = getJenkins().getQueue();
        synchronized (q) {
            final int n = dynamicBuild.getNumber();
            for (Item i : q.getItems()) {
                ParentBuildAction parentBuildAction = i.getAction(ParentBuildAction.class);
                if (parentBuildAction != null && dynamicBuild.equals(parentBuildAction.getParent())) {
                    q.cancel(i);
                }
            }
            for (DynamicSubProject c : dynamicBuild.getAllSubProjects()) {
                DynamicSubBuild b = c.getBuildByNumber(n);
                if (b != null && b.isBuilding()) {
View Full Code Here

        this.task = task;
    }

    @Override
    public boolean cancel(boolean mayInterruptIfRunning) {
        Queue q = Jenkins.getInstance().getQueue();
        synchronized (q) {
            synchronized (this) {
                if(!executors.isEmpty()) {
                    if(mayInterruptIfRunning)
                        for (Executor e : executors)
                            e.interrupt();
                    return mayInterruptIfRunning;
                }
                return q.cancel(task);
            }
        }
    }
View Full Code Here

        if (descriptor != null && descriptor.shouldKeepInWorkspace) {
          return null;
        }

        // Check for builds in the queue which have the same emulator config as this task
        Queue queue = Hudson.getInstance().getQueue();
        for (BuildableItem item : queue.getBuildableItems()) {
            Task queuedTask = item.task;
            if (task == queuedTask) {
                continue;
            }

            // If build with matching config is about to start (is "pending"), hold off for a moment
            if (queue.isPending(queuedTask)) {
                String queuedTaskHash = getEmulatorConfigHashForTask(node, queuedTask);
                if (desiredHash.equals(queuedTaskHash)) {
                    return CauseOfBlockage.fromMessage(Messages._WAITING_FOR_EMULATOR());
                }
            }
View Full Code Here

                Queue.Item item = job.getQueueItem();
                if (item != null) {
                    return item;
                }
            } else {
                Queue queue = Hudson.getInstance().getQueue();
                Queue.Item[] items = queue.getItems();
                if (items != null && items.length > 0) {
                    return items[0];
                }
            }
        } catch (Exception e) {
View Full Code Here

    protected void cancelItem(Queue.Item item, String builderName, String label) {
        LOGGER.info("Cancelling Item ");
        try {

            if (item != null) {
                Queue queue = Queue.getInstance();
                boolean canceled = queue.cancel(item);
                LOGGER.warning("Build " + label + " " + builderName
                        + " has been canceled");
            }
        } catch (Exception e) {
            LOGGER.log(Level.SEVERE,
View Full Code Here

        }
    }

    protected boolean isBuildRunning() {
        boolean running = true;
        Queue queue = Hudson.getInstance().getQueue();
        if (queue != null) {
            Queue.Item[] items = queue.getItems();
            if (items.length == 0)
                running = false;
        }

        return running;
View Full Code Here

        return Arrays.asList("queue","q");
    }

    public void executeCommand(Bot bot, IMChat chat, IMMessage message,
                               Sender sender, String[] args) throws IMException {
    Queue queue = Hudson.getInstance().getQueue();
    Item[] items = queue.getItems();
    String reply;
    if (items.length > 0) {
      StringBuffer msg = new StringBuffer();
      msg.append("Build queue:");
      for (Item item : queue.getItems()) {
        msg.append("\n- ")
        .append(item.task.getFullDisplayName())
        .append(": ").append(item.getWhy());
      }
      reply = msg.toString();
View Full Code Here

TOP

Related Classes of hudson.model.Queue$BuildableItem

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.