Job scheduling and tracking library
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.
Travis CI build status
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.python.org/pypi/jobcontrol
Documentation is hosted on GitHub pages: (coming soon!) http://rshk.github.io/jobcontrol/
- 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.
┌─────────┐ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ │ │ │ │ │ │ │ │ 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:
|No rebuild needed.|
|No rebuild needed.|
- 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)