##// END OF EJS Templates
celery: use safer events for execution of tasks
marcink -
r2464:d10039ef default
parent child Browse files
Show More
@@ -136,27 +136,35 b' def on_preload_parsed(options, **kwargs)'
136 @signals.task_success.connect
136 @signals.task_success.connect
137 def task_success_signal(result, **kwargs):
137 def task_success_signal(result, **kwargs):
138 meta.Session.commit()
138 meta.Session.commit()
139 celery_app.conf['PYRAMID_CLOSER']()
139 closer = celery_app.conf['PYRAMID_CLOSER']
140 if closer:
141 closer()
140
142
141
143
142 @signals.task_retry.connect
144 @signals.task_retry.connect
143 def task_retry_signal(
145 def task_retry_signal(
144 request, reason, einfo, **kwargs):
146 request, reason, einfo, **kwargs):
145 meta.Session.remove()
147 meta.Session.remove()
146 celery_app.conf['PYRAMID_CLOSER']()
148 closer = celery_app.conf['PYRAMID_CLOSER']
149 if closer:
150 closer()
147
151
148
152
149 @signals.task_failure.connect
153 @signals.task_failure.connect
150 def task_failure_signal(
154 def task_failure_signal(
151 task_id, exception, args, kwargs, traceback, einfo, **kargs):
155 task_id, exception, args, kwargs, traceback, einfo, **kargs):
152 meta.Session.remove()
156 meta.Session.remove()
153 celery_app.conf['PYRAMID_CLOSER']()
157 closer = celery_app.conf['PYRAMID_CLOSER']
158 if closer:
159 closer()
154
160
155
161
156 @signals.task_revoked.connect
162 @signals.task_revoked.connect
157 def task_revoked_signal(
163 def task_revoked_signal(
158 request, terminated, signum, expired, **kwargs):
164 request, terminated, signum, expired, **kwargs):
159 celery_app.conf['PYRAMID_CLOSER']()
165 closer = celery_app.conf['PYRAMID_CLOSER']
166 if closer:
167 closer()
160
168
161
169
162 def setup_celery_app(app, root, request, registry, closer, ini_location):
170 def setup_celery_app(app, root, request, registry, closer, ini_location):
General Comments 0
You need to be logged in to leave comments. Login now