Skip to main content

a scheduler for graia framework

Project description

Graia Scheduler

一个基于 asyncio, 设计简洁, 代码简单的计划任务库, 使用 loop.create_task 创建计划任务;
同时使用生成器特性与 croniter 的定时设计, 轻盈而强大.

Install

pip install graia-scheduler

# or use pdm
pdm add graia-scheduler

使用

0.1以前的版本:

import asyncio
from graia.broadcast import Broadcast
from graia.scheduler import GraiaScheduler
from graia.scheduler.timers import crontabify

loop = asyncio.new_event_loop()

bcc = Broadcast(loop=loop)
scheduler = GraiaScheduler(loop, bcc)


@scheduler.schedule(crontabify("* * * * * *"))
def something_scheduled():
    print("print every second.")

loop.run_forever()

0.1及后续的版本:

import asyncio
from graia.broadcast import Broadcast
from graia.scheduler import GraiaScheduler
from graia.scheduler.timers import crontabify

loop = asyncio.new_event_loop()

bcc = Broadcast(loop=loop)
scheduler = GraiaScheduler(loop, bcc)


@scheduler.schedule(crontabify("* * * * * *"))
def something_scheduled():
    print("print every second.")


loop.run_until_complete(scheduler.run())

因为基于 BroadcastControl, 你可以享受使用 Dispatcher, Interrupt, Decorator 的开发体验.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

graia_scheduler-0.3.1.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

graia_scheduler-0.3.1-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file graia_scheduler-0.3.1.tar.gz.

File metadata

  • Download URL: graia_scheduler-0.3.1.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.12.0

File hashes

Hashes for graia_scheduler-0.3.1.tar.gz
Algorithm Hash digest
SHA256 00474242858ff0d829891e1401ac155c950f6572219e0abdc384f9c62ada0bcb
MD5 8657d284a8175ee53948335d37ecdba8
BLAKE2b-256 11078e9233a2f44e4632d2ea59f797eae33681d1e961ea24ab22bd609753b5a2

See more details on using hashes here.

File details

Details for the file graia_scheduler-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for graia_scheduler-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a6783eef1a81a9815a16814eaf36c5c689065f1be2d06005f7044d68e761e71a
MD5 303f0b64aa572a7971d45b64ae12f127
BLAKE2b-256 429d586758c33692b10a6c252de5c5709e5ae003e299b8681435c9e027b9b0ff

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page