Skip to main content

Timetable for your cronjobs

Project description

PyPI - Version

Cron-times is the timetable for your cronjobs. It shows you when your cronjobs are running, in a human-friendly way.

Screenshot of cron-times

Quick start

Install from PyPI:

pip install cron-times

Run:

flask --app cron_times init-db
flask --app cron_times run

The app will be available at http://localhost:5000

Add cronjobs

You can describe your cronjobs in TOML format:

# Always starts with [[job]]
# You can add multiple jobs in one file
[[job]]

# unique key within the group for each job
# this field is invisible to users and only used for internal reference
# if not set, it will use job name as the key
key = "custom-key-01"

# [required] job name
name = "Sample job"

# [required] cronjob schedule, in crontab format
schedule = "0 10/3 * * *"

# timezone, default to UTC
timezone = "Asia/Taipei"

# job description
description = """
In the description, you *can* use `markdown`
"""

# flag to indicate if the job is enabled
enabled = true

# labels
labels = [
   "foo",
]

# metadata
# you can use this field to store any extra information
[job.metadata]
"extra field" = "can be anything"
pi = 3.14
"reference url" = "https://example.com"

After the TOML file is ready, you can import it with the following command:

flask --app cron_times read-file /path/to/jobs.toml

Built-in job adapters

Cron-times comes with some built-in job adapters. You can use them by running the following commands and it will read the job list from the specified location.

dbt cloud

Reads schedule job list from dbt cloud:

flask --app cron_times read-dbt-cloud --help

Argo workflow

Reads Cron Workflows from Argo Workflows:

flask --app cron_times read-argo-workflow --help

Configuration

Cron-times uses Flask as the web framework, and adapts Flask’s configuration system.

Set the environment variable to the path of that file:

export CRON_TIMES_SETTINGS=/path/to/settings.cfg

You can set the following options:

# Site name to be used for the page title
SITE_NAME="My cronjobs"

# Time range to show in the timetable based on current time, in seconds
TIMETABLE_LOOKBEHIND_SECONDS=86400  # 1day
TIMETABLE_LOOKAHEAD_SECONDS=172800  # 2days

# Max number of items to show in the timetable
# If there are more items than this number, it would only return the jobs that is closest to the current time
# Note that the more items you show, the slower the page will be loaded
TIMETABLE_MAX_ITEMS=512

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cron_times-0.9.0.tar.gz (589.0 kB view hashes)

Uploaded Source

Built Distribution

cron_times-0.9.0-py3-none-any.whl (594.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page