Skip to main content

CronScheduleTriggers: Quartz Syntax based Cron Trigger library.

pipeline status coverage report

Cron Schedule Triggers (CSTriggers) is a Python library enabling the ability to determine the next execution of a live schedule. Its syntax is that of Quartz Job Scheduler. This library is not a scheduling app or a task queue, there are plenty of those in the wild to choose from. When you need advanced customisation of triggers for tasks, and a common and conventional syntax for schedule notation, CSTriggers comes to your aid.

This library is for those who

  • Want the ability to generate future task data for visualization purposes.
  • Want to combine their own choice of solutions to build a customizable integrated task queuing/scheduling system at any scale.
  • Do not want to run java, but want to take advantage of the rich Quartz Cron syntax
  • Do not want to drag in many dependencies into their project (Uses standard Python3 libraries only).

Example usage

Initialize a schedule object with a cron notation string, a start date, and an optional end date. Call .next_trigger() for a new date. Notice that when an end_date is given, The schedule terminates at 2022-10-13T00:00:00 and not 2030-03-01T00:00:00 as it would naturally.

from cstriggers.core.trigger import QuartzCron

schedule_string = "0 0 0 1 JAN-MAR ? 2010-2030"
start_date = "2019-10-13T00:00:00"
end_date = "2022-10-13T00:00:00"
cron_obj = QuartzCron(schedule_string=schedule_string, start_date=start_date, end_date=end_date)

print(cron_obj.next_trigger(isoformat=True))
>> 2020-01-01T00:00:00

For multiple sequential dates call either .next_trigger() multiple times.

from cstriggers.core.trigger import QuartzCron

schedule_string = "0 0 0 1 JAN-MAR ? 2010-2030"
start_date = "2019-10-13T00:00:00"
end_date = "2022-10-13T00:00:00"
cron_obj = QuartzCron(schedule_string=schedule_string, start_date=start_date, end_date=end_date)

print(cron_obj.next_trigger(isoformat=True))
print(cron_obj.next_trigger(isoformat=True))
>> 2020-01-01T00:00:00
>> 2020-02-01T00:00:00

Or call .next_triggers() with the number of triggers needed.

from cstriggers.core.trigger import QuartzCron

schedule_string = "0 0 0 1 JAN-MAR ? 2010-2030"
start_date = "2019-10-13T00:00:00"
end_date = "2022-10-13T00:00:00"
cron_obj = QuartzCron(schedule_string=schedule_string, start_date=start_date, end_date=end_date)

print(cron_obj.next_triggers(number_of_triggers=10, isoformat=True))
>> [
    '2020-01-01T00:00:00', 
    '2020-02-01T00:00:00', 
    '2020-03-01T00:00:00', 
    '2021-01-01T00:00:00', 
    '2021-02-01T00:00:00', 
    '2021-03-01T00:00:00', 
    '2022-01-01T00:00:00', 
    '2022-02-01T00:00:00', 
    '2022-03-01T00:00:00', 
    '2023-01-01T00:00:00'
]

Roadmap

  • Support for last_trigger(s) to retroactively look at schedule dates.
  • Support for AWS Cron Expression syntax.

Release files for cron-schedule-triggers 0.0.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cron-schedule-triggers 0.0.11
File Size Uploaded
cron-schedule-triggers-0.0.11.tar.gz 12.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cron-schedule-triggers 0.0.11
File Interpreter ABI Platform
cron_schedule_triggers-0.0.11-py3-none-any.whl Python 3 none any Details

Total release size: 26.8 kB

Release files / cron-schedule-triggers-0.0.11.tar.gz

Download URL cron-schedule-triggers-0.0.11.tar.gz
Size 12.6 kB
Tags Source
SHA-256 checksum
How to use checksums
63bce533ae20599179f3a5f29c27aa1884740dfbf9e5144bf0e2e5f73892a6cb
BLAKE2b-256 checksum
How to use checksums
8b18a17e97d1155166f61ac88861302a069bb05e240ca64a3b351391f98129a2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.7

Release files / cron_schedule_triggers-0.0.11-py3-none-any.whl

Download URL cron_schedule_triggers-0.0.11-py3-none-any.whl
Size 14.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3706a69a78956809797e6c11f0b0354e0429ccc2a29a40027518a4a5441a5802
BLAKE2b-256 checksum
How to use checksums
0d44d1b243c1f5b5f950c2b28b85614f92652614486215855881e07e12dc784f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.7

Release history Release notifications | RSS feed

This release

0.0.11 This release

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page