Skip to main content

A python implementation of a cron job scheduler

Project description

Process Boss

Python CI Build PyPI Downloads

A Cron job scheduler implemented in Python

1. Installation

pip install process_boss

2. Usage

Create a configuration file in config.yaml somewhere on disk, then run process boss:

python -m process_boss ~/config.yaml

Example: Run a script on Monday mornings

processes:
  - id: test-job
    cron: "0 7 * * MON" # every Monday at 7:00 AM
    command: "echo 'Hello World!'"

Example: Run a script on Monday mornings with logging and for long running tasks

scheduler:
  maxWorkers: 5
  loop:
    restartSeconds: 21600 # 6 hours
logs:
  enabled: true
  schedulerLogdir: "c:\\process_boss\\logs\\scheduler"
  processLogdir: "c:\\process_boss\\logs\\process"
processes:
  - id: test-job
    cron: "0 7 * * MON" # every Monday at 7:00 AM
    command: "python c:\\app\\index.py"
    runAtStartup: true

3. Configuration reference

Property Required Default Description
scheduler.maxWorkers No 10 Each process is executed in a thread. This is the maximum number of threads that should be used
scheduler.loop.restartSeconds No 15 Number of seconds to wait before reading the config again and evaluating all processes' cron expressions
scheduler.loop.runOnce No False If set to True, the processes in the config file will only be read and executed once, after that process_boss exits.
logs.enabled No False If set to True, it enables logging of both the scheduler, and each execute process in a separate file. The below two are required to set if enabled.
logs.schedulerLogDir No "" Absolute directory path where the log file of the scheduler can be created per each process. Contains metadata about when a given process will run next, and with what parameters. Eg: /var/log/process_boss/scheduler
logs.processLogDir No "" Absolute directory path where the log file of each process can be created, one per execution. Contains the parameters used before ezecution, and the STDOUT and STDERR output of the process. Eg: /var/log/process_boss/process
processes[].id Yes - Non-empty arbitrary string. Eg: my-process
processes[].cron Yes - Non-empty string, should be a CRON expression. Eg. 0 7 * * MON
processes[].command Yes - Non-empty string, should be an executable command. Eg. python script.py
processes[].runAtStartup No False If set to True, the process will be executed immediately when process_boss starts, instead of waiting for the next CRON match

4. Maintainer documentation

See: docs/README_MAINTAINER.md

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

process_boss-0.0.6.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

process_boss-0.0.6-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file process_boss-0.0.6.tar.gz.

File metadata

  • Download URL: process_boss-0.0.6.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for process_boss-0.0.6.tar.gz
Algorithm Hash digest
SHA256 136ac68b1ebe1f6ea0acf9754bd5ccdc138d48235a8126736e4be11c22cb6c15
MD5 8ea413030d650cb667467ac00edda972
BLAKE2b-256 936a7e52868d022993c25701f1399c8e0343c082894917dc5e0e9c3dc7d6426a

See more details on using hashes here.

File details

Details for the file process_boss-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: process_boss-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for process_boss-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 868a7a9fa0b835a0d8cede1bd89db91d8f1272dadeb914171c187d8c7f997f52
MD5 02d5830ea336136cd78703133c9f8e19
BLAKE2b-256 75a90f36916787124b58c84a594a37444d43dbfd05581899909dd409d549d428

See more details on using hashes here.

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