aboutsummaryrefslogtreecommitdiff
path: root/rhodecode
diff options
context:
space:
mode:
authorMarcin Kuzminski <marcin@python-works.com>2010-10-07 19:24:03 +0200
committerMarcin Kuzminski <marcin@python-works.com>2010-10-07 19:24:03 +0200
commit4addd5ddf610c45e27df99ebb0d9ed0d71779b43 (patch)
treebcda77a3d958b86a5bc8e26c4fb3ec2886c6f2a8 /rhodecode
parent889dbd58bccb17162797676a4ffca1dd72aa5836 (diff)
more error catching on celery run_task
Diffstat (limited to 'rhodecode')
-rw-r--r--rhodecode/lib/celerylib/__init__.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/rhodecode/lib/celerylib/__init__.py b/rhodecode/lib/celerylib/__init__.py
index a5c2311e..000d21ab 100644
--- a/rhodecode/lib/celerylib/__init__.py
+++ b/rhodecode/lib/celerylib/__init__.py
@@ -6,6 +6,7 @@ import os
import sys
import traceback
from hashlib import md5
+import socket
log = logging.getLogger(__name__)
class ResultWrapper(object):
@@ -21,14 +22,17 @@ def run_task(task, *args, **kwargs):
t = task.delay(*args, **kwargs)
log.info('running task %s', t.task_id)
return t
- except Exception, e:
- print e
- if e.errno == 111:
- log.debug('Unnable to connect. Sync execution')
+ except socket.error, e:
+ if e.errno == 111:
+ log.debug('Unable to connect to celeryd. Sync execution')
else:
- log.error(traceback.format_exc())
- #pure sync version
- return ResultWrapper(task(*args, **kwargs))
+ log.error(traceback.format_exc())
+ except KeyError, e:
+ log.debug('Unable to connect to celeryd. Sync execution')
+ except Exception, e:
+ log.error(traceback.format_exc())
+
+ return ResultWrapper(task(*args, **kwargs))
def locked_task(func):