用芹菜运行线程模块;守护进程不允许有孩子

时间:2019-02-16 21:28:02

标签: python python-2.7 asynchronous queue celery

我在我的烧瓶应用程序中实现了一个带有芹菜的队列。一切正常。 但是我需要使用this module called sublist3r,当我在芹菜任务中使用它时,我会收到此错误:

[2019-02-16 21:32:52,658: INFO/ForkPoolWorker-6] Task tasks.task.addd[57793628-de25-4c89-a265-5fee69a8b2bf] succeeded in 0.0236732449848s: None
[2019-02-16 21:32:52,660: WARNING/ForkPoolWorker-6] Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/me/code/proj/tasks/task.py", line 15, in getd
    sub = sublist3r.main(url, 40, None, ports=None, silent=True,verbose=False, enable_bruteforce=False, engines=None)
  File "/home/me/code/proj/sublist3r/sublist3r.py", line 871, in main
    subdomains_queue = multiprocessing.Manager().list()
  File "/usr/lib/python2.7/multiprocessing/__init__.py", line 99, in Manager
    m.start()
  File "/usr/lib/python2.7/multiprocessing/managers.py", line 524, in start
    self._process.start()
  File "/usr/lib/python2.7/multiprocessing/process.py", line 124, in start
    'daemonic processes are not allowed to have children'
**AssertionError: daemonic processes are not allowed to have children**

这是因为我试图使用使用线程的模块而发生的吗? 如何在队列中或异步使用此模块?

谢谢

1 个答案:

答案 0 :(得分:1)

看来sublist3r使用多重处理并试图开始其自身的处理。您无法在celery中真正做到这一点,因为在生产中,celery已经在其自己的子进程中启动了一个工作人员,并且正如您从错误消息中可以看出的那样,celery不允许您调用sublist3r的多处理进程。用途。如果要使用它,最好的选择是自己重写sublist3r中的这些类,以从celery.Task而不是multiprocessing.Process派生。