The method for sending BackupInstanceFaulty messages
        if backup primary disconnected
        :param degraded_backups: list of backup instances
        ids which performance were degraded
        :return:
969697
def on_backup_primary_disconnected(self, degraded_backups) -> None:
        '''
        
        '''
        self.__remove_replicas(degraded_backups,
                               Suspicions.BACKUP_PRIMARY_DISCONNECTED,
                               self.node.config.REPLICAS_REMOVING_WITH_PRIMARY_DISCONNECTED)
464171
public void onFailedUpgrade() {
        assert (this.state == ConnectionState.CONNECTING);
        ConnectionState event = null;
        synchronized (this) {
            this.state = ConnectionState.CLOSED;
            cleanClose = false;
            inputAvailable = false;
            outputAvailable = false;
            event = this.state;
        }
        notifyStateListeners(event);
    }
1259163
def need_rejoin(self):
        
        if not self._subscription.partitions_auto_assigned():
            return False

        if self._auto_assign_all_partitions():
            return False

        # we need to rejoin if we performed the assignment and metadata has changed
        if (self._assignment_snapshot is not None
            and self._assignment_snapshot != self._metadata_snapshot):
            return True

        # we need to join if our subscription has changed since the last join
        if (self._joined_subscription is not None
            and self._joined_subscription != self._subscription.subscription):
            return True

        return super(ConsumerCoordinator, self).need_rejoin()
692778
def __audit_connections(self, ccallbacks):
        """"""

        while self.__quit_ev.is_set() is False:
            # Remove any connections that are dead.
            self.__connections = filter(
                                    lambda (n, c, g): not g.ready(), 
                                    self.__connections)

            connected_node_couplets_s = set([
                (c.managed_connection.context, node)
                for (node, c, g) 
                in self.__connections])

            # Warn if there are any still-active connections that are no longer 
            # being advertised (probably where we were given some lookup servers 
            # that have dropped this particular *nsqd* server).

            lingering_nodes_s = connected_node_couplets_s - \
                                self.__node_couplets_s

            if lingering_nodes_s:
                _logger.warning("Server(s) are connected but no longer "
                                "advertised: %s", lingering_nodes_s)

            # Connect any servers that don't currently have a connection.

            unused_nodes_s = self.__node_couplets_s - connected_node_couplets_s

            for (context, node) in unused_nodes_s:
                _logger.info("Trying to connect unconnected server: "
                             "CONTEXT=[%s] NODE=[%s]", context, node)

                self.__start_connection(context, node, ccallbacks)
            else:
                # Are there both no unused servers and no connected servers?
                if not connected_node_couplets_s:
                    _logger.error("All servers have gone away. Stopping "
                                  "client.")

                    # Clear our list of servers, and squash the "no servers!" 
                    # error so that we can shut things down in the right order.

                    try:
                        self.set_servers([])
                    except EnvironmentError:
                        pass

                    self.__quit_ev.set()
                    return

            interval_s = \
                nsq.config.client.GRANULAR_CONNECTION_AUDIT_SLEEP_STEP_TIME_S

            audit_wait_s = float(nsq.config.client.CONNECTION_AUDIT_WAIT_S)

            while audit_wait_s > 0 and\
                  self.__quit_ev.is_set() is False:
                gevent.sleep(interval_s)
                audit_wait_s -= interval_s
7836
public void setBackups(java.util.Collection<Backup> backups) {
        if (backups == null) {
            this.backups = null;
            return;
        }

        this.backups = new java.util.ArrayList<Backup>(backups);
    }
107009
private boolean checkVmIsStarted() {

		DescribeInstancesRequest dis = new DescribeInstancesRequest();
		dis.setInstanceIds(Collections.singletonList(this.machineId));

		DescribeInstancesResult disresult = this.ec2Api.describeInstances( dis );
		// Obtain availability zone (for later use, eg. volume attachment).
		// Necessary if no availability zone is specified in configuration
		// (because volumes must be attached to instances in the same availability zone).
		this.availabilityZone = disresult.getReservations().get(0).getInstances().get(0).getPlacement().getAvailabilityZone();
		return "running".equalsIgnoreCase( disresult.getReservations().get(0).getInstances().get(0).getState().getName());
	}
127757
def handle_delete_propagation
      if replicable.tracking_deleted && has_deleted_ids?
        RailsRedshiftReplicator.logger.info propagation_message(:propagating_deletes)
        delete_on_target ? purge_deleted : RailsRedshiftReplicator.logger.error(propagation_message(:delete_propagation_error))
      end
    end
1167659
def _remove_old_snapshots(connection, volume):
    
    if 'AutomatedEBSSnapshotsRetention' not in volume.tags:
        logger.warning(
            'Missing tag AutomatedEBSSnapshotsRetention for volume {}'.format(
                volume.id))
        return
    retention = int(volume.tags['AutomatedEBSSnapshotsRetention'])

    snapshots = connection.get_all_snapshots(filters={'volume-id': volume.id})

    # Sort the list based on the start time
    snapshots.sort(key=lambda x: x.start_time)

    # Remove snapshots we want to keep
    snapshots = snapshots[:-int(retention)]

    if not snapshots:
        logger.info('No old snapshots to remove')
        return

    for snapshot in snapshots:
        logger.info('Deleting snapshot {}'.format(snapshot.id))
        try:
            snapshot.delete()
        except EC2ResponseError as error:
            logger.warning('Could not remove snapshot: {}'.format(
                error.message))

    logger.info('Done deleting snapshots')
1333248
def restore_instances(self, instances):
        
        instances = instances.encode()

        if os.path.exists(instances):
            ret = lib.EnvRestoreInstances(self._env, instances)
            if ret == -1:
                raise CLIPSError(self._env)
        else:
            ret = lib.EnvRestoreInstancesFromString(self._env, instances, -1)
            if ret == -1:
                raise CLIPSError(self._env)

        return ret
736613
def _default
        given_defaults = (respond_to?(:default, true) && default) || {}
        if MandrillBatchMailer.intercept_recipients
          given_defaults[:message].try(:delete, :to)
        end
        given_defaults
      end
1071983
def restore_replicas(self) -> None:
        '''
        
        '''
        self.backup_instances_faulty.clear()
        for inst_id in range(self.node.requiredNumberOfInstances):
            if inst_id not in self.node.replicas.keys():
                self.node.replicas.add_replica(inst_id)
241028
def _reinit_daq_daemons(sender, instance, **kwargs):
    
    if type(instance) is Device:
        try:
            bp = BackgroundProcess.objects.get(pk=instance.protocol_id)
        except:
            return False
        bp.restart()
    elif type(instance) is Variable:
        try:
            bp = BackgroundProcess.objects.get(pk=instance.device.protocol_id)
        except:
            return False
        bp.restart()
    elif type(instance) is Scaling:
        for bp_pk in list(instance.variable_set.all().values_list('device__protocol_id').distinct()):
            try:
                bp = BackgroundProcess.objects.get(pk=bp_pk)
            except:
                return False
            bp.restart()
    else:
        logger.debug('post_save from %s' % type(instance))
797242
def list(self, instance=None, limit=20, marker=0):
        
        if instance is None:
            return super(CloudDatabaseBackupManager, self).list()
        return self.api._manager._list_backups_for_instance(instance, limit=limit,
                                                            marker=marker)
433407
def reboot_instances(self, instance_ids=None):
        
        params = {}
        if instance_ids:
            self.build_list_params(params, instance_ids, 'InstanceId')
        return self.get_status('RebootInstances', params)
602028
def _degrade(self, degrade, msg, *args):
        
        self._rotateFailed = degrade
        del msg, args
154745
def sendToReplica(self, msg, frm):
        
        # TODO: discard or stash messages here instead of doing
        # this in msgHas* methods!!!
        if self.msgHasAcceptableInstId(msg, frm):
            self.replicas.pass_message((msg, frm), msg.instId)
607932
def report_dead_hosting_devices(self, context, hd_ids=None):
        
        cctxt = self.client.prepare()
        cctxt.cast(context, 'report_non_responding_hosting_devices',
                   host=self.host, hosting_device_ids=hd_ids)