We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 07674a1 + 4b15d5b commit 356827bCopy full SHA for 356827b
django_rq/management/commands/rqworker.py
@@ -1,3 +1,4 @@
1
+import os
2
import importlib
3
import logging
4
from optparse import make_option
@@ -69,10 +70,23 @@ class Command(BaseCommand):
69
70
default=420,
71
help='Default worker timeout to be used'
72
),
73
+ make_option(
74
+ '--pid',
75
+ action='store',
76
+ dest='pid',
77
+ default=None,
78
+ help='PID file to write the worker`s pid into'
79
+ ),
80
)
81
args = '<queue queue ...>'
82
83
def handle(self, *args, **options):
84
+
85
+ pid = options.get('pid')
86
+ if pid:
87
+ with open(os.path.expanduser(pid), "w") as fp:
88
+ fp.write(str(os.getpid()))
89
90
try:
91
# Instantiate a worker
92
worker_class = import_attribute(options.get('worker_class', 'rq.Worker'))
0 commit comments