File D:\maven-qcr-plugin-testsunitaires\qcr4java\jenkins-master\target\site\qc\core\src\main\java\hudson\model\queue\SubTask.java.html

1 /*
2 * The MIT License
3 *
4 * Copyright (c) 2010, InfraDNA, Inc.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 * THE SOFTWARE.
23 */
24 package hudson.model.queue;
25
26 import hudson.model.Executor;
27 import hudson.model.Label;
28 import hudson.model.Node;
29 import hudson.model.Queue.Executable;
30 import hudson.model.Queue.Task;
31 import hudson.model.ResourceActivity;
32
33 import java.io.IOException;
34
35 /**
36 * A component of {@link Task} that represents a computation carried out by a single {@link Executor}.
37 *
38 * A {@link Task} consists of a number of {@link SubTask}.
39 *
40 * <p>
41 * Plugins are encouraged to extend from {@link AbstractSubTask}
42 * instead of implementing this interface directly, to maintain
43 * compatibility with future changes to this interface.
44 *
45 * @since 1.377
46 */
47 public interface SubTask extends ResourceActivity {
48 /**
49 * If this task needs to be run on a node with a particular label,
50 * return that {@link Label}. Otherwise null, indicating
51 * it can run on anywhere.
52 */
53 Label getAssignedLabel();
54
55 /**
56 * If the previous execution of this task run on a certain node
57 * and this task prefers to run on the same node, return that.
58 * Otherwise null.
59 */
60 Node getLastBuiltOn();
61
62 /**
63 * Estimate of how long will it take to execute this task.
64 * Measured in milliseconds.
65 *
66 * @return -1 if it's impossible to estimate.
67 */
68 long getEstimatedDuration();
69
70 /**
71 * Creates {@link Executable}, which performs the actual execution of the task.
72 */
73 Executable createExecutable() throws IOException;
74
75 /**
76 * Gets the {@link Task} that this subtask belongs to.
77 */
78 Task getOwnerTask();
79
80 /**
81 * If a subset of {@link SubTask}s of a {@link Task} needs to be collocated with other {@link SubTask}s,
82 * those {@link SubTask}s should return the equal object here. If null, the execution unit isn't under a
83 * colocation constraint.
84 */
85 Object getSameNodeConstraint();
86 }
87