当前位置: 首页>>代码示例>>Python>>正文


Python tornado.process方法代码示例

本文整理汇总了Python中tornado.process方法的典型用法代码示例。如果您正苦于以下问题:Python tornado.process方法的具体用法?Python tornado.process怎么用?Python tornado.process使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tornado的用法示例。


在下文中一共展示了tornado.process方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_import_everything

# 需要导入模块: import tornado [as 别名]
# 或者: from tornado import process [as 别名]
def test_import_everything(self):
        # Test that all Tornado modules can be imported without side effects,
        # specifically without initializing the default asyncio event loop.
        # Since we can't tell which modules may have already beein imported
        # in our process, do it in a subprocess for a clean slate.
        proc = subprocess.Popen([sys.executable], stdin=subprocess.PIPE)
        proc.communicate(_import_everything)
        self.assertEqual(proc.returncode, 0) 
开发者ID:opendevops-cn,项目名称:opendevops,代码行数:10,代码来源:import_test.py

示例2: get_cwd

# 需要导入模块: import tornado [as 别名]
# 或者: from tornado import process [as 别名]
def get_cwd(self):
        """Get the current working directory for our process

        Override in subclass to launch the process in a directory
        other than the current.
        """
        return os.getcwd() 
开发者ID:jupyterhub,项目名称:jupyter-server-proxy,代码行数:9,代码来源:handlers.py

示例3: get_env

# 需要导入模块: import tornado [as 别名]
# 或者: from tornado import process [as 别名]
def get_env(self):
        '''Set up extra environment variables for process. Typically
           overridden in subclasses.'''
        return {} 
开发者ID:jupyterhub,项目名称:jupyter-server-proxy,代码行数:6,代码来源:handlers.py

示例4: get_timeout

# 需要导入模块: import tornado [as 别名]
# 或者: from tornado import process [as 别名]
def get_timeout(self):
        """
        Return timeout (in s) to wait before giving up on process readiness
        """
        return 5 
开发者ID:jupyterhub,项目名称:jupyter-server-proxy,代码行数:7,代码来源:handlers.py

示例5: ensure_process

# 需要导入模块: import tornado [as 别名]
# 或者: from tornado import process [as 别名]
def ensure_process(self):
        """
        Start the process
        """
        # We don't want multiple requests trying to start the process at the same time
        # FIXME: Make sure this times out properly?
        # Invariant here should be: when lock isn't being held, either 'proc' is in state &
        # running, or not.
        with (await self.state['proc_lock']):
            if 'proc' not in self.state:
                # FIXME: Prevent races here
                # FIXME: Handle graceful exits of spawned processes here
                cmd = self.get_cmd()
                server_env = os.environ.copy()

                # Set up extra environment variables for process
                server_env.update(self.get_env())

                timeout = self.get_timeout()

                proc = SupervisedProcess(self.name, *cmd, env=server_env, ready_func=self._http_ready_func, ready_timeout=timeout, log=self.log)
                self.state['proc'] = proc

                try:
                    await proc.start()

                    is_ready = await proc.ready()

                    if not is_ready:
                        await proc.kill()
                        raise web.HTTPError(500, 'could not start {} in time'.format(self.name))
                except:
                    # Make sure we remove proc from state in any error condition
                    del self.state['proc']
                    raise 
开发者ID:jupyterhub,项目名称:jupyter-server-proxy,代码行数:37,代码来源:handlers.py


注:本文中的tornado.process方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。