class_docstr: TabPy application class for keeping context like settings, state, etc.
code: def _create_tornado_web_app(self):
      class TabPyTornadoApp(tornado.web.Application):
          is_closing = False
  
          def signal_handler(self, signal, _):
              logger.critical(f"Exiting on signal {signal}...")
              self.is_closing = True
  
          def try_exit(self):
              if self.is_closing:
                  tornado.ioloop.IOLoop.instance().stop()
                  logger.info("Shutting down TabPy...")
  
      logger.info("Initializing TabPy...")
      tornado.ioloop.IOLoop.instance().run_sync(
          lambda: init_ps_server(self.settings, self.tabpy_state)
      )
      logger.info("Done initializing TabPy.")
  
      executor = concurrent.futures.ThreadPoolExecutor(
          max_workers=multiprocessing.cpu_count()
      )
  
      # initialize Tornado application
      _init_asyncio_patch()
      application = TabPyTornadoApp(
          [
              (
                  self.subdirectory + r"/query/([^/]+)",
                  QueryPlaneHandler,
                  dict(app=self),
              ),
              (
                  self.subdirectory + r"/status",
                  StatusHandler,
                  dict(app=self),
              ),
              (
                  self.subdirectory + r"/info",
                  ServiceInfoHandler,
                  dict(app=self),
              ),
              (
                  self.subdirectory + r"/endpoints",
                  EndpointsHandler,
                  dict(app=self),
              ),
              (
                  self.subdirectory + r"/endpoints/([^/]+)?",
                  EndpointHandler,
                  dict(app=self),
              ),
              (
                  self.subdirectory + r"/evaluate",
                  EvaluationPlaneHandler
                  if self.settings[SettingsParameters.EvaluateEnabled]
                  else EvaluationPlaneDisabledHandler,
                  dict(executor=executor, app=self),
              ),
              (
                  self.subdirectory
                  + r"/configurations/endpoint_upload_destination",
                  UploadDestinationHandler,
                  dict(app=self),
              ),
              (
                  self.subdirectory + r"/(.*)",
                  tornado.web.StaticFileHandler,
                  dict(
                      path=self.settings[SettingsParameters.StaticPath],
                      default_filename="index.html",
                  ),
              ),
          ],
          debug=False,
          **self.settings,
      )
  
      signal.signal(signal.SIGINT, application.signal_handler)
      tornado.ioloop.PeriodicCallback(application.try_exit, 500).start()
  
      signal.signal(signal.SIGINT, application.signal_handler)
      tornado.ioloop.PeriodicCallback(application.try_exit, 500).start()
  
      return application
  
imports: import concurrent.futures
  import configparser
  import logging
  import multiprocessing
  import os
  import shutil
  import signal
  import sys
  import _thread
  import tornado
  from tornado.http1connection import HTTP1Connection
  import tabpy
  import tabpy.tabpy_server.app.arrow_server
  from tabpy.tabpy import __version__
  from tabpy.tabpy_server.app.app_parameters import ConfigParameters, SettingsParameters
  from tabpy.tabpy_server.app.util import parse_pwd_file
  from tabpy.tabpy_server.handlers.basic_auth_server_middleware_factory import BasicAuthServerMiddlewareFactory
  from tabpy.tabpy_server.handlers.no_op_auth_handler import NoOpAuthHandler
  from tabpy.tabpy_server.management.state import TabPyState
  from tabpy.tabpy_server.management.util import _get_state_from_file
  from tabpy.tabpy_server.psws.callbacks import init_model_evaluator, init_ps_server
  from tabpy.tabpy_server.psws.python_service import PythonService, PythonServiceHandler
  from tabpy.tabpy_server.handlers import EndpointHandler, EndpointsHandler, EvaluationPlaneHandler, EvaluationPlaneDisabledHandler, QueryPlaneHandler, ServiceInfoHandler, StatusHandler, UploadDestinationHandler
label_desc: Use image node_id 5 for calling the TabPyApp obj's underlying member method code with example usage: obj._create_tornado_web_app() and returns: application