Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CLI rq to empty queues and requeue failed jobs #401

Merged
merged 26 commits into from Sep 6, 2014

Conversation

zhangliyong
Copy link
Contributor

Usage: rq [OPTIONS] COMMAND [ARGS]...

Options:
  -u, --url TEXT  URL describing Redis connection details.
  --help          Show this message and exit.

Commands:
  empty    Empty queues, default: empty failed queue $...
  requeue  Requeue all failed jobs in failed queue

e.g.

$ rq empty
2 jobs removed from failed queue

$ rq -u 'redis://localhost:6379/0' empty default high
10 jobs removed from default queue
2 jobs removed from high queue

$ rq requeue
Requeuing 4 failed jobs......
Requeue over with 0 jobs requeuing failed

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 7f3cb8e on zhangliyong:cli-rq into 2409e81 on nvie:master.

@zhangliyong
Copy link
Contributor Author

Now I have not add rq console_scripts in setup.py, so you can use pyfuncrun to run rq function, or you have a better way : )

e.g.

$ pyfuncrun rq.scripts.rq.rq --help
$ pyfuncrun rq.scripts.rq.rq empty

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.15%) when pulling e1d236e on zhangliyong:cli-rq into 2409e81 on nvie:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+1.94%) when pulling 36880db on zhangliyong:cli-rq into 2409e81 on nvie:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+1.94%) when pulling e948bde on zhangliyong:cli-rq into 2409e81 on nvie:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+1.94%) when pulling 551483b on zhangliyong:cli-rq into 2409e81 on nvie:master.

if url is None:
url = "redis://localhost:6379/0"
redis_conn = redis.from_url(url)
use_connection(redis_conn)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's avoid using use_connection when possible. Instead, we should instantiate queues directly using Redis connections.

@coveralls
Copy link

Coverage Status

Coverage increased (+1.94%) when pulling 1e5a8b5 on zhangliyong:cli-rq into 2409e81 on nvie:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+2.39%) when pulling 1ab9260 on zhangliyong:cli-rq into 2409e81 on nvie:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.45%) when pulling bc8fe29 on zhangliyong:cli-rq into 5331dc4 on nvie:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.63%) when pulling 1c97a55 on zhangliyong:cli-rq into 5331dc4 on nvie:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+0.63%) when pulling 1c97a55 on zhangliyong:cli-rq into 5331dc4 on nvie:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.45%) when pulling 37748e5 on zhangliyong:cli-rq into 5331dc4 on nvie:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.63%) when pulling 0ddd174 on zhangliyong:cli-rq into 5331dc4 on nvie:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage increased (+0.63%) when pulling 0ddd174 on zhangliyong:cli-rq into 5331dc4 on nvie:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.63%) when pulling 5883bb9 on zhangliyong:cli-rq into 2e6f86d on nvie:master.

from rq import get_failed_queue, Queue, Worker
from rq.scripts import (add_standard_arguments, read_config_file,
setup_default_arguments, setup_redis)
from rq.utils import gettermsize, make_colorizer
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may remove these helper functions from rq.utils since they aren't used anymore.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.63%) when pulling ae1681e on zhangliyong:cli-rq into 2e6f86d on nvie:master.

@@ -17,7 +17,7 @@ def get_version():


def get_dependencies():
deps = ['redis >= 2.7.0']
deps = ['redis >= 2.7.0', 'click > 3.0']
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

>= ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes >=, my careless :)

@nvie
Copy link
Collaborator

nvie commented Sep 1, 2014

I gotta agree with @selwin that this is looking great :)

@selwin selwin mentioned this pull request Sep 1, 2014
@coveralls
Copy link

Coverage Status

Coverage increased (+2.22%) when pulling 3eabe76 on zhangliyong:cli-rq into 2e6f86d on nvie:master.

@zhangliyong
Copy link
Contributor Author

@selwin @nvie Fix these issues, and move back rqinfo command, it has the same interface as before, and rq worker command is on my way. please review when you have time, thanks :)

@zhangliyong
Copy link
Contributor Author

remind to review when you have time :)

@selwin
Copy link
Collaborator

selwin commented Sep 6, 2014

Will try to review soon. Sorry for the wait!

@nvie
Copy link
Collaborator

nvie commented Sep 6, 2014

This PR was great! I changed some subtle things, mostly style fixes, and command descriptions, to be a little more Unix-y, and made sure the default invocation does not do anything implicitly (so people are encouraged to check the --help, instead of implicitly having done damage). Most notable change was a small rehaul of the rq empty command, see 07dda74.

Thanks a lot!

I'm looking forward to see the rqworker command be moved under this umbrella, too.

@nvie nvie merged commit 3eabe76 into rq:master Sep 6, 2014
@zhangliyong
Copy link
Contributor Author

@nvie yes, it's much conciser, thanks! I will add rq worker command soon.

@nvie
Copy link
Collaborator

nvie commented Sep 6, 2014

I'm currently restructuring the new CLI code a bit, will commit in a sec.

@selwin
Copy link
Collaborator

selwin commented Sep 6, 2014

@nvie can you take a quick look at #391 when you're free? Just want to make sure I don't do anything too stupid fundamentally and I'll take care of the polishing myself later on ;)

@nvie
Copy link
Collaborator

nvie commented Sep 6, 2014

Here's my change: b5fbc39.

@zhangliyong
Copy link
Contributor Author

@nvie OK, I'll review it, and add rqworker based on this.

@zhangliyong zhangliyong deleted the cli-rq branch September 19, 2014 06:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants