source: DCWoRMS/trunk/src/example/localplugin/FCFSBF_LocalPlugin.java @ 574

Revision 574, 1.3 KB checked in by wojtekp, 12 years ago (diff)
  • Property svn:mime-type set to text/plain
RevLine 
[477]1package example.localplugin;
2
[493]3import gridsim.dcworms.DCWormsTags;
[477]4import schedframe.events.scheduling.SchedulingEvent;
5import schedframe.scheduling.manager.resources.ResourceManager;
6import schedframe.scheduling.manager.tasks.JobRegistry;
7import schedframe.scheduling.plan.impl.SchedulingPlan;
8import schedframe.scheduling.plugin.grid.ModuleList;
9import schedframe.scheduling.queue.TaskQueue;
10import schedframe.scheduling.queue.TaskQueueList;
11import schedframe.scheduling.tasks.TaskInterface;
12
[525]13public class FCFSBF_LocalPlugin extends BaseLocalSchedulingPlugin {
[477]14
15        public SchedulingPlan schedule(SchedulingEvent event, TaskQueueList queues, JobRegistry jobRegistry,
16                         ResourceManager resManager, ModuleList modules) {
17
18                SchedulingPlan plan = new SchedulingPlan();
[574]19                // Choose the events types to serve. Different actions for different events are possible.
[477]20                switch (event.getType()) {
21                case START_TASK_EXECUTION:
22                case TASK_FINISHED:
23                       
[531]24                        // our tasks are placed only in first queue (see BaseLocalSchedulingPlugin.placeJobsInQueues() method)
[477]25                        TaskQueue q = queues.get(0);
26                       
27                        // check all tasks in queue
28                        for (int i = 0; i < q.size(); i++) {
[513]29                                TaskInterface<?> task = q.get(i);
[477]30                               
31                                // if status of the tasks in READY
[481]32                                if (task.getStatus() == DCWormsTags.READY) {
[477]33                                        addToSchedulingPlan(plan, task);
34                                }
35                        }
36                        break;
37                }
38                return plan;
39        }
40
41}
42
Note: See TracBrowser for help on using the repository browser.