Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

celery backend: add switch to tweak disable sync in result.get() #16

Merged
merged 1 commit into from
Nov 8, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packtivity/asyncbackends.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import traceback
import os
import logging
import yaml

from .syncbackends import run_packtivity
from .syncbackends import prepublish
Expand Down Expand Up @@ -196,13 +197,14 @@ class CeleryBackend(PythonCallableAsyncBackend):
def __init__(self,app = None, packconfig_spec = None):
super(CeleryBackend,self).__init__(packconfig_spec)
self.app = app or default_celeryapp
self.disable_sync = yaml.load(os.environ.get('PACKTIVITY_CELERY_DISABLE_SYNC','true'))

def submit_callable(self,callable):
self.app.set_current()
return CeleryProxy(run_nullary.apply_async(kwargs = {'nullary': callable}))

def result(self,resultproxy):
return resultproxy.proxy.get()
return resultproxy.proxy.get(disable_sync_subtasks = self.disable_sync)

def ready(self,resultproxy):
return resultproxy.proxy.ready()
Expand Down