Esempio n. 1
0
    def run(self):
        super(Lims, self).runSimulate()
        # Do the work

        # post processing
        properties = {}
        tokens = self.getTokenList().getTokensByOwnerAndSpec("ap", self, properties, lockedState=True)
        if tokens == None or len(tokens) == 0:
            utils.logTrace("No Assay Plate barcode")
        tokenApInProcess = tokens[0]
        barcodeAP = tokenApInProcess.getProperty("barcodeAP")
        properties = {}
        tokens = self.getTokenList().getTokensByOwnerAndSpec("sp", None, properties, lockedState=False)
        numreq = 3
        for token in tokens:
            color = token.getProperty("color")
            if color == "free":
                token.setProperty("barcodeAP", barcodeAP)
                token.setProperty("prevTransition", "lims")
                token.setProperty("color", "reserved")
                numreq -= 1
                if numreq <= 0:
                    break

        # Complete transition
        super(Lims, self).complete()
        utils.log("Exit " + self.getName() + " " + repr(os.getpid()) + " " + threading.currentThread().getName())
        exit()
Esempio n. 2
0
 def setProperty(self, prop, value):
     if prop == None or value == None:
         utils.logTrace("Attempt to set illegal property " + repr(prop) + " value: " + repr(value))
     if prop in self.properties:
         old = ""
         if self.properties[prop] != None:
             old = self.properties[prop]
         utils.log("Replacing " + prop + " old value: " + old + " new value " + value)
     self.properties[prop] = value
Esempio n. 3
0
 def launchTransitionItemObject(self, transitionItemObject, reqPropertyValues={}):
     try:
         utils.log("Launching " + transitionItemObject.getName())
         msg = tokenList.dump(
             "-------Before Launch "
             + transitionItemObject.getName()
             + " ID: "
             + transitionItemObject.getId()
             + " Active Transitions "
             + str(self.petriNet.getTotalActive())
         )
         utils.log(msg, "trace_" + str(utils.sessionID) + ".txt")
         for stateName in self.requiredTokensByState.keys():
             tokenSpec = self.requiredTokensByState[stateName]
             numLocked = transitionItemObject.getTokenList().lock(
                 stateName, tokenSpec, transitionItemObject, reqPropertyValues
             )
             if tokenSpec[1] != numLocked:
                 utils.logTrace("Could not lock sufficient tokens for " + stateName)
         transitionItemObject.getTransitionMaster().transitionItemsRunning.append(transitionItemObject)
         self.addActiveThread(transitionItemObject)
         utils.log(
             "Tokens after launch of "
             + transitionItemObject.getName()
             + " "
             + self.petriNet.PrintTokenList(self.transitionName)
         )
         msg = tokenList.dump(
             "-------Running "
             + transitionItemObject.getName()
             + " ID: "
             + transitionItemObject.getId()
             + " Active Transitions "
             + str(self.petriNet.getTotalActive())
         )
         utils.log(msg, "trace_" + str(utils.sessionID) + ".txt")
         # Run the transition as independently as possible
         transitionItemObject.runTopLevel()
     finally:
         pass