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

本站现有博文333篇,共被浏览922212

本站已经建立2628天!

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