Skip to content

5.2 The task registry

The AWS deep collector · From docs/INVENTORY_INTERNALS.md on GitHub

collect() runs every task returned by _service_tasks() concurrently, each wrapped by _run_service_collector(name, coroutine) which records a ServiceCoverage entry (SUCCESS with the asset count, or FAILED with the error) and turns a failure into an empty list. One failing service never stops the others.

_service_tasks() is built lazily, so excluded tasks never create coroutines:

  1. AsyncAWSCollector._service_tasks(): the base tasks (ec2, s3, rds, vpc, subnets, security_groups, iam_users, iam_roles, lambda, elbv2, ecs, dynamodb, cloudfront, secretsmanager, kms), each a bound _collect_* method. Mixins override most of them with deeper implementations of the same name.
  2. iam_users and iam_roles are dropped: _collect_iam maps the whole IAM graph in one task.
  3. DEEP_TASK_METHODS adds the network fabric and the original deep tasks (route_tables, internet_gateways, …, cloudtrail) by method name.
  4. _merge_registries() adds the registries of the newer mixin packages. Each registry is a method returning {task_name: (callable, family, is_global)}: _governance_tasks(), _network_ext_tasks(), _application_tasks(), _data_ml_tasks(), _cloudcontrol_tasks(). The family is registered in SERVICE_FAMILIES (without overwriting an existing entry) and global tasks are added to the global set.
  5. tagging_sweep is added when enabled.
  6. Outside the primary region every global task is removed (GLOBAL_TASKS plus registry tasks with is_global=True).
  7. select_tasks(names, services, exclude_services) filters by task name or family. kubernetes is a pseudo-family: including it keeps the eks task.