Skip to content

JuliaServices/Tempus.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tempus.jl

Build Status Coverage Documentation Dev Documentation

Overview

Tempus.jl is a lightweight, Quartz-inspired job scheduling library for Julia. It provides an easy-to-use API for defining cron-like schedules and executing jobs at specified times.

Features

  • Define jobs using cron-style scheduling expressions
  • Support for job execution policies (overlap handling, retries, failure strategies)
  • In-memory and file-based job storage backends
  • Thread-safe scheduling with concurrency-aware execution
  • Dynamic job control (enable, disable, unschedule jobs)
  • Supports retry policies with exponential backoff

Installation

Tempus.jl is registered in the Julia General registry. You can install it directly from GitHub:

using Pkg
Pkg.add("Tempus")

Quick Start

Defining and Scheduling a Job

using Tempus

# Define a job that prints a message every minute
job = Tempus.Job("example_job", "* * * * *", () -> println("Hello from Tempus!"))

# Create an in-memory scheduler
scheduler = Tempus.Scheduler()

# Add the job to the scheduler
push!(scheduler, job)

# Start the scheduler (runs in a background thread)
Tempus.run!(scheduler)

Disabling and Enabling Jobs

Tempus.disable!(job)  # Prevents the job from running
Tempus.enable!(job)   # Allows it to run again

Removing a Job

Tempus.unschedule!(scheduler, job)

Using a File-Based Job Store

To persist job execution history across restarts, use a file-based store:

store = Tempus.FileStore("jobs.dat")
scheduler = Tempus.Scheduler(store)

Cron Syntax

Tempus.jl uses a familiar cron syntax for scheduling:

* * * * *  → Every minute
0 12 * * * → Every day at noon
*/5 * * * * → Every 5 minutes
# also supports second-level precision
* * * * * * → Every second

Contributing

Contributions are welcome! To contribute:

  1. Fork the repository.
  2. Create a new branch with your feature or bugfix.
  3. Submit a pull request with your changes.

Make sure to include tests for any new functionality.

License

Tempus.jl is licensed under the MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages