This file contains hidden or 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
Index: Lib/multiprocessing/pool.py | |
=================================================================== | |
--- Lib/multiprocessing/pool.py (revision 74797) | |
+++ Lib/multiprocessing/pool.py (working copy) | |
@@ -42,9 +42,10 @@ | |
# Code run by worker processes | |
# | |
-def worker(inqueue, outqueue, initializer=None, initargs=()): | |
+def worker(inqueue, outqueue, ackqueue, initializer=None, initargs=()): |
This file contains hidden or 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
--- Lib/multiprocessing/pool.py 2009-02-06 15:42:30.000000000 +0100 | |
+++ /opt/devel/celery/celery/_pool.py 2009-09-14 19:24:36.000000000 +0200 | |
@@ -42,9 +42,10 @@ | |
# Code run by worker processes | |
# | |
-def worker(inqueue, outqueue, initializer=None, initargs=()): | |
+def worker(inqueue, outqueue, ackqueue, initializer=None, initargs=()): | |
put = outqueue.put | |
get = inqueue.get |
This file contains hidden or 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
"""Publish and detect reusable app requirements. | |
Problem | |
------- | |
Django projects use a lot of external apps, some of these has dependencies | |
to other apps, the usual way of disclosing these dependencies is by writing | |
a note in the distributions README:: | |
This application depends on django-tagging. |
This file contains hidden or 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
import os | |
import sys | |
class ModuleMask(object): | |
"""Hide a module, so it behaves as it's not installed. | |
This is for the coverage whores out there. | |
Examples usage |
This file contains hidden or 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
from multiprocessing.pool import Pool, worker | |
class DynamicPool(Pool): | |
def __init__(self, processes=None, initializer=None, initargs=()): | |
super(DynamicPool, self).__init__(processes=processes, | |
initializer=initializer, | |
initargs=initargs) |
This file contains hidden or 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
# A pydoc that can read modules using Django. | |
#!/usr/bin/env python | |
from django.conf import settings | |
if not settings.configured: | |
settings.configure() | |
import pydoc | |
if __name__ == "__main__": | |
pydoc.cli() |
This file contains hidden or 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
#!/usr/bin/env python | |
from django.conf import settings | |
if not settings.configured: | |
settings.configure() | |
import pydoc | |
if __name__ == "__main__": | |
pydoc.cli() |
This file contains hidden or 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
""" | |
Consumer | |
-------- | |
>>> import ericflopsy | |
>>> conn = ericflopsy.Connection() | |
>>> consumer = ericflopsy.Consumer(connection=conn) | |
>>> def print_message(message_body, message): | |
... print 'Recieved: ' + message_body | |
... message.ack() |
This file contains hidden or 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
def partial_cls(name, cls, *args, **kwargs): | |
def constructor(self, *moreargs, **morekwargs): | |
super(self.__class__, self).__init__( | |
*(args+moreargs), **dict(kwargs, **morekwargs)) | |
constructor.__doc__ = cls.__init__.__doc__ | |
constructor.func_name = cls.__init__.__name__ | |
dict_ = {"__init__": constructor} | |
return type(name, (cls, ), dict_) |
This file contains hidden or 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
import settings | |
from django.core.management import setup_environ | |
setup_environ(settings) | |
from djangofeeds.messaging import consumer as feed_consumer | |
from djangofeeds.importers import FeedImporter | |
from UserList import UserList | |
import multiprocessing | |
import simplejson | |
import logging | |
import time |