Package hudson.model

Examples of hudson.model.Computer$ListPossibleNames


            }
        }

        Multimap<Computer,iOSDevice> devices = LinkedHashMultimap.create();
        for (Entry<Future<List<iOSDevice>>, Computer> e : futures.entrySet()) {
            Computer c = e.getValue();
            try {
                List<iOSDevice> devs = e.getKey().get();
                for (iOSDevice d : devs)
                    d.computer = c;
                devices.putAll(c, devs);
            } catch (Exception x) {
                x.printStackTrace(listener.error("Failed to list up iOS devices on "+c.getName()));
            }
        }

        this.devices = devices;
    }
View Full Code Here


            if (m==null)    return null;

            // figure out how many executors we need on each computer?
            Map<Computer,Integer> footprint = new HashMap<Computer, Integer>();
            for (Entry<WorkChunk, ExecutorChunk> e : m.toMap().entrySet()) {
                Computer c = e.getValue().computer;
                Integer v = footprint.get(c);
                if (v==null)    v = 0;
                v += e.getKey().size();
                footprint.put(c,v);
            }

            // the point of a tentative plan is to displace other jobs to create a point in time
            // where this task can start executing. An incorrectly estimated duration is not
            // a problem in this regard, as we just need enough idle executors in the right moment.
            // The downside of guessing the duration wrong is that we can end up creating tentative plans
            // afterward that may be incorrect, but those plans will be rebuilt.
            long d = bi.task.getEstimatedDuration();
            if (d<=0)    d = TimeUnit2.MINUTES.toMillis(5);

            TimeRange slot = new TimeRange(System.currentTimeMillis(), d);

            // now, based on the real predicted loads, figure out the approximation of when we can
            // start executing this guy.
            for (Entry<Computer, Integer> e : footprint.entrySet()) {
                Computer computer = e.getKey();
                Timeline timeline = new Timeline();
                for (LoadPredictor lp : LoadPredictor.all()) {
                    for (FutureLoad fl : Iterables.limit(lp.predict(worksheet, computer, slot.start, slot.end),100)) {
                        timeline.insert(fl.startTime, fl.startTime+fl.duration, fl.numExecutors);
                    }
                }

                Long x = timeline.fit(slot.start, slot.duration, computer.countExecutors()-e.getValue());
                // if no suitable range was found in [slot.start,slot.end), slot.end would be a good approximation
                if (x==null)    x = slot.end;
                slot = slot.shiftTo(x);
            }
View Full Code Here

  @Override
  protected void buildEnvVars(EnvVars env, MavenInstallation mi) throws IOException, InterruptedException {
    super.buildEnvVars(env, mi);
    // Override JDK in case it is set on Sonar publisher
    if (jdk != null) {
      Computer computer = Computer.currentComputer();
      if (computer != null) {
        // just in case were not in a build
        jdk = jdk.forNode(computer.getNode(), listener);
      }
      jdk.buildEnvVars(env);
    }
  }
View Full Code Here

  }

  private void computeJdkToUse(AbstractBuild<?, ?> build, BuildListener listener, EnvVars env) throws IOException, InterruptedException {
    JDK jdkToUse = getJdkToUse(build.getProject());
    if (jdkToUse != null) {
      Computer computer = Computer.currentComputer();
      // just in case we are not in a build
      if (computer != null) {
        jdkToUse = jdkToUse.forNode(computer.getNode(), listener);
      }
      jdkToUse.buildEnvVars(env);
    }
  }
View Full Code Here

     */
    public boolean shouldDisplaySummary(StaplerRequest request) {
        List<Ancestor> ancestors = request.getAncestors();
        Ancestor ancestor = ancestors.get(ancestors.size() - 1);
        if (ancestor.getObject() instanceof Computer) {
            Computer computer = (Computer)ancestor.getObject();
            return computer.getNode().getNodeProperties().get(MetadataNodeProperty.class) == this;
        }
        return false;
    }
View Full Code Here

    build = build_;
    listener = listener_;
    launcher = launcher_;
    sdk = sdk_;

    final Computer computer = Computer.currentComputer();

    // Use the Port Allocator plugin to reserve the two ports we need
    portAllocator = PortAllocationManager.getManager(computer);
    final int PORT_RANGE_START = 5560;
    final int PORT_RANGE_END = 5900;
View Full Code Here

            // Push modern variables
            target.put("NODE_NAME", nodeName.isEmpty() ? "master" : nodeName);
            target.put("NODE_LABELS", Util.join(node.getAssignedLabels(), " "));
           
            // Get environment
            Computer c = node.toComputer();
            if (c != null) {
                try {
                    EnvVars env = c.getEnvironment().overrideAll(target);
                    target.putAll(env);
                } catch (IOException ex) {
                    // Ignore exception
                }
            }
View Full Code Here

   
    @Nonnull
    private static String getHostName(@Nonnull Node node) {
        String host = null;
        try {
            Computer c = node.toComputer();
            if (c != null) {
                host = c.getHostName();
            }
        } catch (Exception ex) {
            // fallback to finally
        } finally {
            if (host == null) {
View Full Code Here

                try {
                    Executor exec = Executor.currentExecutor();
                    if (exec == null) {
                        throw new IllegalStateException("running task without associated executor thread");
                    }
                    Computer computer = exec.getOwner();
                    // Set up context for other steps inside this one.
                    Node node = computer.getNode();
                    if (node == null) {
                        throw new IllegalStateException("running computer lacks a node");
                    }
                    TaskListener listener = context.get(TaskListener.class);
                    Launcher launcher = node.createLauncher(listener);
                    Run<?,?> r = context.get(Run.class);
                    if (cookie == null) {
                        // First time around.
                        cookie = UUID.randomUUID().toString();
                        // Switches the label to a self-label, so if the executable is killed and restarted via ExecutorPickle, it will run on the same node:
                        label = computer.getName();
                        EnvVars env = computer.buildEnvironment(listener);
                        env.put(COOKIE_VAR, cookie);
                        synchronized (runningTasks) {
                            runningTasks.put(cookie, context);
                        }
                        // For convenience, automatically allocate a workspace, like WorkspaceStep would:
                        Job<?,?> j = r.getParent();
                        if (!(j instanceof TopLevelItem)) {
                            throw new Exception(j + " must be a top-level job");
                        }
                        FilePath p = node.getWorkspaceFor((TopLevelItem) j);
                        if (p == null) {
                            throw new IllegalStateException(node + " is offline");
                        }
                        WorkspaceList.Lease lease = computer.getWorkspaceList().allocate(p);
                        FilePath workspace = lease.path;
                        FlowNode flowNode = context.get(FlowNode.class);
                        flowNode.addAction(new WorkspaceActionImpl(workspace, flowNode));
                        listener.getLogger().println("Running on " + computer.getDisplayName() + " in " + workspace); // TODO hyperlink
                        context.invokeBodyLater(exec, computer, env, workspace).addCallback(new Callback(cookie, lease));
                        LOGGER.log(Level.FINE, "started {0}", cookie);
                    } else {
                        // just rescheduled after a restart; wait for task to complete
                        LOGGER.log(Level.FINE, "resuming {0}", cookie);
View Full Code Here

                Jenkins j = Jenkins.getInstance();
                if (j == null) {
                    LOGGER.fine("Jenkins is not running");
                    return null;
                }
                Computer c = j.getComputer(node);
                if (c == null) {
                    LOGGER.log(Level.FINE, "no such computer {0}", node);
                    return null;
                }
                if (c.isOffline()) {
                    LOGGER.log(Level.FINE, "{0} is offline", node);
                    return null;
                }
                ws = new FilePath(c.getChannel(), remote);
            }
            boolean directory;
            try {
                directory = ws.isDirectory();
            } catch (Exception x) {
View Full Code Here

TOP

Related Classes of hudson.model.Computer$ListPossibleNames

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.