looper-佛跳墙活套:捕获asyncio cancel报错。
Project description
aslooper
looper Used to cancel all running tasks after catching SIGINT, SIGTERM signals, Quit running without raise asyncio cancelled error.
use looper
import asyncio
from aslooper import looper
async def run(i):
while True:
print(f"{i} running.")
await asyncio.sleep(1)
@looper()
async def main():
tasks = [run(i) for i in range(3)]
await asyncio.gather(*tasks)
asyncio.run(main())
run with a call
import asyncio
from aslooper import looper
async def run(i):
while True:
print(f"{i} running.")
await asyncio.sleep(1)
def some_call():
print("some_call")
@looper(some_call)
async def main():
while True:
print("run something.")
await asyncio.sleep(1)
asyncio.run(main())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aslooper-1.3.0.tar.gz
(3.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aslooper-1.3.0.tar.gz.
File metadata
- Download URL: aslooper-1.3.0.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.11.9 Linux/6.8.11-amd64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f90f8036af2de907a2192537e5adcde4c72d943219be7f1d568d91e9122102db
|
|
| MD5 |
d2fc1ea0b54891d96790a4c8695aa7d2
|
|
| BLAKE2b-256 |
bf2b864388fb81705c7c4c5d1c3d6fa0ecc0bb1c8a6c504dc46aa54127eda897
|
File details
Details for the file aslooper-1.3.0-py3-none-any.whl.
File metadata
- Download URL: aslooper-1.3.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.2 CPython/3.11.9 Linux/6.8.11-amd64
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8bf7ab3794046cf8768eea881fecaee4e5cd1182adf3320af74a1341a1063f8
|
|
| MD5 |
8e9e2370101d38e702f08d77823265a2
|
|
| BLAKE2b-256 |
7bb14f6ed10799cd51a90780cd638d8777d078a0e4c592b0754a480aef857e3d
|