コード例 #1
0
ファイル: child_test.py プロジェクト: yadra/diesel
def parent():
    print "parent: okay, parent here."
    sleep(1)
    print "parent: I'm so excited, about to become a parent"
    sleep(1)
    fork_child(end_the_app_when_my_parent_dies)
    sleep(1)
    print "parent: and, there he goes.  I'm so proud"
    sleep(4)
    print "parent: okay, I'm outta here"
コード例 #2
0
ファイル: child_test.py プロジェクト: FashtimeDotCom/diesel
def parent():
    print "parent: okay, parent here."
    sleep(1)
    print "parent: I'm so excited, about to become a parent"
    sleep(1)
    fork_child(end_the_app_when_my_parent_dies)
    sleep(1)
    print "parent: and, there he goes.  I'm so proud"
    sleep(4)
    print "parent: okay, I'm outta here"
コード例 #3
0
def main():
    start = time.time()

    for i in xrange(NUM_ITEMS):
        q.put('item %d' % i)
    for i in xrange(NUM_WORKERS):
        q.put(shutdown)

    for i in xrange(NUM_WORKERS):
        diesel.fork_child(worker)
    for i in xrange(NUM_WORKERS):
        dones.get()

    print 'all workers done in %.2f secs' % (time.time() - start)
    diesel.quickstop()
コード例 #4
0
ファイル: zeromq.py プロジェクト: arnaudsj/diesel
    def _handle_all_inbound_and_outbound_traffic(self):
        assert self.zmq_socket
        diesel.fork_child(self._receive_incoming_messages)
        queues = [self.incoming, self.outgoing]
        while True:
            (queue, msg) = diesel.first(waits=queues)

            if queue is self.incoming:
                if msg.remote_identity not in self.clients:
                    self._register_client(msg)
                self.clients[msg.remote_identity].incoming.put(msg)

            elif queue is self.outgoing:
                self.zmq_socket.send(msg.zmq_return, zmq.SNDMORE)
                self.zmq_socket.send(msg.data)
コード例 #5
0
def main():
    start = time.time()

    for i in xrange(NUM_ITEMS):
        q.put('item %d' % i)
    for i in xrange(NUM_WORKERS):
        q.put(shutdown)

    for i in xrange(NUM_WORKERS):
        diesel.fork_child(worker)
    for i in xrange(NUM_WORKERS):
        dones.get()

    print 'all workers done in %.2f secs' % (time.time() - start)
    diesel.quickstop()
コード例 #6
0
ファイル: zeromq.py プロジェクト: tanvir-tech/Network_Lab
    def _handle_all_inbound_and_outbound_traffic(self):
        assert self.zmq_socket
        diesel.fork_child(self._receive_incoming_messages)
        queues = [self.incoming, self.outgoing]
        while True:
            (queue, msg) = diesel.first(waits=queues)

            if queue is self.incoming:
                if msg.remote_identity not in self.clients:
                    self._register_client(msg)
                self.clients[msg.remote_identity].incoming.put(msg)

            elif queue is self.outgoing:
                self.zmq_socket.send(msg.zmq_return, zmq.SNDMORE)
                self.zmq_socket.send(msg.data)
コード例 #7
0
ファイル: nitro.py プロジェクト: 1angxi/diesel
 def _register_client(self, msg):
     remote = RemoteClient.from_message(msg)
     self.clients[msg.identity] = remote
     self.register_client(remote, msg)
     diesel.fork_child(self._handle_client_requests_and_responses, remote)
コード例 #8
0
 def _register_client(self, msg):
     remote = RemoteClient.from_message(msg)
     self.clients[msg.remote_identity] = remote
     self.register_client(remote, msg)
     diesel.fork_child(self._handle_client_requests_and_responses, remote)
コード例 #9
0
 def parent():
     fork_child(dependent_child)
     sleep(0.1)
     a = b # undef
コード例 #10
0
ファイル: test_fork.py プロジェクト: HVF/diesel
 def parent():
     fork_child(dependent_child, got_exception)
     sleep(0.1)
     a = b # undef
コード例 #11
0
ファイル: test_fork.py プロジェクト: yadra/diesel
 def parent():
     fork_child(dependent_child, got_exception)
     sleep(0.1)
     a = b  # undef
コード例 #12
0
ファイル: test_fork.py プロジェクト: yadra/diesel
def protective_parent(child, children):
    child = fork_child(child)
    child.keep_alive = True
    children[0] = child
    sleep(2)
コード例 #13
0
 def parent():
     fork_child(dependent_child)
     sleep(0.1)
     a = b  # undef
コード例 #14
0
ファイル: test_fork.py プロジェクト: 1angxi/diesel
def protective_parent(child, children):
    child = fork_child(child)
    child.keep_alive = True
    children[0] = child
    sleep(2)