我们在Tornado上运行一个服务,它是异步编写的。我怀疑代码中的某个位置存在阻塞性能的阻塞调用。 在Tornado中有没有办法找到这段代码/函数调用?
或者我可以找到保持IOLoop
长于X毫秒的代码吗?
由于
亚历
答案 0 :(得分:3)
在Python 3+和Tornado 5+中,设置环境变量Element exists
Traceback (most recent call last):
File "C:\Users\c5242046\Desktop\test2\backupautomation\bkpalertv1\bkpv1.py", line 73, in <module>
if driver.find_element_by_xpath((("//a[@class='urBtnStd1 urV' and @id='download' and @title='Download To Excel']/span[@class='urBtnPadding']"))):
File "c:\program files (x86)\python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 385, in find_element_by_xpath
return self.find_element(by=By.XPATH, value=xpath)
File "c:\program files (x86)\python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 955, in find_element
'value': value})['value']
File "c:\program files (x86)\python36-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 312, in execute
self.error_handler.check_response(response)
File "c:\program files (x86)\python36-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: Unable to find element with xpath == //a[@class='urBtnStd1 urV' and @id='download' and @title='Download To Excel']/span[@class='urBtnPadding']
。在旧版本的Tornado或Python中,请致电PYTHONASYNCIODEBUG=1
。
无论哪种方式,每当呼叫阻塞超过半秒时,这将导致消息被记录。