-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Matt George
committed
Jun 4, 2012
0 parents
commit 470fc80
Showing
11 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
*.pyc | ||
build/ | ||
.coverage | ||
*.egg-info | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
VERSION = (0, 1, 0) | ||
__version__ = '.'.join(map(str, VERSION)) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from django.conf import settings #noqa | ||
from appconf import AppConf | ||
|
||
class PyresConf(AppConf): | ||
HOST = "localhost:6379" | ||
PASSWORD = None | ||
WORKER_PIDFILE = None | ||
WORKER_INTERVAL = None | ||
WORKER_LOGFILE = None | ||
WORKER_TIMEOUT= None | ||
MANAGER_POOL_SIZE=2 | ||
|
||
class Meta: | ||
prefix = 'pyres' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
from pyres import ResQ | ||
from django.conf import settings | ||
pyres = ResQ(getattr(settings,'PYRES_HOST','localhost:6379'),getattr(settings,'PYRES_PASSWORD',None)) | ||
|
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import logging | ||
from django.core.management.base import BaseCommand, CommandError | ||
from django_pyres.conf import settings | ||
|
||
from optparse import make_option | ||
from pyres.horde import Khan | ||
from pyres import setup_pidfile | ||
|
||
class Command(BaseCommand): | ||
option_list = BaseCommand.option_list + ( | ||
make_option("--pool", type="int", dest="pool_size", default=0, help="Number of minions to spawn under the manager."), | ||
make_option('-l', '--log-level', dest='log_level', default='info', help='log level. Valid values are "debug", "info", "warning", "error", "critical", in decreasing order of verbosity. Defaults to "info" if parameter not specified.'), | ||
make_option('-f', dest='logfile', help='If present, a logfile will be used. "stderr", "stdout", and "syslog" are all special values.'), | ||
) | ||
help = 'Closes the specified poll for voting' | ||
|
||
def handle(self, queue_list, **options): | ||
queues = queue_list.split(',') | ||
log_level = getattr(logging, options['log_level'].upper(), 'INFO') | ||
pool_size = options.get('pool_size') | ||
if pool_size == 0: | ||
pool_size = settings.PYRES_MANAGER_POOL_SIZE | ||
setup_pidfile(settings.PYRES_WORKER_PIDFILE) | ||
Khan.run( | ||
pool_size=pool_size, | ||
queues=queues, | ||
server=settings.PYRES_HOST, | ||
logging_level=log_level, | ||
log_file=None) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import logging | ||
from django.core.management.base import BaseCommand, CommandError | ||
from django_pyres.conf import settings | ||
|
||
from optparse import make_option | ||
from pyres.worker import Worker | ||
from pyres import setup_logging, setup_pidfile | ||
|
||
class Command(BaseCommand): | ||
option_list = BaseCommand.option_list + ( | ||
make_option('-l', '--log-level', dest='log_level', default='info', help='log level. Valid values are "debug", "info", "warning", "error", "critical", in decreasing order of verbosity. Defaults to "info" if parameter not specified.'), | ||
) | ||
help = 'Closes the specified poll for voting' | ||
|
||
def handle(self, queue_list, **options): | ||
queues = queue_list.split(',') | ||
log_level = getattr(logging, options['log_level'].upper(), 'INFO') | ||
setup_logging(procname="pyres_worker", log_level=log_level, filename=None) | ||
setup_pidfile(settings.PYRES_WORKER_PIDFILE) | ||
Worker.run( | ||
queues, | ||
settings.PYRES_HOST, | ||
settings.PYRES_WORKER_INTERVAL, | ||
timeout=settings.PYRES_WORKER_TIMEOUT | ||
) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from django.db import models | ||
# Create your models here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# Create your views here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from setuptools import setup, find_packages | ||
version=__import__('django_pyres').__version__ | ||
setup( | ||
name='django_pyres', | ||
version=version, | ||
description='django pyres ', | ||
author='Matt George', | ||
author_email='[email protected]', | ||
maintainer='Matt George', | ||
license='MIT', | ||
url='http://github.com/Pyres/django_pyres', | ||
packages=find_packages(exclude=['ez_setup', 'example','testapp','tests']), | ||
include_package_data=True, | ||
install_requires=[ | ||
'pyres>=1.3', | ||
], | ||
classifiers = [ | ||
'Development Status :: 4 - Beta', | ||
'Environment :: Console', | ||
'Intended Audience :: Developers', | ||
'License :: OSI Approved :: MIT License', | ||
'Operating System :: OS Independent', | ||
'Programming Language :: Python'], | ||
) | ||
|