diff --git a/docs/conf.py b/docs/conf.py index a6445d0..c8e41f6 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -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 @@ -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]) diff --git a/src/flask_rq2/__init__.py b/src/flask_rq2/__init__.py index 367911d..30068a2 100644 --- a/src/flask_rq2/__init__.py +++ b/src/flask_rq2/__init__.py @@ -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 diff --git a/src/flask_rq2/cli.py b/src/flask_rq2/cli.py index ab5d2c3..08792a7 100644 --- a/src/flask_rq2/cli.py +++ b/src/flask_rq2/cli.py @@ -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( @@ -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) )