source: DCWoRMS/trunk/src/schedframe/scheduling/policy/global/GridBroker.java @ 481

Revision 481, 1.6 KB checked in by wojtekp, 13 years ago (diff)
  • Property svn:mime-type set to text/plain
Line 
1package schedframe.scheduling.policy.global;
2
3import java.util.ArrayList;
4import java.util.HashSet;
5import java.util.List;
6import java.util.Set;
7
8import org.apache.commons.logging.Log;
9import org.apache.commons.logging.LogFactory;
10
11import schedframe.scheduling.GridResourceDiscovery;
12import schedframe.scheduling.Scheduler;
13import schedframe.scheduling.manager.resources.ManagedResources;
14import schedframe.scheduling.plugin.SchedulingPlugin;
15import schedframe.scheduling.plugin.estimation.ExecutionTimeEstimationPlugin;
16import schedframe.scheduling.plugin.grid.ModuleListImpl;
17import schedframe.scheduling.queue.TaskQueueList;
18
19public 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}
Note: See TracBrowser for help on using the repository browser.