Skip to content

Commit

Permalink
Fix some lint. Release as 0.1.10
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvinus committed Feb 11, 2015
1 parent 794884a commit 6f49353
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 21 deletions.
4 changes: 3 additions & 1 deletion mrq/basetasks/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ def run(self, params):

query = self.build_query()

return self.perform_action(self.params.get("action"), query, self.params.get("destination_queue"))
return self.perform_action(
self.params.get("action"), query, self.params.get("destination_queue")
)

def build_query(self):
query = {}
Expand Down
5 changes: 3 additions & 2 deletions mrq/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ def add_parser_args(parser, config_type):
'--mongodb_logs',
action='store',
default="1",
help='MongoDB URI for the logs database. If set to "0", will disable remote logs. If set to "1", will use main MongoDB.')
help='MongoDB URI for the logs database. ' +
' "0" will disable remote logs, "1" will use main MongoDB.')

parser.add_argument(
'--mongodb_logs_size',
Expand Down Expand Up @@ -142,7 +143,7 @@ def add_parser_args(parser, config_type):
default=7 * 24 * 3600,
action='store',
type=int,
help='Seconds the results are kept in MongoDB when status in ("success", "cancel", "abort")')
help='Seconds the results are kept in MongoDB when status in (success, cancel, abort)')

parser.add_argument(
'--default_job_timeout',
Expand Down
18 changes: 9 additions & 9 deletions mrq/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def _connections_factory(attr):

if attr == "mongodb_logs" and config_obj == "1":
return connections.mongodb_jobs
elif config_obj in ("0"):
elif config_obj == "0":
return None

try:
Expand Down Expand Up @@ -257,20 +257,20 @@ def set_current_job_progress(ratio, save=False):

# Imports for backward compatibility
def queue_raw_jobs(*args, **kwargs):
from .job import queue_raw_jobs
return queue_raw_jobs(*args, **kwargs)
from . import job
return job.queue_raw_jobs(*args, **kwargs)


def queue_job(*args, **kwargs):
from .job import queue_job
return queue_job(*args, **kwargs)
from . import job
return job.queue_job(*args, **kwargs)


def queue_jobs(*args, **kwargs):
from .job import queue_jobs
return queue_jobs(*args, **kwargs)
from . import job
return job.queue_jobs(*args, **kwargs)


def metric(*args, **kwargs):
from .helpers import metric
return metric(*args, **kwargs)
from . import helpers
return helpers.metric(*args, **kwargs)
6 changes: 3 additions & 3 deletions mrq/dashboard/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ def build_api_datatables_query(req):
if req.args.get(param):
query[param] = req.args.get(param)
if req.args.get("status"):
statuses = req.args.get(param).split("-")
statuses = req.args["status"].split("-")
if len(statuses) == 1:
query[param] = statuses[0]
query["status"] = statuses[0]
else:
query[param] = {"$in": statuses}
query["status"] = {"$in": statuses}
if req.args.get("id"):
query["_id"] = ObjectId(req.args.get("id"))
if req.args.get("worker"):
Expand Down
7 changes: 5 additions & 2 deletions mrq/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ def _get_exception_name(self):
def __str__(self):
s = self._get_exception_name()
if self.original_exception is not None:
s += "\n---- Original exception: -----\n%s" % ("".join(traceback.format_exception(*self.original_exception)))
tb = "".join(traceback.format_exception(*self.original_exception))
s += "\n---- Original exception: -----\n%s" % tb

return s

Expand All @@ -32,7 +33,9 @@ class RetryInterrupt(_MrqInterrupt):
retry_count = 0

def _get_exception_name(self):
return "%s #%s: %s seconds, %s queue" % (self.__class__.__name__, self.retry_count, self.delay, self.queue)
return "%s #%s: %s seconds, %s queue" % (
self.__class__.__name__, self.retry_count, self.delay, self.queue
)


class MaxRetriesInterrupt(_MrqInterrupt):
Expand Down
2 changes: 1 addition & 1 deletion mrq/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import traceback
import sys

import context
from . import context


class Job(object):
Expand Down
6 changes: 4 additions & 2 deletions mrq/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from .redishelpers import redis_group_command
import time
from bson import ObjectId
import context
from . import context


class Queue(object):
Expand Down Expand Up @@ -125,7 +125,9 @@ def list_job_ids(self, skip=0, limit=20):
skip + limit - 1))
# SET
elif self.is_set:
return self.unserialize_job_ids(context.connections.redis.srandmember(self.redis_key, limit))
return self.unserialize_job_ids(
context.connections.redis.srandmember(self.redis_key, limit)
)
# LIST
else:
return self.unserialize_job_ids(context.connections.redis.lrange(
Expand Down
2 changes: 1 addition & 1 deletion mrq/redishelpers.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from .utils import memoize
import context
from . import context


@memoize
Expand Down

0 comments on commit 6f49353

Please sign in to comment.