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 remaining CLI args for flask rq worker. #122

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
6 changes: 4 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
# serve to show the default.
import sys
import os
from pkg_resources import get_distribution
# from pkg_resources import get_distribution
from importlib.metadata import version


import sphinx_readable_theme

Expand Down Expand Up @@ -59,7 +61,7 @@
# built documents.
#
# The full version, including alpha/beta/rc tags.
release = get_distribution('Flask-RQ2').version
release = version('Flask-RQ2')
# The short X.Y version.
version = '.'.join(release.split('.')[:2])

Expand Down
6 changes: 4 additions & 2 deletions src/flask_rq2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@
:copyright: (c) 2016 by Jannis Leidel.
:license: MIT, see LICENSE for more details.
"""
from pkg_resources import get_distribution, DistributionNotFound
# from pkg_resources import get_distribution, DistributionNotFound
from importlib.metadata import version

from .app import RQ # noqa

__author__ = 'Jannis Leidel'

try:
__version__ = get_distribution(__name__).version
# __version__ = get_distribution(__name__).version
__version__ = version(__name__)
except DistributionNotFound:
# package is not installed
pass
10 changes: 10 additions & 0 deletions src/flask_rq2/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,17 @@ def info(rq, ctx, path, interval, raw, only_queues, only_workers, by_queue,
@click.option('--pid',
help='Write the process ID number to a file at '
'the specified path')
@click.option('--disable-default-exception-handler', '-d', is_flag=True,
help='Disable RQ\'s default exception handler')
@click.option('--max-jobs', type=int, default=None,
help='Maximum number of jobs to execute')
@click.option('--with-scheduler', '-s', is_flag=True,
help='Run worker with scheduler')
@click.argument('queues', nargs=-1)
@rq_command()
def worker(rq, ctx, burst, logging_level, name, path, results_ttl,
worker_ttl, verbose, quiet, sentry_dsn, exception_handler, pid,
disable_default_exception_handler, max_jobs, with_scheduler,
queues):
"Starts an RQ worker."
ctx.invoke(
Expand All @@ -150,6 +157,9 @@ def worker(rq, ctx, burst, logging_level, name, path, results_ttl,
sentry_dsn=sentry_dsn,
exception_handler=exception_handler or rq._exception_handlers,
pid=pid,
disable_default_exception_handler=disable_default_exception_handler,
max_jobs=max_jobs,
with_scheduler=with_scheduler,
queues=queues or rq.queues,
**shared_options(rq)
)
Expand Down