MachineManagedJob minor corrections. CheckOperator corrected, managedJob...

MachineManagedJob minor corrections. CheckOperator corrected, managedJob operator checkIfResourceIsAvailable should have caller
parent a759c398
...@@ -56,6 +56,7 @@ class MachineManagedJob(MachineJobShop): ...@@ -56,6 +56,7 @@ class MachineManagedJob(MachineJobShop):
self.broker = Broker(self) self.broker = Broker(self)
activate(self.broker,self.broker.run()) activate(self.broker,self.broker.run())
#create a Router #create a Router
# TODO: this is already performed in __init__ of Machine
from Globals import G from Globals import G
if len(G.RoutersList)==0: if len(G.RoutersList)==0:
self.router=Router() self.router=Router()
...@@ -94,8 +95,8 @@ class MachineManagedJob(MachineJobShop): ...@@ -94,8 +95,8 @@ class MachineManagedJob(MachineJobShop):
# if the machine's Id is in the list of the entity's next stations # if the machine's Id is in the list of the entity's next stations
if activeObject.id in thecallerentity.remainingRoute[0].get('stationIdsList',[]): if activeObject.id in thecallerentity.remainingRoute[0].get('stationIdsList',[]):
#return according to the state of the Queue #return according to the state of the Queue
return len(activeObject.getActiveObjectQueue())<activeObject.capacity\ return len(activeObjectQueue)<activeObject.capacity\
and activeObject.Up and activeObject.checkIfMachineIsUp()
return False return False
# ======================================================================= # =======================================================================
...@@ -104,6 +105,7 @@ class MachineManagedJob(MachineJobShop): ...@@ -104,6 +105,7 @@ class MachineManagedJob(MachineJobShop):
# also updates the giver to the one that is to be taken # also updates the giver to the one that is to be taken
# ======================================================================= # =======================================================================
def canAcceptAndIsRequested(self,callerObject=None): def canAcceptAndIsRequested(self,callerObject=None):
# print self.id, 'CAAIR'
# get active and giver objects # get active and giver objects
activeObject=self.getActiveObject() activeObject=self.getActiveObject()
activeObjectQueue=self.getActiveObjectQueue() activeObjectQueue=self.getActiveObjectQueue()
...@@ -127,7 +129,6 @@ class MachineManagedJob(MachineJobShop): ...@@ -127,7 +129,6 @@ class MachineManagedJob(MachineJobShop):
if activeObject.checkIfActive() and len(activeObjectQueue)<activeObject.capacity\ if activeObject.checkIfActive() and len(activeObjectQueue)<activeObject.capacity\
and activeObject.checkOperator(giverObject): and activeObject.checkOperator(giverObject):
if not giverObject.exitIsAssignedTo(): if not giverObject.exitIsAssignedTo():
# print self.id, 'assigning givers exit'
giverObject.assignExitTo(activeObject) giverObject.assignExitTo(activeObject)
elif giverObject.exitIsAssignedTo()!=activeObject: elif giverObject.exitIsAssignedTo()!=activeObject:
return False return False
...@@ -202,10 +203,8 @@ class MachineManagedJob(MachineJobShop): ...@@ -202,10 +203,8 @@ class MachineManagedJob(MachineJobShop):
giverObjectQueue=giverObject.getActiveObjectQueue() giverObjectQueue=giverObject.getActiveObjectQueue()
if giverObjectQueue[0].manager: if giverObjectQueue[0].manager:
manager=giverObjectQueue[0].manager manager=giverObjectQueue[0].manager
# print '' # TODO: consider using a caller in this case
# print 'Entity',self.giver.getActiveObjectQueue()[0].id return manager.checkIfResourceIsAvailable(activeObject)
# print 'manager',manager.id
return manager.checkIfResourceIsAvailable()
else: else:
return True return True
# if candidateEntity: # if candidateEntity:
...@@ -225,20 +224,6 @@ class MachineManagedJob(MachineJobShop): ...@@ -225,20 +224,6 @@ class MachineManagedJob(MachineJobShop):
# maybe we should work this way in all CoreObjects??? # maybe we should work this way in all CoreObjects???
return self.entityToGet return self.entityToGet
# # =======================================================================
# # checks if the object is ready to receive an Entity
# # =======================================================================
# def isReadyToGet(self):
# # check if the entity that is about to be obtained has a manager (this should be true for this object)
# if self.entityToGet.manager:
# manager=self.entityToGet.manager
# if len(manager.activeCallersList)>0:
# manager.sortEntities() # sort the callers of the manager to be used for scheduling rules
# # return true if the manager is available
# return manager.checkIfResourceIsAvailable()
# else:
# return True
# # ======================================================================= # # =======================================================================
# # prepare the machine to be released # # prepare the machine to be released
......
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