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

Provides ability calculate average time of tasks

Project Description

## Package includes:

#### AVGTimeRedis class
The class that helps automate calculate an avarage time
for different kind tasks and saves result into Redis DB

## Install
Install from Github

```pip install```

## Usage

1. You must will add the mixin class as first argument
2. You should set ```default_avg_time``` in the seconds
3. You must use ```self.update_progress()``` without arguments

class YourTask(AVGTimeRedis, JobtasticTask):
default_avg_time = 60 # 1 minute


def calculate_result(self, ..., **kwargs):

```default_avg_time``` used when task still never calculated
It will be encompass arithmetical mean after task was executed.
Forecast accuracy depends from count executed tasks

### Example with AVGTimeRedis class

The class that helps automate calculate an avarage time for different kind
tasks and saves result into Redis DB

Let's take a look at the example task using with JobtasticMixins and
AVGTimeRedis class:

``` python
from time import sleep
from jobtastic import JobtasticTask
from jobtasticmixins import AVGTimeRedis

class LotsOfDivisionTask(AVGTimeRedis, JobtasticTask):
Division is hard. Make Celery do it a bunch.
significant_kwargs = [
('numerators', str),
('denominators', str),
herd_avoidance_timeout = 60
cache_duration = 0
# optional variable was added. by default is 30 seconds
default_avg_time = 90

def calculate_result(self, numerators, denominators, **kwargs):
results = []
for count, divisors in enumerate(zip(numerators, denominators)):
numerator, denominator = divisors
results.append(numerator / denominator)
# it will be auto calculated

# set finish=True for avoid trouble
return results


Under the hood:

1. AVGTimeRedis gets settings.BROKER_URL and connects to Redis
2. It counts the tasks and the workers and uses to calculating

More details you can see into [source](
Release History

Release History

This version
History Node


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
jobtastic-mixins-0.1.tar.gz (5.2 kB) Copy SHA256 Checksum SHA256 Source Mar 20, 2015

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