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

Configurable and parallel gather facts #49399

Merged
merged 29 commits into from Mar 8, 2019
Merged

Conversation

bcoca
Copy link
Member

@bcoca bcoca commented Dec 1, 2018

Use a configurable list of multiple facts modules in parallel for fact gathering stage.

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

gather_facts

@ansibot
Copy link
Contributor

ansibot commented Dec 1, 2018

Hi @bcoca, thank you for submitting this pull-request!

click here for bot help

@ansibot ansibot added WIP This issue/PR is a work in progress. Nevertheless it was shared for getting input from peers. affects_2.8 This issue/PR affects Ansible v2.8 feature This issue/PR relates to a feature request. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. new_module This PR includes a new module. new_plugin This PR includes a new plugin. support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Dec 1, 2018
@ansible ansible deleted a comment from ansibot Dec 1, 2018
@bcoca bcoca changed the title [WIP] Gather facts parallel Configurable and parallel gather facts Dec 1, 2018
@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed WIP This issue/PR is a work in progress. Nevertheless it was shared for getting input from peers. labels Dec 1, 2018
@bcoca bcoca removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Dec 3, 2018
@ansibot ansibot added the core_review In order to be merged, this PR must follow the core review workflow. label Dec 3, 2018
@sivel sivel removed needs_triage Needs a first human triage before being processed. labels Dec 4, 2018
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Dec 10, 2018
Copy link
Member

@nitzmahone nitzmahone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall process looks OK to me. Only big-picture question is if the async stuff is really worth it; unless a particular module is really slow, it adds a lot of moving parts and significant overhead (which may actually end up slower than serial direct execution in many cases).

Probably also needs explicit tests added to the Windows setup integration tests under win_setup; the async stuff will probably work as-written, but we need to make sure...

lib/ansible/plugins/action/gather_facts.py Outdated Show resolved Hide resolved
lib/ansible/plugins/action/gather_facts.py Outdated Show resolved Hide resolved
lib/ansible/plugins/action/gather_facts.py Outdated Show resolved Hide resolved
lib/ansible/plugins/action/gather_facts.py Outdated Show resolved Hide resolved
lib/ansible/plugins/action/gather_facts.py Outdated Show resolved Hide resolved
lib/ansible/plugins/action/gather_facts.py Show resolved Hide resolved
@ansibot ansibot added needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. and removed core_review In order to be merged, this PR must follow the core review workflow. labels Dec 10, 2018
@ansibot ansibot added needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI. and removed needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Dec 10, 2018
Copy link
Member

@nitzmahone nitzmahone left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's discuss whether the connection map should be exposed or not, otherwise LGTM

@@ -1324,6 +1324,30 @@ ERROR_ON_MISSING_HANDLER:
ini:
- {key: error_on_missing_handler, section: defaults}
type: boolean
CONNECTION_FACTS_MODULES:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good stopgap for networking until we have platform, but I assume this would be superseded by that. Do we want to expose it to env/ini knowing that we'll need to deprecate it whenever we get around to platform, or just keep it as an internal detail for stuff that's shipped in the box for now?

Copy link
Member Author

@bcoca bcoca Mar 6, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since we cannot supply 'maps' that way .. i chose not to .. at least until ansible.config.yml

I'm fine with deprecating this once platform is out, but i don't see it as either/or proposition.

we could create per transport config .. but that does not need to happen right now, I would wait for user feedback.

@sivel sivel dismissed their stale review March 6, 2019 16:32

Requested changes made, but have not re-reviewed at a higher level.

ios: ios_facts
iosxr: iosxr_facts
nxos: nxos_facts
vyos: vyos_facts
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bcoca Will you please add frr: frr_facts and junos: junos_facts as well?

Copy link
Member

@trishnaguha trishnaguha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bcoca Does this facts gathering enable us to import ansible_facts in modules like we currently have with collectors in module_utils/facts/compat.py?

This was referenced Mar 7, 2019
@bcoca
Copy link
Member Author

bcoca commented Mar 7, 2019

@trishnaguha i don't understand the question

@ansibot

This comment has been minimized.

@trishnaguha
Copy link
Member

trishnaguha commented Mar 8, 2019

@bcoca If we do from ansible.module_utils.facts import ansible_facts and call the ansible_facts(module) API in modules, the facts system runs the same collector for the specific platform and gets facts on runtime for each task/module run and return that to the module <Does NOT override ansible_facts var>. This enables fetching information from the devices for idempotence without having to implement that directly in the module.
REF: https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/facts/compat.py#L49

I was wondering if we have similar functionality here which would just execute the facts module whenever ansible_facts API is called and pass that to the module. So we don't have to maintain platform facts collector in module_utils/facts/ if someone wants to use ansible_facts API.

@bcoca
Copy link
Member Author

bcoca commented Mar 8, 2019

this is not touching the API, it just allows you to execute 1 or more facts modules

@bcoca bcoca merged commit 8940732 into ansible:devel Mar 8, 2019
@bcoca bcoca deleted the gather_facts_parallel branch March 8, 2019 18:08
@ansible ansible locked and limited conversation to collaborators Jul 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.8 This issue/PR affects Ansible v2.8 feature This issue/PR relates to a feature request. module This issue/PR relates to a module. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. new_module This PR includes a new module. new_plugin This PR includes a new plugin. support:community This issue/PR relates to code supported by the Ansible community. support:core This issue/PR relates to code supported by the Ansible Engineering Team. system System category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants