def service_schedule(self, coro=None):
        coro.set_daemon()
        while True:
            yield coro.sleep(60)
            if self.service_available():
                yield self.broadcast_ping_msg(coro=coro)
            else:
                if self.scheduler['ip_addr']:
                    now = time.localtime()
                    if self.service_end and (now.tm_hour, now.tm_min) > self.service_end:
                        _dispy_logger.debug('Shutting down service')
                        self.shutdown(quit=False)
                    else:
                        _dispy_logger.debug('Stopping service')
                        sock = AsyncSocket(socket.socket(socket.AF_INET, socket.SOCK_STREAM),
                                           keyfile=self.keyfile, certfile=self.certfile)
                        sock.settimeout(MsgTimeout)
                        try:
                            yield sock.connect((self.scheduler['ip_addr'], self.scheduler['port']))
                            info = {'ip_addr': self.ext_ip_addr, 'sign': self.sign, 'cpus': 0}
                            yield sock.send_msg('NODE_CPUS:'.encode() + serialize(info))
                        except:
                            pass
                        finally:
                            sock.close()
dataset/ETHPy150Open pgiri/dispy/py2/dispy/dispynode.py/_DispyNode.service_schedule/original