示例#1
0
    def compute(self, *args, **kwargs):
        endNodePath = self.loopEndNode.getData()
        loopEndNode = PathsRegistry().getEntity(endNodePath)
        if loopEndNode is not None:
            if loopEndNode.loopBeginNode.getData() != self.path():
                self.setError("Invalid pair")
                return
            if self.graph() is not loopEndNode.graph():
                err = "block ends in different graphs"
                self.setError(err)
                loopEndNode.setError(err)
                return
        else:
            self.setError("Pair {} not found".format(endNodePath))
            return

        self.onNext(*args, **kwargs)
 def compute(self, *args, **kwargs):
     node = PathsRegistry().getEntity(self.loopBeginNode.getData())
     if node is not None:
         if node.graph() == self.graph():
             if node.loopEndNode.getData() != self.path():
                 self.setError("Invalid pair")
                 return
             if node.__class__.__name__ == "forLoopBegin":
                 node.prevIndex = node.currentIndex
                 node.currentIndex += 1
                 if node.currentIndex >= node.lastIndex.getData():
                     self.completed.call()
             else:
                 node.onNext()
         else:
             err = "block ends in different graphs"
             node.setError(err)
             self.setError(err)
     else:
         self.setError("Pair {} not found".format(self.loopBeginNode.getData()))
 def compute(self, *args, **kwargs):
     self.reset()
     endNodePath = self.loopEndNode.getData()
     loopEndNode = PathsRegistry().getEntity(endNodePath)
     if loopEndNode is not None:
         if loopEndNode.loopBeginNode.getData() != self.path():
             self.setError("Invalid pair")
             return
         if self.graph() is not loopEndNode.graph():
             err = "block ends in different graphs"
             self.setError(err)
             loopEndNode.setError(err)
             return
     else:
         self.setError("{} not found".format(endNodePath))
     if not self._working:
         self.thread = threading.Thread(target=self.onNext,
                                        args=(self, args, kwargs))
         self.thread.start()
         self._working = True