Async scheduler object
Object-like async scheduler
Install
https://pypi.org/project/async-scheduler-object/
Usage
import asyncio
from datetime import timedelta
from async_scheduler_object import AsyncScheduler, AsyncSchedulerEvent
class AgeSchedulerEvent(AsyncSchedulerEvent):
def __init__(self, start: int) -> None:
self._age = start
async def run(self) -> None:
print("Age", self._age)
self._age += 1
class CatsSchedulerEvent(AsyncSchedulerEvent):
def __init__(self, start: int) -> None:
self._cats_count = start
async def run(self) -> None:
print("Cats", self._cats_count)
self._cats_count *= 1
async def main() -> None:
scheduler_1 = AsyncScheduler(
events=[AgeSchedulerEvent(start=1)],
interval=timedelta(seconds=1),
)
scheduler_2 = AsyncScheduler(
events=[AgeSchedulerEvent(start=10), CatsSchedulerEvent(start=20)],
interval=timedelta(seconds=0.5),
)
await scheduler_1.start()
await scheduler_2.start()
await asyncio.sleep(10)
await scheduler_1.stop()
await scheduler_2.stop()
asyncio.run(main())
Metadata
Release files for async-scheduler-object 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| async_scheduler_object-1.1.0.tar.gz | 2.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| async_scheduler_object-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.2 kB
Release files / async_scheduler_object-1.1.0.tar.gz
| Download URL | async_scheduler_object-1.1.0.tar.gz |
|---|---|
| Size | 2.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d88b83f5e1eda3584b4f90ff448ae3a42b6647a191b50cb8c2d45f95a256d34e
|
|
BLAKE2b-256 checksum How to use checksums |
f7420faad0c2cc27322e051ef400d6b3e673e53e229e36921f93c7d7eb489c00
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.10.8 Linux/5.15.81
|
Release files / async_scheduler_object-1.1.0-py3-none-any.whl
| Download URL | async_scheduler_object-1.1.0-py3-none-any.whl |
|---|---|
| Size | 2.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6c606281ea6b36b12a0750ffa6f3ce194ae219f7b9603144ec26c3346ca16f17
|
|
BLAKE2b-256 checksum How to use checksums |
2df2327c43e0192d8b00da490f55b243b64cf220ce060376191f11cbe1803c80
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.2.2 CPython/3.10.8 Linux/5.15.81
|