示例#1
0
 def nextChainLink(self,
                   pk,
                   passVar=None,
                   incrementLinkSplit=False,
                   subJobOf=""):
     if self.subJobOf and not subJobOf:
         subJobOf = self.subJobOf
     if incrementLinkSplit:
         self.linkSplitCount += 1
     if pk != None:
         # may 2012 - can't think why I'm threading this - TODO
         # I think it was threaded to avoid nasty stack trace problems
         #t = threading.Thread(target=self.nextChainLinkThreaded, args=(pk,), kwargs={"passVar":passVar} )
         #t.daemon = True
         #t.start()
         jobChainLink(self,
                      pk,
                      self.unit,
                      passVar=passVar,
                      subJobOf=subJobOf)
     else:
         self.linkSplitCount -= 1
         if self.linkSplitCount == 0:
             print "Done with UNIT:" + self.unit.UUID
             if self.notifyComplete:
                 self.notifyComplete(self)
示例#2
0
 def nextChainLink(self, pk, passVar=None, incrementLinkSplit=False, subJobOf=""):
     """Proceed to next link, as passed(pk)"""
     if self.subJobOf and not subJobOf:
         subJobOf = self.subJobOf
     if incrementLinkSplit:
         self.linkSplitCount += 1
     if pk != None:
         jobChainLink(self, pk, self.unit, passVar=passVar, subJobOf=subJobOf)
     else:
         self.linkSplitCount -= 1
         if self.linkSplitCount == 0:
             print "Done with UNIT:" + self.unit.UUID
             if self.notifyComplete:
                 self.notifyComplete(self)
 def __init__(self, unit, chainPK, notifyComplete=None, passVar=None, UUID=None, subJobOf=""):
     print "jobChain",  unit, chainPK
     if chainPK == None:
         return None
     self.unit = unit
     self.pk = chainPK
     self.notifyComplete = notifyComplete
     self.UUID = UUID
     self.linkSplitCount = 1
     self.subJobOf = subJobOf
     sql = """SELECT * FROM MicroServiceChains WHERE pk =  """ + chainPK.__str__()
     print sql
     c, sqlLock = databaseInterface.querySQL(sql)
     row = c.fetchone()
     if row == None:
         sqlLock.release()
         return None
     while row != None:
         print "jobChain", row
         #self.pk = row[0]
         self.startingChainLink = row[1]
         self.description = row[2]
         row = c.fetchone()
     sqlLock.release()
     self.currentLink = jobChainLink(self, self.startingChainLink, unit, passVar=passVar, subJobOf=subJobOf)
     if self.currentLink == None:
         return None
示例#4
0
 def __init__(self, unit, chainPK, notifyComplete=None, passVar=None, UUID=None, subJobOf=""):
     """Create an instance of a chain from the MicroServiceChains table"""
     print "jobChain",  unit, chainPK
     if chainPK == None:
         return None
     self.unit = unit
     self.pk = chainPK
     self.notifyComplete = notifyComplete
     self.UUID = UUID
     self.linkSplitCount = 1
     self.subJobOf = subJobOf
     sql = """SELECT * FROM MicroServiceChains WHERE pk =  '%s'""" % (chainPK.__str__())
     print sql
     c, sqlLock = databaseInterface.querySQL(sql)
     row = c.fetchone()
     if row == None:
         sqlLock.release()
         return None
     while row != None:
         print "jobChain", row
         #self.pk = row[0]
         self.startingChainLink = row[1]
         self.description = row[2]
         row = c.fetchone()
     sqlLock.release()
     self.currentLink = jobChainLink(self, self.startingChainLink, unit, passVar=passVar, subJobOf=subJobOf)
     if self.currentLink == None:
         return None
 def nextChainLink(self, pk, passVar=None, incrementLinkSplit=False, subJobOf=""):
     if self.subJobOf and not subJobOf:
         subJobOf = self.subJobOf
     if incrementLinkSplit:
         self.linkSplitCount += 1
     if pk != None:
         # may 2012 - can't think why I'm threading this - TODO 
         # I think it was threaded to avoid nasty stack trace problems
         #t = threading.Thread(target=self.nextChainLinkThreaded, args=(pk,), kwargs={"passVar":passVar} )
         #t.daemon = True
         #t.start()
         jobChainLink(self, pk, self.unit, passVar=passVar, subJobOf=subJobOf)
     else:
         self.linkSplitCount -= 1
         if self.linkSplitCount == 0:
             print "Done with UNIT:" + self.unit.UUID
             if self.notifyComplete:
                 self.notifyComplete(self)
示例#6
0
    def __init__(self, unit, chain, workflow, starting_link=None):
        """Create an instance of a chain from the MicroServiceChains table"""
        LOGGER.debug('Creating jobChain %s for chain %s', unit, chain.id)
        if chain is None:
            return None
        self.unit = unit
        self.workflow = workflow

        LOGGER.debug('Chain: %s', chain)

        if starting_link is None:
            starting_link = chain.link

        # Migrate over unit variables containing replacement dicts from
        # previous chains but prioritize any values contained in passVars
        # passed in as kwargs.
        rd = fetchUnitVariableForUnit(unit.UUID)

        # Run!
        jobChainLink(self, starting_link, workflow, unit, passVar=rd)
示例#7
0
    def __init__(self, unit, chain_id, starting_link_id=None):
        """Create an instance of a chain from the MicroServiceChains table"""
        LOGGER.debug('Creating jobChain %s for chain %s', unit, chain_id)
        if chain_id is None:
            return None
        self.unit = unit

        chain = MicroServiceChain.objects.get(id=str(chain_id))
        LOGGER.debug('Chain: %s', chain)

        if starting_link_id is None:
            starting_link_id = chain.startinglink_id

        # Migrate over unit variables containing replacement dicts from
        # previous chains but prioritize any values contained in passVars
        # passed in as kwargs.
        rd = fetchUnitVariableForUnit(unit.UUID)

        # Run!
        jobChainLink(self, starting_link_id, unit, passVar=rd)
示例#8
0
 def nextChainLink(self,
                   pk,
                   passVar=None,
                   incrementLinkSplit=False,
                   subJobOf=""):
     """Proceed to next link, as passed(pk)"""
     if self.subJobOf and not subJobOf:
         subJobOf = self.subJobOf
     if incrementLinkSplit:
         self.linkSplitCount += 1
     if pk is not None:
         jobChainLink(self,
                      pk,
                      self.unit,
                      passVar=passVar,
                      subJobOf=subJobOf)
     else:
         self.linkSplitCount -= 1
         if self.linkSplitCount == 0:
             LOGGER.debug('Done with unit %s', self.unit.UUID)
             if self.notifyComplete:
                 self.notifyComplete(self)
示例#9
0
    def __init__(self,
                 unit,
                 chainPK,
                 notifyComplete=None,
                 passVar=None,
                 UUID=None,
                 subJobOf=""):
        """Create an instance of a chain from the MicroServiceChains table"""
        LOGGER.debug('Creating jobChain %s for chain %s', unit, chainPK)
        if chainPK is None:
            return None
        self.unit = unit
        self.pk = chainPK
        self.notifyComplete = notifyComplete
        self.UUID = UUID
        self.linkSplitCount = 1
        self.subJobOf = subJobOf

        chain = MicroServiceChain.objects.get(id=str(chainPK))
        LOGGER.debug('Chain: %s', chain)
        self.startingChainLink = chain.startinglink_id
        self.description = chain.description

        # Migrate over unit variables containing replacement dicts from previous chains,
        # but prioritize any values contained in passVars passed in as kwargs
        rd = fetchUnitVariableForUnit(unit.UUID)
        if passVar:
            rd.update(passVar)

        self.currentLink = jobChainLink(self,
                                        self.startingChainLink,
                                        unit,
                                        passVar=rd,
                                        subJobOf=subJobOf)
        if self.currentLink is None:
            return None
示例#10
0
 def nextChainLinkThreaded(self, pk, passVar=None):
     self.currentLink = jobChainLink(self, pk, self.unit, passVar)
 def nextChainLinkThreaded(self, pk, passVar=None):
     self.currentLink = jobChainLink(self, pk, self.unit, passVar)
示例#12
0
 def nextChainLink(self, link, passVar=None):
     """Proceed to next link."""
     if link is None:
         LOGGER.debug('Done with unit %s', self.unit.UUID)
         return
     jobChainLink(self, link, self.workflow, self.unit, passVar=passVar)