operatorAssignedTo attribute collapsed to operator. checkIfResourceIsAvailable...

operatorAssignedTo attribute collapsed to operator. checkIfResourceIsAvailable of OperatorPreemptive removed as redundant
parent 54702a1b
......@@ -57,6 +57,8 @@ class Operator(Repairman): # XXX isn't it the other way around ?
"NumStages", "RPC", "LPT", "SPT", "MS", "WINQ"):
raise ValueError("Unknown scheduling rule %s for %s" %
(scheduling_rule, id))
# the station that the operator is assigned to
self.operatorAssignedTo=None
# =======================================================================
# sorts the Entities of the Queue according to the scheduling rule
......
......@@ -34,9 +34,9 @@ from Operator import Operator
# ===========================================================================
class OperatorManagedJob(Operator):
def __init__(self, id, name, capacity=1,schedulingRule="FIFO"):
Operator.__init__(self,id=id,name=name,capacity=capacity,schedulingRule=schedulingRule)
self.operatorAssignedTo=None
# def __init__(self, id, name, capacity=1,schedulingRule="FIFO"):
# Operator.__init__(self,id=id,name=name,capacity=capacity,schedulingRule=schedulingRule)
# self.operatorAssignedTo=None
# =======================================================================
# checks if the worker is available
......
......@@ -53,7 +53,7 @@ class OperatorPreemptive(Operator):
def checkIfResourceCanPreempt(self,callerObject=None):
# TODO: to discuss with George about the use of callerObject
activeResource= self.getResource()
activeResourceQueue = activeResource.getResourceQueue()
activeResourceQueue = self.getResourceQueue()
# find out which station is requesting the operator?
thecaller=callerObject
# assert that the callerObject is not None
......@@ -100,14 +100,6 @@ class OperatorPreemptive(Operator):
except:
pass
return len(self.Res.activeQ)<self.capacity
# =======================================================================
# checks if the worker is available
# =======================================================================
def checkIfResourceIsAvailable(self,callerObject=None):
activeResource= self.getResource()
activeResourceQueue = activeResource.getResourceQueue()
len(activeResourceQueue)<self.capacity
# =======================================================================
# override the default method so that Entities
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment