Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Implement CRON style job scheduling #1337

Closed
@marekyggdrasil

Description

@marekyggdrasil

Hi all! I'd like to contribute to this project. I think it would be much easier to work with CRON style job scheduling. Below I describe the idea and list few examples. If this suggestion can be approved and merged I can come up with some integration plan.

Implementation details

defrun_cron(self,callback,tab)

Wheretab is astring object representing a standard CRON tab entry.

Functionrun_cron would throw appropriate exception iftab object is not a string matching CRON tab entry (use regex validation)

In order to easily integrate it into current scheduler we need to know how much time is required to pass until next execution, then we just add it into the queue with appropriate delay, which itself can be computed usingcroniter.

Few examples below.

Examples

Run callback_function everyday at 2:00 AM.

job=j.run_cron(callback_function,'0 2 * * *')

Run callback_function twice per day, at 5:00 AM and at 5:00 PM

job=j.run_cron(callback_function,'0 5,17 * * *')

Run callback_function every minute

job=j.run_cron(callback_function,'* * * * *')

Run callback_function every Sunday at 5:00 PM ( note that Sunday is both0 and7 )

job=j.run_cron(callback_function,'0 17 * * 0')

Run callback_function every 10 minutes

job=j.run_cron(callback_function,'*/10 * * * *')

Run callback_function every minute but only in January, May and August

job=j.run_cron(callback_function,'* * * 1,5,8 *')

Run callback_function every Friday and Sunday at 5:00 PM

job=j.run_cron(callback_function,'0 17 * * 5,7')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp