EADST

Python: Set Code Running Time

Set code running time, if time out, stop running.

import time
import eventlet
eventlet.monkey_patch()
with eventlet.Timeout(3, False):  # Running Time <= 3s
    time.sleep(2)
    print("Sleep 2 seconds")
    time.sleep(2)
    print("Sleep 2 more seconds")
print("Finish Testing")

相关标签
About Me
XD
Goals determine what you are going to be.
Category
标签云
多线程 第一性原理 InvalidArgumentError Pickle 图形思考法 签证 EXCEL Image2Text API Website uWSGI HuggingFace PyCharm Permission 继承 Interview FP16 WAN Quantization Pytorch RAR FP32 Data CTC NLTK SQLite Random Disk SVR CC v0.dev VPN Excel Freesound Password Distillation LoRA 阿里云 Michelin PIP LeetCode BF16 Tiktoken ResNet-50 域名 tqdm AI Qwen2.5 GPT4 Streamlit CLAP Docker GIT 强化学习 Clash Domain Plate diffusers Jupyter v2ray 腾讯云 git-lfs HaggingFace Augmentation 多进程 XML UNIX Diagram Tensor transformers 证件照 SAM Windows Review Jetson llama.cpp C++ 飞书 Rebuttal Knowledge Markdown COCO FastAPI Bipartite 递归学习法 Bitcoin Math Ptyhon Use GPTQ OCR git Proxy Attention Django Crawler 算法题 RL Heatmap Video Bin Paddle News logger PDF Ubuntu RGB uwsgi Web Agent Translation 云服务器 Nginx TTS NLP Cloudreve Breakpoint hf QWEN DeepSeek PDB PyTorch Linux Plotly Zip scipy Color Hotel Food 顶会 Algorithm CEIR Safetensors Bert Conda Miniforge 关于博主 公式 财报 Numpy torchinfo Github LLAMA Qwen2 tar IndexTTS2 DeepStream 论文 VSCode Datetime Pandas NameSilo 搞笑 icon Hungarian ONNX Sklearn SQL Claude Git LLM LaTeX 版权 Llama CAM Vmess Pillow Template Anaconda Input Hilton Firewall Shortcut SPIE Statistics 论文速读 XGBoost printf 报税 YOLO GoogLeNet 图标 Gemma JSON Transformers Vim GGML MD5 FP64 ChatGPT FlashAttention Quantize mmap Python Card 音频 CSV Baidu OpenAI BeautifulSoup CV FP8 Tracking Qwen OpenCV Animate TensorRT VGG-16 Logo TSV Search ms-swift Dataset Mixtral Base64 Land Paper Google ModelScope TensorFlow UI CUDA WebCrawler 净利润 BTC Magnet
站点统计

本站现有博文332篇,共被浏览875276

本站已经建立2583天!

热门文章
文章归档
回到顶部