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

Improve docs #74

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 67 additions & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,80 @@ Commands
~~~~~~~~

There isn't an official overview of CLI commands in the RQ documentation,
but these are the commands that Flask-RQ2 support.
but these are the commands that Flask-RQ2 support::

export FLASK_APP='app.py'


Setup the `cli.py`


.. code-block:: python

from .rq import rq

def register(app):
rq.init_cli(app)

# anothers cli commands...
@app.cli.command()
@click.argument('name')
def create_user(name):
'''This commands create an user'''
print('create')


In your `app.py` call the create factory above


.. code-block:: python

#...

# Apps
from apps import create_app, cli

# ...
app = create_app(getenv('FLASK_ENV'))
cli.register(app)

if __name__ == '__main__':
app.run(host=ip, debug=debug, port=port, use_reloader=debug)


Then show the helps::

flask rq


- ``worker`` -- Starts an `RQ worker`_ (required to run jobs)::

flask run worker

- ``worker`` -- Starts an `RQ worker`_ (required to run jobs).

- ``scheduler`` -- Starts an `RQ Scheduler`_ (optional for scheduled jobs).

- ``info`` -- Shows an `RQ command-line monitor`_.

- ``empty`` -- Empty the given `RQ queues`_.

- ``requeue`` -- Requeues `failed jobs`_.
- ``requeue`` -- Requeues `failed jobs`_

Parameters::

--all or -a Requeue all failed jobs


Run the command to execute all jobs::

$ flask rq requeue --all
Requeueing 1 jobs from failed queue


Or you can run a list of job ids::

$ flask rq requeue bb43879f-b0e2-4bf0-b6c5-4debf925180e cba947e8-5a95-45a5-b63d-2857799006e8


- ``suspend`` -- Suspends all workers.

Expand Down Expand Up @@ -255,7 +318,7 @@ The default queues that the worker and CLI commands (``empty``, ``info`` and

.. code-block:: python

app.config['RQ_QUEUES'] = ['default']
app.config['RQ_QUEUES'] = ['default', 'failed']

``RQ_ASYNC``
~~~~~~~~~~~~
Expand Down
4 changes: 4 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ test = pytest

[bdist_wheel]
universal = 1

[flake8]
ignore = W605
exclude = docs/*