Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graia-scheduler

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graia-scheduler

a scheduler for graia framework

  • 0.3.1
  • PyPI
  • Socket score

Maintainers
1

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 的开发体验.

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc