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 ? ...@@ -57,6 +57,8 @@ class Operator(Repairman): # XXX isn't it the other way around ?
"NumStages", "RPC", "LPT", "SPT", "MS", "WINQ"): "NumStages", "RPC", "LPT", "SPT", "MS", "WINQ"):
raise ValueError("Unknown scheduling rule %s for %s" % raise ValueError("Unknown scheduling rule %s for %s" %
(scheduling_rule, id)) (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 # sorts the Entities of the Queue according to the scheduling rule
......
...@@ -34,9 +34,9 @@ from Operator import Operator ...@@ -34,9 +34,9 @@ from Operator import Operator
# =========================================================================== # ===========================================================================
class OperatorManagedJob(Operator): class OperatorManagedJob(Operator):
def __init__(self, id, name, capacity=1,schedulingRule="FIFO"): # def __init__(self, id, name, capacity=1,schedulingRule="FIFO"):
Operator.__init__(self,id=id,name=name,capacity=capacity,schedulingRule=schedulingRule) # Operator.__init__(self,id=id,name=name,capacity=capacity,schedulingRule=schedulingRule)
self.operatorAssignedTo=None # self.operatorAssignedTo=None
# ======================================================================= # =======================================================================
# checks if the worker is available # checks if the worker is available
......
...@@ -53,7 +53,7 @@ class OperatorPreemptive(Operator): ...@@ -53,7 +53,7 @@ class OperatorPreemptive(Operator):
def checkIfResourceCanPreempt(self,callerObject=None): def checkIfResourceCanPreempt(self,callerObject=None):
# TODO: to discuss with George about the use of callerObject # TODO: to discuss with George about the use of callerObject
activeResource= self.getResource() activeResource= self.getResource()
activeResourceQueue = activeResource.getResourceQueue() activeResourceQueue = self.getResourceQueue()
# find out which station is requesting the operator? # find out which station is requesting the operator?
thecaller=callerObject thecaller=callerObject
# assert that the callerObject is not None # assert that the callerObject is not None
...@@ -101,14 +101,6 @@ class OperatorPreemptive(Operator): ...@@ -101,14 +101,6 @@ class OperatorPreemptive(Operator):
pass pass
return len(self.Res.activeQ)<self.capacity 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 # override the default method so that Entities
# that are critical got served first # that are critical got served first
......
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