def processQA2flag(self, ousUID, flag):
     "Flag should be one of 'F' (fail), 'P' (pass) or 'S' (semi-pass)"
     newState = "ReadyForProcessing" if (flag == "F") else "Verified"
     print(">>> Setting the state of", ousUID, "to", newState)
     # Set the OUS state according to the input flag
     dbdrwutils.setState(self.xtss, ousUID, newState)
     if flag == "F":
         dbdrwutils.setSubstate(self.xtss, ousUID, "")    # Clear Pipeline recipe
            # ts = ous['timestamp']
            # print( ">>> found", ousUID, ts )

            # Retrieve the list of products from the delivery status
            encodedUID = dbdrwutils.encode(ousUID)
            dbName = 'delivery-status'
            retcode, delStatus = dbcon.findOne(dbName, encodedUID)
            if retcode != 200:
                raise RuntimeError("find: %s: error %d: %s" %
                                   (dbName, retcode, delStatus))

            # See if all those data products were replicated here
            dataProducts = delStatus['dataProducts']
            allReplicated = True
            for dataProduct in dataProducts:
                # print( ">>> found", dataProduct )
                if (not ngas.check(dataProduct)):
                    allReplicated = False
                    break

            # YES, all those data products were replicated -- this OUS can
            #      be delivered
            if allReplicated:
                dbdrwutils.setState(xtss, ousUID, "Delivered")
                dbdrwutils.setSubstate(xtss, ousUID, "")
                dbdrwutils.clearExecutive(xtss, ousUID)
                time.sleep(5)  # Pretend this actually took some time
                print(">>> OUS", ousUID, "is now Delivered")

    dbdrwutils.incrementalSleep(startTime)
def setSubstate(ousUID, substate):
    dbdrwutils.setSubstate(xtss, ousUID, substate)
 def setSubstate(self, ousUID, substate):
     dbdrwutils.setSubstate(self.xtss, ousUID, substate)