Package hudson.model

Examples of hudson.model.Executor


        when(t.getEstimatedDuration()).thenReturn(10000L);
        when(t.getSubTasks()).thenReturn((Collection) asList(t));


        Computer c = createMockComputer(2);
        Executor e = c.getExecutors().get(0);

        when(e.isIdle()).thenReturn(false);
        when(e.getEstimatedRemainingTimeMillis()).thenReturn(300L);

        JobOffer o = createMockOffer(c.getExecutors().get(1));

        MappingWorksheet mw = new MappingWorksheet(wrap(t), asList(o));
View Full Code Here


        when(c.getNode()).thenReturn(n);

        List executors = new CopyOnWriteArrayList();

        for (int i=0; i<nExecutors; i++) {
            Executor e = mock(Executor.class);
            when(e.isIdle()).thenReturn(true);
            when(e.getOwner()).thenReturn(c);
            executors.add(e);
        }

        Field f = Computer.class.getDeclaredField("executors");
        f.setAccessible(true);
View Full Code Here

        startLatch = new Latch(workUnitSize) {
            @Override
            protected void onCriteriaMet() {
                // on behalf of the member Executors,
                // the one that executes the main thing will send notifications
                Executor e = Executor.currentExecutor();
                if (e.getCurrentWorkUnit().isMainWork()) {
                    e.getOwner().taskAccepted(e,task);
                }
            }
        };

        endLatch = new Latch(workUnitSize);
View Full Code Here

     */
    public void synchronizeEnd(Queue.Executable executable, Throwable problems, long duration) throws InterruptedException {
        endLatch.synchronize();

        // the main thread will send a notification
        Executor e = Executor.currentExecutor();
        WorkUnit wu = e.getCurrentWorkUnit();
        if (wu.isMainWork()) {
            if (problems == null) {
                future.set(executable);
                e.getOwner().taskCompleted(e, task, duration);
            } else {
                future.set(problems);
                e.getOwner().taskCompletedWithProblems(e, task, duration, problems);
            }
        }
    }
View Full Code Here

        startLatch.abort(cause);
        endLatch.abort(cause);

        Thread c = Thread.currentThread();
        for (WorkUnit wu : workUnits) {
            Executor e = wu.getExecutor();
            if (e!=null && e!=c)
                e.interrupt();
        }
    }
View Full Code Here

            try {
                return p.getExecutionStrategy().run(MatrixBuild.this, aggregators, listener);
            } catch( InterruptedException e ) {
                logger.println("Aborted");
                Executor x = Executor.currentExecutor();
                x.recordCauseOfInterruption(MatrixBuild.this, listener);
                return x.abortResult();
            } 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) {
                                logger.println(Messages.MatrixBuild_Interrupting(ModelHyperlinkNote.encodeTo(b)));
                                exe.interrupt();
                            }
                        }
                    }
                }
            }
View Full Code Here

        Run b = p.getBuildByNumber(Integer.parseInt(id.number));
        if (b==null)
            throw new AbortException("No such build: "+id.number);

        Executor exec = b.getExecutor();
        if (exec==null)
            throw new AbortException(b.getFullDisplayName()+" is not building");

        Node node = exec.getOwner().getNode();

        t = t.translate(node, EnvVars.getRemote(checkChannel()), new StreamTaskListener(stderr));
        stdout.println(t.getHome());
        return 0;
    }
View Full Code Here

                }
            }
            for (DynamicSubProject c : dynamicBuild.getAllSubProjects()) {
                DynamicSubBuild b = c.getBuildByNumber(n);
                if (b != null && b.isBuilding()) {
                    Executor exe = b.getExecutor();
                    if (exe != null) {
                        logger.println(Messages.MatrixBuild_Interrupting(ModelHyperlinkNote.encodeTo(b)));
                        exe.interrupt();
                    }
                }
            }
        }
    }
View Full Code Here

                for (String error : invalidBuildConfigurationException.getValidationErrors()) {
                    listener.error(error);
                }
                return Result.FAILURE;
            }catch (InterruptedException e) {
                Executor x = Executor.currentExecutor();
                x.recordCauseOfInterruption(DynamicBuild.this, listener);
                return x.abortResult();
            }catch (Exception e) {
                PrintStream logger = listener.getLogger();
                logger.println(e.getMessage());
                logger.println(ExceptionUtils.getStackTrace(e));
                Executor x = Executor.currentExecutor();
                x.recordCauseOfInterruption(DynamicBuild.this, listener);
                x.doStop();
                return Result.FAILURE;
            } finally {
                if (buildEnvironment.tearDownBuildEnvironments(listener)) {
                    return Result.FAILURE;
                }
View Full Code Here

                throw new CommandException(
                        sender.getNickname() + ": it appears this job has never been built");
            }
           
            // TODO: do build.doStop() instead of the following lines when moving to core 1.489!
            Executor ex = build.getExecutor();
            if (ex == null) {
                aborted = false; // how the hell does this happen o_O
            } else {
                ex.interrupt();
                aborted = true;
            }
        }

        if (aborted) {
View Full Code Here

TOP

Related Classes of hudson.model.Executor

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.