mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-28 16:28:01 -05:00
updates to service monitor. fix 500 on /api/info for empty listings
This commit is contained in:
@@ -302,7 +302,7 @@ class RedditJsonTemplate(JsonTemplate):
|
||||
|
||||
class PanestackJsonTemplate(JsonTemplate):
|
||||
def render(self, thing = None, *a, **kw):
|
||||
res = [t.render() for t in thing.stack] if thing else []
|
||||
res = [t.render() for t in thing.stack if t] if thing else []
|
||||
res = [x for x in res if x]
|
||||
if not res:
|
||||
return {}
|
||||
|
||||
@@ -21,5 +21,5 @@
|
||||
################################################################################
|
||||
|
||||
%for t in thing.stack:
|
||||
${t.render()}
|
||||
${t.render() if t else ''}
|
||||
%endfor
|
||||
|
||||
@@ -298,15 +298,6 @@ def run_top(proc_ids = [], name = '', exe = "/usr/bin/top"):
|
||||
|
||||
handle = subprocess.Popen(cmd, stdout = subprocess.PIPE,
|
||||
stderr = subprocess.PIPE)
|
||||
if handle.wait():
|
||||
cmd = [exe, '-l', '1', '-p',
|
||||
"^aaaaa ^nnnnnnnnn X X X X X X ^ccccc 0.0" +
|
||||
" ^wwwwwwwwwww ^bbbbbbbbbbbbbbb"]
|
||||
handle = subprocess.Popen(cmd, stdout = subprocess.PIPE,
|
||||
stderr = subprocess.PIPE)
|
||||
if handle.wait():
|
||||
raise ValueError, "failed to run top"
|
||||
|
||||
proc_ids = set(map(int, proc_ids))
|
||||
res = {}
|
||||
for line in handle.communicate()[0].split('\n'):
|
||||
|
||||
Reference in New Issue
Block a user