sgpemv2/src/builtin-policies/fcfs.py

34 lines
914 B
Python
Raw Normal View History

from Policy import Policy
class fcfs(Policy) :
def __init__(self):
pass;
def configure(self):
print 'No options to configure for fcfs'
def is_preemptive(self):
return False
def get_time_slice(self):
return -1
def sort_queue(self, event, queue):
print 'Entering sort_queue'
print queue.size()
print queue.get_item_at(0)
print dir(queue.get_item_at(0))
for i in range(0, queue.size()):
ss = queue.get_item_at(i)
print ss.get_schedulable().get_name()
# Uncomment this to try the qsort algorithm with FCFS
#cmpf = lambda a, b: \
# a.get_schedulable().get_arrival_time() < \
# b.get_schedulable().get_arrival_time()
#try:
# self.sort(queue,cmpf)
#except:
# print "Unexpected error:", sys.exc_info()[0]
# raise