def _converge_all(self, my_buckets, divergent_flags): """Run :func:`converge_all_groups` and log errors.""" eff = self._converge_all_groups( self.currently_converging, self.recently_converged, self.waiting, my_buckets, self._buckets, divergent_flags, self.build_timeout, self.interval, self.limited_retry_iterations, self.step_limits) return eff.on(error=lambda e: err(exc_info_to_failure(e), 'converge-all-groups-error'))
def _converge_all(self, my_buckets, divergent_flags): """Run :func:`converge_all_groups` and log errors.""" eff = self._converge_all_groups( self.currently_converging, self.recently_converged, self.waiting, my_buckets, self._buckets, divergent_flags, self.build_timeout, self.interval, self.limited_retry_iterations, self.step_limits) return eff.on( error=lambda e: err( exc_info_to_failure(e), 'converge-all-groups-error'))
def __init__(self, failure, msg, fields): # `failure` being `None` means "get the exception from context". # We can't wait until the intent is performed to do that, because the # exception context will be lost, so we explicitly instantiate a new # Failure here. if failure is None: failure = Failure() if type(failure) is tuple: failure = exc_info_to_failure(failure) self.failure = failure self.msg = msg self.fields = fields
def get_all_metrics_effects(tenanted_groups, log, _print=False): """ Gather server data for and produce metrics for all groups across all tenants in a region :param dict tenanted_groups: Scaling groups grouped with tenantId :param bool _print: Should the function print while processing? :return: ``list`` of :obj:`Effect` of (``list`` of :obj:`GroupMetrics`) or None """ effs = [] for tenant_id, groups in tenanted_groups.iteritems(): eff = get_all_scaling_group_servers() eff = Effect(TenantScope(eff, tenant_id)) eff = eff.on(partial(get_tenant_metrics, tenant_id, groups, _print=_print)) eff = eff.on(list) eff = eff.on( error=lambda exc_info: log.err(exc_info_to_failure(exc_info))) effs.append(eff) return effs
def log_and_raise(msg, exc_info): """ Log error and raise it """ eff = err(exc_info_to_failure(exc_info), msg) return eff.on(lambda _: six.reraise(*exc_info))