All Downloads are FREE. Search and download functionalities are using the official Maven repository.

hudson.model.Node Maven / Gradle / Ivy

package hudson.model;

import hudson.FilePath;
import hudson.Launcher;
import hudson.node_monitors.NodeMonitor;
import hudson.util.ClockDifference;
import hudson.util.EnumConverter;
import org.kohsuke.stapler.Stapler;

import java.io.IOException;
import java.util.Set;

/**
 * Commonality between {@link Slave} and master {@link Hudson}.
 *
 * @author Kohsuke Kawaguchi
 * @see NodeMonitor
 */
public interface Node {
    /**
     * Name of this node.
     *
     * @return
     *      "" if this is master
     */
    String getNodeName();

    /**
     * Human-readable description of this node.
     */
    String getNodeDescription();

    /**
     * Returns a {@link Launcher} for executing programs on this node.
     */
    Launcher createLauncher(TaskListener listener);

    /**
     * Returns the number of {@link Executor}s.
     *
     * This may be different from getExecutors().size()
     * because it takes time to adjust the number of executors.
     */
    int getNumExecutors();

    /**
     * Returns {@link Mode#EXCLUSIVE} if this node is only available
     * for those jobs that exclusively specifies this node
     * as the assigned node.
     */
    Mode getMode();

    /**
     * Gets the corresponding {@link Computer} object.
     *
     * @return
     *      never null.
     */
    Computer toComputer();

    Computer createComputer();

    /**
     * Returns the possibly empty set of labels that are assigned to this node,
     * including the automatic {@link #getSelfLabel() self label}.
     */
    Set

* Hudson always owns a directory on every node. This method * returns that. * * @return * null if the node is offline and hence the {@link FilePath} * object is not available. */ FilePath getRootPath(); /** * Gets the {@link FilePath} on this node. */ FilePath createPath(String absolutePath); /** * Estimates the clock difference with this slave. * * @return * always non-null. * @throws InterruptedException * if the operation is aborted. */ ClockDifference getClockDifference() throws IOException, InterruptedException; /** * Constants that control how Hudson allocates jobs to slaves. */ public enum Mode { NORMAL("Utilize this slave as much as possible"), EXCLUSIVE("Leave this machine for tied jobs only"); private final String description; public String getDescription() { return description; } public String getName() { return name(); } Mode(String description) { this.description = description; } static { Stapler.CONVERT_UTILS.register(new EnumConverter(), Mode.class); } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy