Exemplo n.º 1
0
            def check_blocked(tid):
                # for each blocked process...
                try:
                    matched_tup = doesMatch(self.blocked_list[tid][0], tup)
                except NoTupleMatch:
                    pass
                else:
                    # ... if the tuple matches their template wake them up.
                    pattern = self.blocked_list[tid][0]
                    destructive = self.blocked_list[tid][2]
                    del self.blocked_list[tid]

                    def do_return_tuple():
                        req, ts = server.blocked_threads[tid]
                        del server.blocked_threads[tid]
                        utils.changeOwner(matched_tup, self._id, utils.getProcessIdFromThreadId(tid))
                        req.lock.acquire()
                        req.send(None, ("RESULT_TUPLE", matched_tup))
                        req.lock.release()

                        broadcast_tonodes(self.partitions, False, cancel_request, self._id, pattern)

                    threading.Thread(target=do_return_tuple).start()

                    if destructive == True: # if they were doing an in then stop here, otherwise we continue
                        raise MatchedTuple
Exemplo n.º 2
0
            def check_blocked(tid):
                # for each blocked process...
                try:
                    matched_tup = doesMatch(self.blocked_list[tid][0], tup)
                except NoTupleMatch:
                    pass
                else:
                    # ... if the tuple matches their template wake them up.
                    pattern = self.blocked_list[tid][0]
                    destructive = self.blocked_list[tid][2]
                    del self.blocked_list[tid]

                    def do_return_tuple():
                        req, ts = server.blocked_threads[tid]
                        del server.blocked_threads[tid]
                        utils.changeOwner(matched_tup, self._id,
                                          utils.getProcessIdFromThreadId(tid))
                        req.lock.acquire()
                        req.send(None, ("RESULT_TUPLE", matched_tup))
                        req.lock.release()

                        broadcast_tonodes(self.partitions, False,
                                          cancel_request, self._id, pattern)

                    threading.Thread(target=do_return_tuple).start()

                    if destructive == True:  # if they were doing an in then stop here, otherwise we continue
                        raise MatchedTuple
Exemplo n.º 3
0
            def check_requests((node, pattern)):
                try:
                    matched = doesMatch(pattern, tup)
                except NoTupleMatch:
                    return
                else:
                    def do_return_tuple():
                        utils.changeOwner(matched, self._id, self._id, node)
                        sendMessageToNode(node, None, multiple_in, self._id, (interserver_types.convertTupleForServer(node, matched), )) # return the tuple to the server

                    threading.Thread(target=do_return_tuple).start()

                    raise MatchedTuple
Exemplo n.º 4
0
            def check_requests((node, pattern)):
                try:
                    matched = doesMatch(pattern, tup)
                except NoTupleMatch:
                    return
                else:

                    def do_return_tuple():
                        utils.changeOwner(matched, self._id, self._id, node)
                        sendMessageToNode(
                            node, None, multiple_in, self._id,
                            (interserver_types.convertTupleForServer(
                                node,
                                matched), ))  # return the tuple to the server

                    threading.Thread(target=do_return_tuple).start()

                    raise MatchedTuple