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)
评论列表
文章目录