1 | package schedframe.scheduling.policy.global; |
---|
2 | |
---|
3 | import java.util.ArrayList; |
---|
4 | import java.util.HashSet; |
---|
5 | import java.util.List; |
---|
6 | import java.util.Set; |
---|
7 | |
---|
8 | import org.apache.commons.logging.Log; |
---|
9 | import org.apache.commons.logging.LogFactory; |
---|
10 | |
---|
11 | import schedframe.scheduling.GridResourceDiscovery; |
---|
12 | import schedframe.scheduling.Scheduler; |
---|
13 | import schedframe.scheduling.manager.resources.ManagedResources; |
---|
14 | import schedframe.scheduling.plugin.SchedulingPlugin; |
---|
15 | import schedframe.scheduling.plugin.estimation.ExecutionTimeEstimationPlugin; |
---|
16 | import schedframe.scheduling.plugin.grid.ModuleListImpl; |
---|
17 | import schedframe.scheduling.queue.TaskQueueList; |
---|
18 | |
---|
19 | public class GridBroker extends GlobalManagementSystem { |
---|
20 | |
---|
21 | private static Log log = LogFactory.getLog(GridBroker.class); |
---|
22 | |
---|
23 | protected Set<Integer> otherGridSchedulersIds; |
---|
24 | |
---|
25 | |
---|
26 | public GridBroker(String name, SchedulingPlugin schedulingPlugin, ExecutionTimeEstimationPlugin execTimeEstimationPlugin, TaskQueueList queues) throws Exception { |
---|
27 | super(name, "BROKER", schedulingPlugin, execTimeEstimationPlugin, queues); |
---|
28 | |
---|
29 | otherGridSchedulersIds = new HashSet<Integer>(); |
---|
30 | moduleList = new ModuleListImpl(2); |
---|
31 | } |
---|
32 | |
---|
33 | public void init(Scheduler scheduler, ManagedResources managedResources) { |
---|
34 | super.init(scheduler, managedResources); |
---|
35 | this.moduleList.add((GridResourceDiscovery)resourceManager); |
---|
36 | } |
---|
37 | |
---|
38 | public List<Integer> getMyGridResources() { |
---|
39 | List<Integer> providerIds = new ArrayList<Integer>(); |
---|
40 | for(Scheduler sched: scheduler.getChildren()){ |
---|
41 | providerIds.add(sched.get_id()); |
---|
42 | } |
---|
43 | return providerIds; |
---|
44 | } |
---|
45 | |
---|
46 | public void addOtherGridSchedulerId(int id){ |
---|
47 | otherGridSchedulersIds.add(id); |
---|
48 | } |
---|
49 | |
---|
50 | |
---|
51 | } |
---|