Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allocate more workers to parse module docs. #90

Merged
merged 1 commit into from
Jun 9, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions antsibull/docs_parsing/ansible_doc.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,19 @@ async def get_ansible_plugin_info(venv: Union['VenvRunner', 'FakeVenvRunner'],
# Why use THREAD_MAX instead of process max? Even though this ultimately invokes separate
# ansible-doc processes, the limiting factor is IO as ansible-doc reads from disk. So it makes
# sense to scale up to THREAD_MAX instead of PROCESS_MAX.
max_workers = int(THREAD_MAX / len(DOCUMENTABLE_PLUGINS))
if max_workers < 1:
max_workers = 1

# Allocate more for modules because the vast majority of plugins are modules
module_workers = max(int(.7 * THREAD_MAX), 1)
other_workers = int((THREAD_MAX - module_workers) / (len(DOCUMENTABLE_PLUGINS) - 1))
if other_workers < 1:
other_workers = 1

extractors = {}
for plugin_type in DOCUMENTABLE_PLUGINS:
if plugin_type == 'module':
max_workers = module_workers
else:
max_workers = other_workers
extractors[plugin_type] = asyncio.create_task(
_get_plugin_info(plugin_type, venv_ansible_doc, max_workers))

Expand Down