This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!
Project Description

Krux Python class built on top of [Krux Stdlib]( for interacting with [APScheduler](

Application quick start

The most common use case for this library is to run a job periodically from a script.
To do that, do the following:


import time
from krux_scheduler import Application

def main():
### The name must be unique to the organization. The object
### returned inherits from krux.cli.Application, so it provides
### all that functionality as well.
app = Application( name = 'krux-my-periodic-job' )

### This is the scheduler object, which behaves exactly
### like an APScheduler object, but with logging, stats
### and CLI support added.
scheduler = app.scheduler

### define the job you want to run periodically
def periodic_job():
print 'Called %s at %s' % (, time.asctime())

### add the periodic job to the scheduler. This follows
### APSchedulers arguments & functionality exactly.
func = periodic_job,
hour = '0,8,16'
minute = '0',

### start the scheduler

### always call app.exit(), so any clean up that needs to
### happen can be done at the end of your program. It also
### sets the exit code for you appropriately.

### Run the application stand alone
if __name__ == '__main__':


Seeing it in action

This library comes with a CLI tool bundled that shows you how the code works.
If you run this, it'll alternate between throwing an exception (which is caught)
and a simple printed message.

These are the options and how you can invoke it:

$ krux-scheduler-test -h
usage: krux-scheduler-test [-h]
[--log-level {info,debug,critical,warning,error}]
[--stats] [--stats-host STATS_HOST]
[--stats-port STATS_PORT]
[--stats-environment STATS_ENVIRONMENT]
[--scheduler-minute SCHEDULER_MINUTE]
[--scheduler-hour SCHEDULER_HOUR]


optional arguments:
-h, --help show this help message and exit

--log-level {info,debug,critical,warning,error}
Verbosity of logging. (default: warning)

--stats Enable sending statistics to statsd. (default: False)
--stats-host STATS_HOST
Statsd host to send statistics to. (default:
--stats-port STATS_PORT
Statsd port to send statistics to. (default: 8125)
--stats-environment STATS_ENVIRONMENT
Statsd environment. (default: dev)

--scheduler-minute SCHEDULER_MINUTE
Comma separated list of minute mark(s) to run on. This
overrides any hardcoded arguments (default: None)
--scheduler-hour SCHEDULER_HOUR
Comma separated list of hour mark(s) to run on. This
overrides any hardcoded arguments (default: None)
Run scheduled jobs in separate threads (default:
Exit the application after a job has completed. Very
useful for RAM hungry applications whose only purpose
is to run a single job but not otherwise. Requires a
process monitor to restart if it exits (default:
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
krux-scheduler-0.0.2.tar.gz (7.9 kB) Copy SHA256 Checksum SHA256 Source Sep 16, 2014

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting