def _matchAutostackInstances(task): """ Executed via multiprocessing Pool: Retrieve instances matching an autostack :param task: Descriptions of Autostack :type task: A three-tuple: (autostackID, region, filters,). See aggregator_instances.getAutostackInstances for description of `filters` :returns: a sequence of zero or more aggregator_instances.InstanceInfo objects matching the given task """ log = _getInstanceWorkerLogger() log.debug("_matchAutostackInstances: task=%r", task) autostackID, region, filters = task matchStartTime = time.time() instances = getAutostackInstances(regionName=region, filters=filters) log.info("Retrieved Autostack instances: autostack=%s; region=%s; " "filters=%s; numInstances=%d; duration=%ss", autostackID, region, filters, len(instances), time.time() - matchStartTime) return instances
def getMatchingResources(cls, aggSpec): """ Get the resources that match an aggregation specification. :param aggSpec: Autostack aggregation specification :type aggSpec: dict (see _AutostackDatasourceAdapter.createAutostack) :returns: sequence of matching resources """ return getAutostackInstances(regionName=aggSpec["region"], filters=aggSpec["filters"])