當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。