1 | package schedframe.scheduling.plugin.local; |
---|
2 | |
---|
3 | |
---|
4 | import java.util.List; |
---|
5 | |
---|
6 | import schedframe.exceptions.ReservationException; |
---|
7 | import schedframe.scheduling.AbstractResourceRequirements; |
---|
8 | import schedframe.scheduling.AbstractTimeRequirements; |
---|
9 | import schedframe.scheduling.Offer; |
---|
10 | import schedframe.scheduling.Queue; |
---|
11 | import schedframe.scheduling.Reservation; |
---|
12 | import schedframe.scheduling.ResourceUsage; |
---|
13 | import schedframe.scheduling.TaskInterface; |
---|
14 | import schedframe.scheduling.TimeResourceAllocation; |
---|
15 | import schedframe.scheduling.events.SchedulingEvent; |
---|
16 | import schedframe.scheduling.events.SchedulingResponseType; |
---|
17 | import test.rewolucja.GSSIMJobInterface; |
---|
18 | import test.rewolucja.reservation.LocalReservationManagerNew; |
---|
19 | import test.rewolucja.reservation.ReservationNew; |
---|
20 | import test.rewolucja.resources.manager.interfaces.ResourceManagerInterface; |
---|
21 | import test.rewolucja.scheduling.JobRegistryInterface; |
---|
22 | import test.rewolucja.scheduling.queue.QueueList; |
---|
23 | |
---|
24 | |
---|
25 | /** |
---|
26 | * This interface represents methods of a local scheduling plugin with advance reservation functionality. |
---|
27 | * |
---|
28 | * @author Ariel |
---|
29 | */ |
---|
30 | public interface LocalSchedulingARPlugin extends LocalSchedulingPlugin { |
---|
31 | |
---|
32 | /** |
---|
33 | * Check scheduler knowledge about requested reservation status. |
---|
34 | * |
---|
35 | * @param reservation |
---|
36 | * @param reservationManager |
---|
37 | * @return reservation status (see {@link schedframe.scheduling.Reservation.Status}) |
---|
38 | * @throws ReservationException if some error occurs |
---|
39 | */ |
---|
40 | public ReservationNew.Status getStatus(ReservationNew reservation, LocalReservationManager reservationManager) |
---|
41 | throws ReservationException; |
---|
42 | |
---|
43 | /** |
---|
44 | * Calculates offers which satisfies time and resource requirements |
---|
45 | * |
---|
46 | * @param timeReqs time constraints |
---|
47 | * @param resReqs resource requirements |
---|
48 | * @param inExecution list of task which are currently running |
---|
49 | * @param queues list of queues in which tasks are waiting for execution |
---|
50 | * @param unitsManager |
---|
51 | * @param reservationManager |
---|
52 | * @return offers for resource consumers |
---|
53 | * @throws ReservationException if some error occurs |
---|
54 | */ |
---|
55 | public List<Offer> getOffers(AbstractTimeRequirements<?> timeReqs, |
---|
56 | AbstractResourceRequirements<?> resReqs, |
---|
57 | JobRegistryInterface jobRegistry, |
---|
58 | QueueList queues, |
---|
59 | ResourceManagerInterface resourceManager, |
---|
60 | LocalReservationManager reservationManager) |
---|
61 | throws ReservationException; |
---|
62 | |
---|
63 | /** |
---|
64 | * Creates list of reservations, one for each time interval described in resource usage. |
---|
65 | * Depends form implementation, created reservation may be final - ready to be used |
---|
66 | * or initial - requires commit step to reach final state. |
---|
67 | * If the reservation is not committed before certain time the initial reservation expires. |
---|
68 | * |
---|
69 | * @param resourceUsage describes resources which should be reserved and time constraints |
---|
70 | * @param inExecution list of tasks which are currently running |
---|
71 | * @param queues list of queues in which tasks are waiting for execution |
---|
72 | * @param unitsManager |
---|
73 | * @param reservationManager |
---|
74 | * @return reservation |
---|
75 | * @throws ReservationException if reservation can not be created |
---|
76 | */ |
---|
77 | public List<ReservationNew> createReservation(ResourceUsage resourceUsage, |
---|
78 | JobRegistryInterface jobRegistry, |
---|
79 | QueueList queues, |
---|
80 | ResourceManagerInterface resourceManager, |
---|
81 | LocalReservationManager reservationManager) |
---|
82 | throws ReservationException; |
---|
83 | |
---|
84 | /** |
---|
85 | * Creates reservation for resources described by resourceUsage parameter. |
---|
86 | * Depends form implementation, created reservation may be final - ready to be used |
---|
87 | * or initial - requires commit step to reach final state. |
---|
88 | * If the reservation is not committed before certain time the initial reservation expires. |
---|
89 | * Otherwise provider should accept the commitment. |
---|
90 | * |
---|
91 | * @param timeRequirements describes interval of time which should be reserved |
---|
92 | * @param resourceRequirements describes type and amount of the resource which |
---|
93 | * should be reserved |
---|
94 | * @param inExecution list of tasks which are currently running |
---|
95 | * @param queues list of queues in which tasks are waiting for execution |
---|
96 | * @param unitsManager |
---|
97 | * @param reservationManager |
---|
98 | * @return reservation |
---|
99 | * @throws ReservationException if reservation can not be created |
---|
100 | */ |
---|
101 | public ReservationNew createReservation(AbstractTimeRequirements<?> timeRequirements, |
---|
102 | AbstractResourceRequirements<?> resourceRequirements, |
---|
103 | JobRegistryInterface jobRegistry, |
---|
104 | QueueList queues, |
---|
105 | ResourceManagerInterface resourceManager, |
---|
106 | LocalReservationManager reservationManager) |
---|
107 | throws ReservationException; |
---|
108 | |
---|
109 | /** |
---|
110 | * Commits reservation or reject the request |
---|
111 | * |
---|
112 | * @param initialReservation reservation which should be committed |
---|
113 | * @param inExecution list of tasks which are currently running |
---|
114 | * @param queues list of queues in which tasks are waiting for execution |
---|
115 | * @param unitsManager |
---|
116 | * @param reservationManager |
---|
117 | * @return reservation if the reservation has been accepted |
---|
118 | * @throws ReservationException if reservation can not be committed |
---|
119 | */ |
---|
120 | public ReservationNew commitReservation(ReservationNew initialReservation, |
---|
121 | JobRegistryInterface jobRegistry, |
---|
122 | QueueList queues, |
---|
123 | ResourceManagerInterface resourceManager, |
---|
124 | LocalReservationManager reservationManager) |
---|
125 | throws ReservationException; |
---|
126 | |
---|
127 | /** |
---|
128 | * Commits reservation or reject the request |
---|
129 | * |
---|
130 | * @param initialReservation reservation which should be committed |
---|
131 | * @param resourceUsage expected modification of initial reservation |
---|
132 | * @param inExecution list of tasks which are currently running |
---|
133 | * @param queues list of queues in which tasks are waiting for execution |
---|
134 | * @param unitsManager |
---|
135 | * @param reservationManager |
---|
136 | * @return reservation if the reservation has been accepted |
---|
137 | * @throws ReservationException if reservation can not be committed |
---|
138 | */ |
---|
139 | public ReservationNew commitReservation(ReservationNew initialReservation, |
---|
140 | TimeResourceAllocation resourceUsage, |
---|
141 | JobRegistryInterface jobRegistry, |
---|
142 | QueueList queues, |
---|
143 | ResourceManagerInterface resourceManager, |
---|
144 | LocalReservationManager reservationManager) |
---|
145 | throws ReservationException; |
---|
146 | |
---|
147 | |
---|
148 | /** |
---|
149 | * Cancels reservation |
---|
150 | * |
---|
151 | * @param reservation which should be canceled |
---|
152 | * @param inExecution list of tasks which are currently running |
---|
153 | * @param queues list of queues in which tasks are waiting for execution |
---|
154 | * @param reservationManager |
---|
155 | * @throws ReservationException if reservation can not be canceled or some error occurs |
---|
156 | */ |
---|
157 | public void cancelReservation(ReservationNew reservation, |
---|
158 | JobRegistryInterface jobRegistry, |
---|
159 | QueueList queues, |
---|
160 | LocalReservationManager reservationManager) |
---|
161 | throws ReservationException; |
---|
162 | |
---|
163 | /** |
---|
164 | * Modify reservation |
---|
165 | * |
---|
166 | * @param reservation which should be modified |
---|
167 | * @param resourceUsage describes new time and resource requirements |
---|
168 | * @param inExecution list of tasks which are currently running |
---|
169 | * @param queues list of queues in which tasks are waiting for execution |
---|
170 | * @param unitManager |
---|
171 | * @param reservationManager |
---|
172 | * @return modified reservation |
---|
173 | * @throws ReservationException if modification is not possible |
---|
174 | */ |
---|
175 | public ReservationNew modifyReservation(ReservationNew reservation, |
---|
176 | TimeResourceAllocation resourceUsage, |
---|
177 | JobRegistryInterface jobRegistry, |
---|
178 | QueueList queues, |
---|
179 | ResourceManagerInterface resourceManager, |
---|
180 | LocalReservationManager reservationManager) |
---|
181 | throws ReservationException; |
---|
182 | |
---|
183 | |
---|
184 | |
---|
185 | //Methods used for task scheduling (called when there are some changed within the system) |
---|
186 | |
---|
187 | |
---|
188 | |
---|
189 | |
---|
190 | |
---|
191 | } |
---|