Merge lp:~jameinel/maas/ignore_results into lp:~maas-committers/maas/trunk

Proposed by John A Meinel
Status: Merged
Approved by: John A Meinel
Approved revision: no longer in the source branch.
Merged at revision: 1179
Proposed branch: lp:~jameinel/maas/ignore_results
Merge into: lp:~maas-committers/maas/trunk
Diff against target: 36 lines (+4/-4)
1 file modified
src/provisioningserver/tasks.py (+4/-4)
To merge this branch: bzr merge lp:~jameinel/maas/ignore_results
Reviewer Review Type Date Requested Status
Jeroen T. Vermeulen (community) Approve
Review via email: mp+128204@code.launchpad.net

Commit message

Pass ignore_result=True to all current celery tasks.

With celery, you are meant to fire off a job, and then grab the
result object and wait for it. The design of all current jobs is
that they just trigger and you never wait for the result.

If you don't ignore the results, then the queues build up forever
and stay alive because they wait for someone to read the result.

Description of the change

See commit message

To post a comment you must log in.
Revision history for this message
Jeroen T. Vermeulen (jtv) wrote :

I thought we had a global setting for this somewhere. If there's any more of this, maybe we need our own wrapper for @task.

review: Approve
Revision history for this message
John A Meinel (jameinel) wrote :

I saw something about setting an expiry time for queues. I'm not sure that ignore_result can be set in config.

Revision history for this message
Raphaël Badin (rvb) wrote :

Not sure why you need to do that, CELERY_IGNORE_RESULT is set to True in etc/celeryconfig_common.py.

?

Revision history for this message
John A Meinel (jameinel) wrote :

Re-approving to revert the original change.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/provisioningserver/tasks.py'
2--- src/provisioningserver/tasks.py 2012-10-04 05:49:09 +0000
3+++ src/provisioningserver/tasks.py 2012-10-05 10:05:26 +0000
4@@ -64,7 +64,7 @@
5 celery_config = app_or_default().conf
6
7
8-@task
9+@task(ignore_result=True)
10 def refresh_secrets(**kwargs):
11 """Update the worker's knowledge of various secrets it needs.
12
13@@ -135,13 +135,13 @@
14 # TODO: signal to webapp that it worked.
15
16
17-@task
18+@task(ignore_result=True)
19 def power_on(power_type, **kwargs):
20 """Turn a node on."""
21 issue_power_action(power_type, 'on', **kwargs)
22
23
24-@task
25+@task(ignore_result=True)
26 def power_off(power_type, **kwargs):
27 """Turn a node off."""
28 issue_power_action(power_type, 'off', **kwargs)
29@@ -340,7 +340,7 @@
30 boot_images.report_to_server()
31
32
33-@task
34+@task(ignore_result=True)
35 def update_node_tags(tag_name, tag_definition):
36 """Update the nodes for a new/changed tag definition.
37