Merge lp://qastaging/~doanac/lava-celery/scheduler-monitor-support into lp://qastaging/lava-celery

Proposed by Andy Doan
Status: Merged
Merged at revision: 27
Proposed branch: lp://qastaging/~doanac/lava-celery/scheduler-monitor-support
Merge into: lp://qastaging/lava-celery
Diff against target: 281 lines (+150/-50)
3 files modified
lava/celery/commands.py (+70/-3)
lava/celery/tasks.py (+79/-47)
setup.py (+1/-0)
To merge this branch: bzr merge lp://qastaging/~doanac/lava-celery/scheduler-monitor-support
Reviewer Review Type Date Requested Status
Michael Hudson-Doyle (community) Approve
Review via email: mp+114090@code.qastaging.launchpad.net

Description of the change

This updates the celery module a few ways:

1) improve run_command_task to take files as arguments
2) use fork/exec for run_command task
3) add a new celery-schedulermonitor command

To post a comment you must log in.
Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Yay for all that Unix fd yoga.

I think you should be a bunch more anal about errors in the child process: don't call sys.exit() but rather os._exit() and probably do it in a finally: block whose try: you enter first thing in the pid == 0 branch (going through the finally: clause in the run_command twice would be pretty confusing I think!).

You add celery-schedulermonitor to commands.__all__, not celery_schedulermonitor!

There's something about the way files are handled that makes me uneasy -- the code on the worker side doesn't do anything about directories or permissions, so I could imagine that if we started to write the json into /tmp/blah/foo.json rather than directly in /tmp/ things might break in unexpected ways. But well, maybe that just needs an XXX.

Otherwise, all looks ok!

review: Approve
25. By Andy Doan

retval is now handled in the _exec_command function

26. By Andy Doan

make _exec_command a little safer

This adds some exception handling per mwhudson's review comments to help
ensure we always properly exit the child process.

27. By Andy Doan

fix celery-schedulermonitor command entry

mwhudson caught this in the code review

Revision history for this message
Andy Doan (doanac) wrote :

I just added commits 25,26, and 27 per your review comments. Let me know if they seem sane, and I'll proceed with ther merge

Revision history for this message
Michael Hudson-Doyle (mwhudson) wrote :

Looks good! Sorry for not replying sooner, I think Canonical mail was broken for a while yesterday.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.

Subscribers

People subscribed via source and target branches