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


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

easysched-1.2.9-py3-none-any.whl (39.9 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