diff --git a/rq/__init__.py b/rq/__init__.py index 3f9fa3c..64a5f35 100644 --- a/rq/__init__.py +++ b/rq/__init__.py @@ -4,10 +4,11 @@ from .queue import Queue from .worker import Worker from .version import VERSION + def use_redis(redis=None): """Pushes the given Redis connection (a redis.Redis instance) onto the - connection stack. This is merely a helper function to easily start using RQ - without having to know or understand the RQ connection stack. + connection stack. This is merely a helper function to easily start + using RQ without having to know or understand the RQ connection stack. When given None as an argument, a (default) Redis connection to redis://localhost:6379 is set up. diff --git a/rq/job.py b/rq/job.py index c82a197..6b52645 100644 --- a/rq/job.py +++ b/rq/job.py @@ -73,7 +73,7 @@ class Job(object): # Data access - def get_id(self): + def get_id(self): # noqa """The job ID for this job instance. Generates an ID lazily the first time the ID is requested. """ @@ -93,27 +93,28 @@ class Job(object): return 'rq:job:%s' % (self.id,) - @property + @property # noqa def job_tuple(self): - """Returns the job tuple that encodes the actual function call that this job represents.""" + """Returns the job tuple that encodes the actual function call that + this job represents.""" return (self.func, self.args, self.kwargs) @property def return_value(self): """Returns the return value of the job. - Initially, right after enqueueing a job, the return value will be None. - But when the job has been executed, and had a return value or exception, - this will return that value or exception. + Initially, right after enqueueing a job, the return value will be + None. But when the job has been executed, and had a return value or + exception, this will return that value or exception. Note that, when the job has no return value (i.e. returns None), the ReadOnlyJob object is useless, as the result won't be written back to Redis. - Also note that you cannot draw the conclusion that a job has _not_ been - executed when its return value is None, since return values written back - to Redis will expire after a given amount of time (500 seconds by - default). + Also note that you cannot draw the conclusion that a job has _not_ + been executed when its return value is None, since return values + written back to Redis will expire after a given amount of time (500 + seconds by default). """ if self._cached_result is None: rv = conn.hget(self.key, 'result') @@ -124,7 +125,7 @@ class Job(object): # Persistence - def refresh(self): + def refresh(self): # noqa """Overwrite the current instance's properties with the values in the corresponding Redis key. @@ -180,14 +181,14 @@ class Job(object): # Job execution - def perform(self): + def perform(self): # noqa """Invokes the job function with the job arguments. """ return self.func(*self.args, **self.kwargs) # Representation - def get_call_string(self): + def get_call_string(self): # noqa """Returns a string representation of the call, formatted as a regular Python function invocation statement. """ @@ -204,9 +205,8 @@ class Job(object): # Job equality - def __eq__(self, other): + def __eq__(self, other): # noqa return self.id == other.id def __hash__(self): return hash(self.id) -