Skip to content

bhaveshpraveen/aiocrontab

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AIOCRONTAB

Sample project to "flex" my asyncio skills.

Installation

pip install aiocrontab

Usage

import time

import aiocrontab


@aiocrontab.register("*/5 * * * *")
def print_every_five_mminutes():
    print(f"{time.ctime()}: Hello World!!!!!")

@aiocrontab.register("* * * * *")
def print_every_mminute():
    print(f"{time.ctime()}: Hello World!")


aiocrontab.run()

TODO

  • support for diff timezones
  • support for async task
  • take logger as dependency
  • Add more meaningful tests
  • fix mypy errors
  • document the codebase
  • document usage in readme
  • different namespaces for different crontab instances
  • ability to schedule task from code
  • better logging messages

If you didn't create any new Crontab instance (ie: You are using @aiocrontab.register), you can get the logger that the aiocrontab application uses using the following snippet

import logging

logger = logging.getLogger("global.aiocrontab.core")

If you created your own Crontab instance(using Crontab()), and in-case you didn't provide the logger when creating a Crontab instance, you can use the following snippet to get the logger that it uses.

import logging

logger = logging.getLogger("aiocrontab.core")

About

Crontab implementation in asyncio

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages