Fledex Scheduler

Hex.pmHex versionAPI docsElixirCIREUSE statusCoverage StatusDownloadsOpenSSF ScorecardOpenSSF Best PracticesLast Updated

[!IMPORTANT]

This repository is based on SchedEx, but got heavily modified to fit the needs of Fledex. I tried to keep the interface still the same, so you should be able to use it as a drop-in replacement as well.

If you don't see a need for the additional features (like defining jobs) you probably want to use SchedEx instead. This README.md only describes the parts that differ from SchedEx. For the other parts, look at the SchedEx library documentation.

Not everything has been adjusted to the new home and therefore you will still find a lot of references to SchedEx (that might, or might not be accurate).

Fledex_Scheduler is a "simple yet deceptively powerful scheduling library for Elixir. Though it is almost trivially simple by design, it enables a number of very powerful use cases to be accomplished with very little effort".

Fledex_Scheduler is a fork of SchedEx that is written by Mat Trudel, and development is generously supported by the fine folks at FunnelCloud. It has been adapted to easily integrate into Fledex

For usage details, please refer to the documentation and look at the original SchedEx library documentation.

Installation

The library is available in Hex, the package can be installed by adding :fledex_scheduler to your list of dependencies in mix.exs:

def deps do
  [
    {:fledex_scheduler, "~>0.3"}
  ]
end

Basic Usage

Fledex.Scheduler.run_job/2 is the function most commonly used. You first define a Fledex.Scheduler.Job before you schedule the job. Thus, your code will look something like the following:

alias Fledex.Scheduler
alias Fledex.Scheduler.Job

job =
  Job.new()
  |> Job.set_name(:test_job)
  |> Job.set_schedule(crontab)
  |> Job.set_task(fn -> 
    # do something useful
    :ok
  end)
  |> Job.set_repeat(true)
  |> Job.set_run_once(false)
  |> Job.set_timezone("Etc/UTC")
  |> Job.set_overlap(false)
  |> Job.set_nonexistent_time_strategy(:adjust)
  |> Job.set_context(%{strip_name: :test_strip, job: :test_job})

{:ok, pid} = Scheduler.run_job(job)

If more control over the scheduling process is required (for example by integrating it into a supervision tree) it's also possible to use the Runner (Fledex.Scheduler.Runner) directly. The Fledex.Scheduler.run_job/2 maps directly to the Fledex.Scheduler.Runner.run/3 or Fledex.Scheduler.Runner.start_link/3 with additional server options.

Differences vs SchedEx

SchedEx was the base for this library and the core implementation hasn't changed. Here the biggest changes:

Copyright and License

Copyright (c) 2025-2026, Matthias Reik fledex@reik.org

Copyright (c) 2018 Mat Trudel on behalf of FunnelCloud Inc.

This work is free. You can redistribute it and/or modify it under the terms of the MIT License. See the LICENSE.md file for more details.