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 details)

Uploaded Python 3

File details

Details for the file easysched-1.2.9-py3-none-any.whl.

File metadata

  • Download URL: easysched-1.2.9-py3-none-any.whl
  • Upload date:
  • Size: 39.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.5.2

File hashes

Hashes for easysched-1.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 4c09ca69f42461e5576473e5c57f228f92b061da5e146b923b1c6b4d31f59b0d
MD5 2e6bb8c2f71b52cf657f226d37417a50
BLAKE2b-256 86fd901cb70adce2d66d8a76a4526203edcaaa2c4f83e54803a79695cd23416d

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