##// END OF EJS Templates
more error catching on celery run_task
marcink -
r558:14559eb3 default
parent child Browse files
Show More
@@ -6,6 +6,7 b' import os'
6 import sys
6 import sys
7 import traceback
7 import traceback
8 from hashlib import md5
8 from hashlib import md5
9 import socket
9 log = logging.getLogger(__name__)
10 log = logging.getLogger(__name__)
10
11
11 class ResultWrapper(object):
12 class ResultWrapper(object):
@@ -21,14 +22,17 b' def run_task(task, *args, **kwargs):'
21 t = task.delay(*args, **kwargs)
22 t = task.delay(*args, **kwargs)
22 log.info('running task %s', t.task_id)
23 log.info('running task %s', t.task_id)
23 return t
24 return t
25 except socket.error, e:
26 if e.errno == 111:
27 log.debug('Unable to connect to celeryd. Sync execution')
28 else:
29 log.error(traceback.format_exc())
30 except KeyError, e:
31 log.debug('Unable to connect to celeryd. Sync execution')
24 except Exception, e:
32 except Exception, e:
25 print e
33 log.error(traceback.format_exc())
26 if e.errno == 111:
34
27 log.debug('Unnable to connect. Sync execution')
35 return ResultWrapper(task(*args, **kwargs))
28 else:
29 log.error(traceback.format_exc())
30 #pure sync version
31 return ResultWrapper(task(*args, **kwargs))
32
36
33
37
34 def locked_task(func):
38 def locked_task(func):
General Comments 0
You need to be logged in to leave comments. Login now