Skip to main content

Job scheduling and tracking library

Project description

Job Control

https://raw.githubusercontent.com/rshk/jobcontrol/develop/.misc/banner.png

Job scheduling and tracking library.

Provides a base interface for scheduling, running, tracking and retrieving results for “jobs”.

Each job definition is simply any Python callable, along with arguments to be passed to it.

The tracking include storing: - the function return value - any exception raised - log messages produced during task execution - optionally a “progress”, if the task supports it

The status storage is completely decoupled from the main application.

The project “core” currently includes two storage implementations:

  • MemoryStorage – keeps all data in memory, useful for development / testing.

  • PostgreSQLStorage – keeps all data in a PostgreSQL database, meant for production use.

Project status

Travis CI build status

Branch

Status

master

https://travis-ci.org/rshk/jobcontrol.svg?branch=master

develop

https://travis-ci.org/rshk/jobcontrol.svg?branch=develop

Source code

Source is hosted on GitHub: https://github.com/rshk/jobcontrol/

And can be cloned with:

git clone https://github.com/rshk/jobcontrol.git

Python Package Index

The project can be found on PyPI here: https://pypi-hypernode.com/pypi/jobcontrol

Latest PyPI version Number of PyPI downloads Supported Python versions Development Status License

Project documentation

Documentation is hosted on GitHub pages: (coming soon!) http://rshk.github.io/jobcontrol/

Concepts

  • Each job is defined as a Python function to be run, with arguments and keywords.

  • Each job can depend on other jobs; the dependency sistem ensures all dependencies are built before running a given job, and that depending jobs are rebuilt when a “higher-level” one is built.

Example:

┌─────────┐   ┌─────────┐   ┌─────────┐   ┌─────────┐
│         │   │         │   │         │   │         │
│  Job A  │ → │  Job B  │ → │  Job C  │ → │  Job D  │
│         │   │         │   │         │   │         │
└─────────┘   └─────────┘   └─────────┘   └─────────┘

When running the task C, a build of B will be required; this in turn requires a build of A. If build_deps=True was specified, a build of C and B will be triggered. Otherwise, the build will terminate with a “dependencies not met” error.

After a successful build of C, D is not outdated. If build_depending=True was specified, a build of D will be triggered.

Other example: Job #2 depends on Job #2:

Job #1

Build

Succ?

Time

Skip?

1

TRUE

1

FALSE

2

FALSE

3

FALSE

3

TRUE

4

TRUE

4

TRUE

5

FALSE

Job #2

Build

Succ?

Time

Skip?

1

TRUE

2

FALSE

No rebuild needed.

No rebuild needed.

2

TRUE

6

FALSE

Changelog

v0.1a

  • Support definition of jobs, with: function, args, kwargs, dependencies

  • Support tracking of job runs, with start/end date, started/finished/success state and return value

  • Support for storing logs from job runs

  • Memory-backed storage (for state)

  • PostgreSQL-backed storage (for state)

Project details


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