watch is now cmd line arg
Signed-off-by: Marc 'risson' Schmitt <marc.schmitt@risson.space>
This commit is contained in:
@ -87,7 +87,6 @@ class Conf:
|
|||||||
def worker(self) -> dict[str, Any]:
|
def worker(self) -> dict[str, Any]:
|
||||||
return {
|
return {
|
||||||
"use_gevent": False,
|
"use_gevent": False,
|
||||||
"watch": settings.DEBUG,
|
|
||||||
"watch_use_polling": False,
|
"watch_use_polling": False,
|
||||||
"processes": None,
|
"processes": None,
|
||||||
"threads": None,
|
"threads": None,
|
||||||
|
@ -19,17 +19,25 @@ class Command(BaseCommand):
|
|||||||
dest="pid_file",
|
dest="pid_file",
|
||||||
help="PID file",
|
help="PID file",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--watch",
|
||||||
|
action="store_true",
|
||||||
|
default=False,
|
||||||
|
dest="watch",
|
||||||
|
help="Watch for file changes",
|
||||||
|
)
|
||||||
|
|
||||||
def handle(
|
def handle(
|
||||||
self,
|
self,
|
||||||
pid_file,
|
pid_file,
|
||||||
|
watch,
|
||||||
verbosity,
|
verbosity,
|
||||||
**options,
|
**options,
|
||||||
):
|
):
|
||||||
worker = Conf().worker
|
worker = Conf().worker
|
||||||
executable_name = "dramatiq-gevent" if worker["use_gevent"] else "dramatiq"
|
executable_name = "dramatiq-gevent" if worker["use_gevent"] else "dramatiq"
|
||||||
executable_path = self._resolve_executable(executable_name)
|
executable_path = self._resolve_executable(executable_name)
|
||||||
watch_args = ["--watch", "."] if worker["watch"] else []
|
watch_args = ["--watch", "."] if watch else []
|
||||||
if watch_args and worker["watch_use_polling"]:
|
if watch_args and worker["watch_use_polling"]:
|
||||||
watch_args.append("--watch-use-polling")
|
watch_args.append("--watch-use-polling")
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user