有一个任务可以执行其他100项任务,每0.5秒定期执行一次。
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020.
Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Requirement already satisfied: tzlocal in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (1.5.1)
Requirement already satisfied: pytz in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from tzlocal) (2017.2)
每个任务的执行时间为0.02秒。
但是,在日志中只能看到100到70到80个任务。为什么? 如何严格执行组中的所有任务?
工人:4名工人正在执行@task(queue="pages_checker")
def run_checker():
active_pages = Page.objects.filter(is_active=True)
g = group(page_check.s(page.id) for page in active_pages)
#g.apply_async(queue="page_checker")
g()
return active_pages.count()
@task(queue="page_checker")
def page_checker(page_id):
print("page"+str(page_id))#logging here
#some logic
,而14名工人正在执行run_checker
任务。
服务器:16gb RAM,8个具有超线程功能的vCPU。