def send_pong_msg(self, info, addr, coro=None):
        if (self.scheduler['ip_addr'] or self.job_infos or not self.num_cpus or
           not self.service_available()):
            _dispy_logger.debug('Busy (%s/%s); ignoring ping message from %s',
                                self.avail_cpus, self.num_cpus, addr[0])
            raise StopIteration
        try:
            scheduler_ip_addrs = info['ip_addrs']
            if not info.get('relay', None):
                scheduler_ip_addrs.append(addr[0])
            scheduler_port = info['port']
        except:
            _dispy_logger.debug(traceback.format_exc())
            raise StopIteration

        if info.get('sign', None):
            pong_msg = {'ip_addr': self.ext_ip_addr, 'port': self.port, 'sign': self.sign,
                        'version': _dispy_version, 'name': self.name, 'cpus': self.avail_cpus,
                        'auth': auth_code(self.secret, info['sign'])}
            if psutil:
                pong_msg['avail_info'] = DispyNodeAvailInfo(
                    100.0 - psutil.cpu_percent(), psutil.virtual_memory().available,
                    psutil.disk_usage(self.dest_path_prefix).free,
                    100.0 - psutil.swap_memory().percent)
            else:
                pong_msg['avail_info'] = None

            for scheduler_ip_addr in scheduler_ip_addrs:
                addr = (scheduler_ip_addr, scheduler_port)
                pong_msg['scheduler_ip_addr'] = scheduler_ip_addr
                sock = AsyncSocket(socket.socket(socket.AF_INET, socket.SOCK_STREAM),
                                   keyfile=self.keyfile, certfile=self.certfile)
                sock.settimeout(MsgTimeout)
                try:
                    yield sock.connect(addr)
                    yield sock.send_msg('PONG:'.encode() + serialize(pong_msg))
                except:
                    _dispy_logger.debug('Could not connect to %s:%s', addr[0], addr[1])
                finally:
                    sock.close()
        else:
            sock = AsyncSocket(socket.socket(socket.AF_INET, socket.SOCK_DGRAM))
            sock.settimeout(MsgTimeout)
            ping_msg = {'ip_addr': self.ext_ip_addr, 'port': self.port, 'sign': self.sign,
                        'version': _dispy_version}
            for scheduler_ip_addr in scheduler_ip_addrs:
                addr = (scheduler_ip_addr, scheduler_port)
                ping_msg['scheduler_ip_addr'] = scheduler_ip_addr
                try:
                    yield sock.sendto('PING:'.encode() + serialize(ping_msg), addr)
                except:
                    _dispy_logger.debug(traceback.format_exc())
                    pass
            sock.close()
dataset/ETHPy150Open pgiri/dispy/py2/dispy/dispynode.py/_DispyNode.send_pong_msg/original