示例#1
0
 def connect_client(self):
     """connect a client with my Context, and track its sockets for cleanup"""
     c = Client(profile='iptest', context=self.context)
     c.wait = lambda *a, **kw: self.client_wait(c, *a, **kw)
     
     for name in filter(lambda n:n.endswith('socket'), dir(c)):
         s = getattr(c, name)
         s.setsockopt(zmq.LINGER, 0)
         self.sockets.append(s)
     return c
示例#2
0
    def connect_client(self):
        """connect a client with my Context, and track its sockets for cleanup"""
        c = Client(profile='iptest', context=self.context)
        c.wait = lambda *a, **kw: self.client_wait(c, *a, **kw)

        for name in filter(lambda n: n.endswith('socket'), dir(c)):
            s = getattr(c, name)
            s.setsockopt(zmq.LINGER, 0)
            self.sockets.append(s)
        return c
示例#3
0
 def client_wait(self, client, jobs=None, timeout=-1):
     """my wait wrapper, sets a default finite timeout to avoid hangs"""
     if timeout < 0:
         timeout = self.timeout
     return Client.wait(client, jobs, timeout)
示例#4
0
 def client_wait(self, client, jobs=None, timeout=-1):
     """my wait wrapper, sets a default finite timeout to avoid hangs"""
     if timeout < 0:
         timeout = self.timeout
     return Client.wait(client, jobs, timeout)