Ours looks like this: class WinslowTask(Task): abstract = True _winslow = None
@property def winslow(self): if self._winslow is None: from winslow.lexelasticsearch import LexElasticSearch es_conf = bias_app.conf['ELASTICSEARCH'] es = LexElasticSearch(list(es_conf['urls'])) settings = generate_winslow_settings() config = configure_app(settings, es_conf['lex'], es, bias_app) self._winslow = config.make_wsgi_app() return self._winslow Winslow being the name of our Pyramid application. This creates a pyramid application per task type using the app per worker. Inside of the task we are able to use the application like so: request = Request.from_bytes(export_doc.deferred_request) request.headers['X-For-Export'] = 'true' response = request.get_response(self.winslow) On Wed, Nov 18, 2015 at 8:42 AM Robin Harms Oredsson <ro...@betahaus.net> wrote: > Hi all, > I've tried to read up on proper usage of celery within Pyramid. So far > most suggestions seem to be to load the whole stack via > pyramid.paster.bootstrap for each task. Quite cumbersome. > > The right way to do this as far as I understand would be to create a > request for each task and then close the request after each task + run any > commit hooks, pretty much like the regular router. > > Any of you guys have good example code for this? Or am I completely wrong > about it? :) > When i do it i seem to cause memory leaks. > > Cheers, > Robin Harms Oredsson > > -- > You received this message because you are subscribed to the Google Groups > "pylons-devel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to pylons-devel+unsubscr...@googlegroups.com. > To post to this group, send email to pylons-devel@googlegroups.com. > Visit this group at http://groups.google.com/group/pylons-devel. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "pylons-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to pylons-devel+unsubscr...@googlegroups.com. To post to this group, send email to pylons-devel@googlegroups.com. Visit this group at http://groups.google.com/group/pylons-devel. For more options, visit https://groups.google.com/d/optout.