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

本站现有博文337篇,共被浏览961341次

本站已经建立2673天!

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