我的设置是pythontor非典服务器,它用ThreadPoolExecutor异步处理任务。在某些情况下,任务可能会变成无限循环。使用with_timeout装饰器,我成功地捕获了超时异常,并将错误结果返回给客户端。问题是任务仍然在后台运行。如何能够阻止任务在ThreadPoolExecutor中运行?或者可以取消Future?下面是再现问题的代码。运行与龙卷风4和concurrent.futures库的代码,然后转到
from <
我有一个python文件,其中有一个tornado请求处理程序类,其中包含以下相关代码: executor = concurrent.futures.ThreadPoolExecutor(max_workersasync def connect_function(self):
#some code with an await operation somewhere here 因此,我的主要目标是能够通过线程使用请求处理程序我发现我能做到这一点的方法是使用run_in_exec
我正在尝试在Google Cloud Function中运行python脚本。r.html.render() for value in app:
return value.text[:10] 触发事件:{} 当我在google云平台上测试这个函数时,我得到了以下错误。RuntimeError: There is no current event loop in thread