start.py 文件源码

python
阅读 34 收藏 0 点赞 0 评论 0

项目:PyPlanet 作者: PyPlanet 项目源码 文件源码
def handle(self, *args, **options):
        # Detach when asked.
        if 'detach' in options and options['detach']:
            self.detach(pid_file=options['pid_file'] if 'pid_file' in options and options['pid_file'] else 'pyplanet.pid')

        # Initiate the logger.
        threading.current_thread().setName('Main')
        initiate_logger()
        logger = logging.getLogger(__name__)

        # Initiate the settings by accessing one.
        logger.debug('Initiated configuration and environment... (debug on, means no error reporting and verbose output')
        if not settings.DEBUG:
            logger.info('Initiated configuration and environment...')
        logger.info('-------------------------------[  PyPlanet v{}  ]-------------------------------'.format(self.get_version()))

        # Start god process (the current started process).
        self.pool = EnvironmentPool(settings.POOLS, max_restarts=options['max_restarts'], options=options)
        self.pool.populate()

        # Starting all processes.
        self.pool.start()

        # Start the watchdog.
        try:
            self.pool.watchdog()
        except KeyboardInterrupt:
            self.pool.shutdown()
            exit(0)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号