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

本站现有博文320篇,共被浏览762424

本站已经建立2436天!

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