Skip to main content

Lightweight framework to easily schedule multiple tasks.

Project description

easysched

easysched is lightweight framework to easily schedule multiple tasks designed to be easily configurable by just a configuration file using default python tools.

With this framework you can call every type of executable, independent of the programming language, for instance bash/perl scripts, C/C++ programs, Java... or any other executable. Additionally, you can define the priority of a Task, which user should be the callee and if the Task should be run once or cyclic by defining the Task execution interval and if the output of a process should be logged into a file.

All of this is easily configurable with only one configuration file. The parse process is based on the configparser class of python3.X with the extended interpolation feature and enriched with additional functionality to call tasks.

Installation

You can find the latest version on PyPi. So simply use pip with

pip install easysched

After installing easysched there is a file easysched.service in the <venv>/share/ directory in order to set up easysched as a user service. Just replace the sample configuration file with the one on your system and then run

sudo systemctrl enable <venv>/share/easysched

Usage

A sample simple configuration file example.cfg can be found next to the service file with the following content:

[easysched]
Task-tag=Task:
tmp-dir=/tmp/
log-dir=${tmp-dir}

[Task:PrintDateEverySecond]
command=/bin/echo
parameters=$$(date +"%Y%m%d %H%M%S")
interval=1

[Task:PrintEveryFiveSeconds]
command=/bin/echo
parameters=$$(date +"%Y%m%d %H%M%S")
interval=5

The section for general information is named easysched so that you can use this configuration file for other scripts, too. You can define where to save log files with the log-dir and temporary file with the tmp-dir attribute.

The Task-tag option in the easysched section is optional - by default the tag Task: is assumed to be the section tag for defining tasks. Feel free to change this to your needs.

For attributes defined in the config files ending with -dir, the directories will be created by easysched. You don't have to create them manually.

Start easysched

In order to run the easysched deamon with the example configuration given above, simply run

esdd --config=venv/share/example.cfg

Control easysched tasks

Now that easysched is running it waits for commands to start, pause, stop or terminate a Task. In order to send easysched such commands, use the easysched control tool esdctrl.

For instance, to start the task PrintEveryFiveSeconds in the example configuration, run the following command:

esdctrl task PrintEveryFiveSeconds start

Project details


Release history Release notifications

Download files

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

Files for easysched, version 1.2.9
Filename, size File type Python version Upload date Hashes
Filename, size easysched-1.2.9-py3-none-any.whl (39.9 kB) File type Wheel Python version py3 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page