Permalink
Browse files

flake8

  • Loading branch information...
1 parent 38c0fd9 commit 8100065cbe2aba16be21fa01f4c2527caa638b17 @ask ask committed Aug 18, 2012
View
@@ -1,4 +1,6 @@
+from __future__ import absolute_import
+
VERSION = (0, 3, 0)
__version__ = '.'.join(map(str, VERSION))
-from app import Flower
+from .app import Flower # noqa
View
@@ -1,3 +1,5 @@
+from __future__ import absolute_import
+
import tornado.websocket
View
@@ -1,3 +1,5 @@
+from __future__ import absolute_import
+
import sys
from ..api import BaseWebSocketHandler
@@ -15,20 +17,20 @@ def send_message(cls, event):
l.write_message(event)
-EVENTS = ('task-sent', 'task-received','task-started','task-succeeded',
+EVENTS = ('task-sent', 'task-received', 'task-started', 'task-succeeded',
'task-failed', 'task-revoked', 'task-retried')
def getClassName(eventname):
- return ''.join(map(lambda x:x[0].upper()+x[1:], eventname.split('-')))
+ return ''.join(map(lambda x: x[0].upper() + x[1:], eventname.split('-')))
# Dynamically generates handler classes
thismodule = sys.modules[__name__]
for event in EVENTS:
classname = getClassName(event)
setattr(thismodule, classname,
- type(classname, (EventsApiHandler,), {'listeners':[]}))
+ type(classname, (EventsApiHandler, ), {'listeners': []}))
__all__ = map(getClassName, EVENTS)
View
@@ -42,5 +42,5 @@ def get(self, taskid):
raise HTTPError(503)
response = {'task-id': taskid, 'state': result.state}
if result.ready():
- response.update({'result': result.result})
+ response.update({'result': result.result})
self.write(response)
View
@@ -1,3 +1,5 @@
+from __future__ import absolute_import
+
import tornado.web
from tornado import ioloop
View
@@ -39,4 +39,3 @@ def flower_option(arg):
name, _, value = arg.lstrip('-').partition("=")
name = name.replace('-', '_')
return name in options
-
View
@@ -1,4 +1,5 @@
from __future__ import absolute_import
+from __future__ import with_statement
import time
import logging
View
@@ -22,9 +22,10 @@ def __init__(self, app):
state = self.app.state
for workername, stat in sorted(state.stats.iteritems()):
+ pool = stat.get('pool') or {}
self.workers[workername] = dict(
status=(workername in state.ping),
- concurrency=stat['pool']['max-concurrency'] if stat['pool'] else None,
+ concurrency=pool.get('max-concurrency'),
completed_tasks=sum(stat['total'].itervalues()),
running_tasks=len(state.active_tasks.get(workername, [])),
queues=map(lambda x: x['name'],
View
@@ -45,7 +45,8 @@
(r"/api/worker/pool/shrink/(.+)", control.WorkerPoolShrink),
(r"/api/worker/pool/autoscale/(.+)", control.WorkerPoolAutoscale),
(r"/api/worker/queue/add-consumer/(.+)", control.WorkerQueueAddConsumer),
- (r"/api/worker/queue/cancel-consumer/(.+)", control.WorkerQueueCancelConsumer),
+ (r"/api/worker/queue/cancel-consumer/(.+)",
+ control.WorkerQueueCancelConsumer),
# Task API
(r"/api/task/async-apply/(.+)", tasks.TaskAsyncApply),
(r"/api/task/result/(.+)", tasks.TaskResult),
View
@@ -38,4 +38,3 @@ def write_error(self, status_code, **kwargs):
self.set_header('Content-Type', 'text/plain')
self.write(message)
self.set_status(status_code)
-
View
@@ -26,7 +26,8 @@ def get(self):
worker = worker if worker != 'All' else None
type = type if type != 'All' else None
- tasks = TaskModel.iter_tasks(app, limit=limit, type=type, worker=worker)
+ tasks = TaskModel.iter_tasks(app,
+ limit=limit, type=type, worker=worker)
workers = WorkersModel.get_workers(app)
seen_task_types = TaskModel.seen_task_types(app)

0 comments on commit 8100065

Please sign in to comment.