CentOS EOL
CentOS EOL
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
sudo curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
sudo yum install iperf3
Reference
FastAPI profiler
FastAPI profiler
- args:
- --reduced-profile
- --profile-interval
- "300"
- --outfile
- profile_report.txt
- runfastapi.py
command:
- scalene
env:
Reference
plasma-umass/scalene
benfred/py-spy
Web test
Web test
Selenium: Selenium is widely used for browser automation and can handle complex interactions with dashboards and filters. It supports many languages (like Python, JavaScript, and Java) and integrates well with test frameworks like Pytest or JUnit.
Playwright: This is a modern, powerful framework by Microsoft for end-to-end testing. Pl...
build aws lambda function
build aws lambda function
Reference
Deploy Python Lambda functions with container images
mongodb stop old openration
mongodb stop old openration
当客户端断开连接时, 如果是aggregations 和 find操作, 则会自动停止该操作; 如果是写操作, 那么会继续执行; 见https://www.mongodb.com/docs/drivers/node/current/faq/#what-happens-to-running-operations-if-the-client-disconnects-
如果是前端取消操作, 或者重新开始新的操作在FastAPI中, 不会中止之前的操作, 所以不会中止之前的MongoDB操作;
手动停止MongoDB操作
使用db.currentOp()方法可以查看当前正在执行的MongoDB操作;
使用db.kill...
Python packages
Python packages
Bast Python project dir structure
project_root/
my_project/
__init__.py
main.py
config.py
utils/
__init__.py
helper.py
features/
__init__.py
feature_a/
__init__.py
module1.py
module2.py
feature_b/
__init__.py
...
Python profiler
Python profiler
性能分析和代码优化
cProfile
cProfile 是 Python 内置的性能分析器,适用于对整个程序进行性能分析。
python
import cProfile
def my_function():
# Your function code here
for i in range(10000):
pass
cProfile.run(‘my_function()’)
line_profiler
line_profiler 是一个用于逐行分析 Python 代码性能的工具。需要先安装:
sh
pip install line_profiler
使用方法:
python
from...
468 post articles, 59 pages.