Wait for the new RDS Parameter Group to become 'in-sync'
762591
def wait_for_new_parameter_group
      old_name = @original_server.db_parameter_groups.first['DBParameterGroupName']
      update_status "Applying parameter group #{old_name} to #{@new_instance.id}"
      job = self  # save local var for closure in wait_for, below
      @new_instance.wait_for {
        new_group = (db_parameter_groups.select do |group|
          group['DBParameterGroupName'] == old_name
        end).first
        status = (new_group ? new_group['ParameterApplyStatus'] : 'Unknown')
        if (status == "pending-reboot")
          job.update_status "Rebooting RDS #{id} to apply ParameterGroup #{old_name}"
          reboot and wait_for { ready? }
        end
        status == 'in-sync' && ready?
      }
    end
816712
def create_tmp_rds_from_snapshot
      unless @new_instance
        update_status "Waiting for snapshot #{@snapshot_id}"
        @snapshot.wait_for { ready? }
        update_status "Booting new RDS #{@new_rds_id} from snapshot #{@snapshot.id}"
        @rds.restore_db_instance_from_db_snapshot(@snapshot.id,
          @new_rds_id, 'DBInstanceClass' => @original_server.flavor_id)
        @new_instance = @rds.servers.get @new_rds_id
      end
    end
1365528
def wait(*args, **kwargs):
    
    kwargs.setdefault('sleep_seconds', (1, None))
    kwargs.setdefault('expected_exceptions', WebDriverException)
    kwargs.setdefault('timeout_seconds', webium.settings.wait_timeout)

    return wait_lib(*args, **kwargs)
1362324
public void waitForDeployments(@Observes(precedence = -100) AfterStart event, OpenShiftAdapter client,
        CEEnvironmentProcessor.TemplateDetails details, TestClass testClass, CubeOpenShiftConfiguration configuration, OpenShiftClient openshiftClient)
        throws Exception {
        if (testClass == null) {
            // nothing to do, since we're not in ClassScoped context
            return;
        }
        if (details == null) {
            log.warning(String.format("No environment for %s", testClass.getName()));
            return;
        }
        log.info(String.format("Waiting for environment for %s", testClass.getName()));
        try {
            delay(client, details.getResources());
        } catch (Throwable t) {
            throw new IllegalArgumentException("Error waiting for template resources to deploy: " + testClass.getName(), t);
        }
    }
433702
void waitProposedEpochFromQuorum()
      throws InterruptedException, TimeoutException, IOException {
    ClusterConfiguration currentConfig = persistence.getLastSeenConfig();
    long acknowledgedEpoch = persistence.getAckEpoch();
    // Waits PROPOED_EPOCH from a quorum of peers in current configuraion.
    while (this.quorumMap.size() < getQuorumSize() - 1) {
      MessageTuple tuple = filter.getExpectedMessage(MessageType.PROPOSED_EPOCH,
                                                     null,
                                                     config.getTimeoutMs());
      Message msg = tuple.getMessage();
      String source = tuple.getServerId();
      ZabMessage.ProposedEpoch epoch = msg.getProposedEpoch();
      ClusterConfiguration peerConfig =
        ClusterConfiguration.fromProto(epoch.getConfig(), source);
      long peerProposedEpoch = epoch.getProposedEpoch();
      long peerAckedEpoch = epoch.getCurrentEpoch();
      int syncTimeoutMs = epoch.getSyncTimeout();
      Zxid peerVersion = peerConfig.getVersion();
      Zxid selfVersion = currentConfig.getVersion();
      // If the peer's config version doesn't match leader's config version,
      // we'll check if the peer has the more likely "correct" configuration.
      if (!peerVersion.equals(selfVersion)) {
        LOG.debug("{}'s config version {} is different with leader's {}",
                  peerVersion, selfVersion);
        if (peerAckedEpoch > acknowledgedEpoch ||
            (peerAckedEpoch == acknowledgedEpoch &&
             peerVersion.compareTo(selfVersion) > 0)) {
          LOG.debug("{} probably has right configuration, go back to "
              + "leader election.",
              source);
          // TODO : current we just go back to leader election, probably we want
          // to select the peer as leader.
          throw new BackToElectionException();
        }
      }
      // Rejects peer who is not in the current configuration.
      if (!currentConfig.contains(source)) {
        LOG.debug("Current configuration doesn't contain {}, ignores it.",
                  source);
        continue;
      }
      if (this.quorumMap.containsKey(source)) {
        throw new RuntimeException("Quorum set has already contained "
            + source + ", probably a bug?");
      }
      LOG.debug("Got PROPOSED_EPOCH from {}", source);
      PeerHandler ph = new PeerHandler(source, transport,
                                       config.getTimeoutMs()/3);
      ph.setLastProposedEpoch(peerProposedEpoch);
      ph.setSyncTimeoutMs(syncTimeoutMs);
      this.quorumMap.put(source, ph);
    }
    LOG.debug("Got proposed epoch from a quorum.");
  }
199906
private void syncContext(boolean isInit)
    {
    	// jmeter context synchronisation
    	JMeterContext current = JMeterContextService.getContext();
		JMeterContext ctx = this.getThreadContext();
		
		if (isInit)
		{
			current.setCurrentSampler(ctx.getCurrentSampler());
			current.setEngine(ctx.getEngine());
			current.setRestartNextLoop(ctx.isRestartNextLoop());
			current.setSamplingStarted(ctx.isSamplingStarted());
			current.setThread(ctx.getThread());
			current.setThreadGroup(ctx.getThreadGroup());
			current.setThreadNum(ctx.getThreadNum());
		}
		current.setVariables(ctx.getVariables());
		current.setPreviousResult(ctx.getPreviousResult());
		//current.getSamplerContext().putAll(ctx.getSamplerContext());
    }
703061
function sync() {
    syncDom.setAttribute('data-sync-state', 'syncing');
    var opts = {continuous: true, complete: syncError};
    db.replicate.to(remoteCouch, opts);
    db.replicate.from(remoteCouch, opts);
  }
609104
private void refreshDeploymentParameter(DbConn cnx)
    {
        List<DeploymentParameter> prms = DeploymentParameter.select(cnx, "dp_select_by_id", this.dpId);
        if (prms.size() != 1)
        {
            this.stop();
            return;
        }

        DeploymentParameter p = prms.get(0);
        if (p.getPollingInterval() != this.pollingInterval || (p.getEnabled() && this.maxNbThread != p.getNbThread())
                || (this.maxNbThread > 0 && !p.getEnabled()) || (this.maxNbThread == 0 && p.getEnabled()))
        {
            applyDeploymentParameter(p);
        }

        this.strictPollingPeriod = Boolean.parseBoolean(GlobalParameter.getParameter(cnx, "strictPollingPeriod", "false"));
    }
194011
def until_not_synced(self, timeout=None):
        """"""
        yield until_any(*[r.until_not_synced() for r in dict.values(self.children)],
                        timeout=timeout)
691495
def create_disconnected_rds(new_rds_name = nil)
      @new_rds_id = new_rds_name if new_rds_name
      prepare_backup unless @original_server  # in case run as a convenience method
      snapshot_original_rds
      create_tmp_rds_from_snapshot
      configure_tmp_rds
      wait_for_new_security_group
      wait_for_new_parameter_group # (reboots as needed)
      destroy_snapshot
    end
902581
def _sync_hooks(self, repos, asynchronous=True):
        """"""
        if not asynchronous:
            for repo_id in repos:
                try:
                    with db.session.begin_nested():
                        self.sync_repo_hook(repo_id)
                    db.session.commit()
                except RepositoryAccessError as e:
                    current_app.logger.warning(e.message, exc_info=True)
                except NoResultFound:
                    pass  # Repository not in DB yet
        else:
            # FIXME: We have to commit, in order to have all necessary data?
            db.session.commit()
            sync_hooks.delay(self.user_id, repos)
368794
def wait
      perform_operation do |redis|
        redis.blpop(wait_key, MAX_OP_WAIT_TIME - 3)
        redis.del(wait_key)
      end
    end
1157847
def wait_to_start(self, pids=[]):
        '''
        

        '''
        actual_pids = self._get_pids(pids)
        return self.wait_for(pids=actual_pids, status_list=process_result_statuses+['in_process'])
1020850
def wait_for_running(self):
        """"""
        self.server_attrs = self.consul.find_running(
                self.server_attrs,
                self.launch_timeout_s,
                )
780259
def configure_tmp_rds
      update_status "Waiting for instance #{@new_instance.id}..."
      @new_instance.wait_for { ready? }
      update_status "Modifying RDS attributes for new RDS #{@new_instance.id}"
      @rds.modify_db_instance(@new_instance.id, true, {
        'DBParameterGroupName'  => @original_server.db_parameter_groups.
                                    first['DBParameterGroupName'],
        'DBSecurityGroups'      => [ @config['rds_security_group'] ],
        'MasterUserPassword'    => @new_password,
      })
    end
858642
def _meta_get_resource_sync(md_uuid):
    """"""
    isogeo.resource(id_resource=md_uuid)

    elapsed = default_timer() - START_TIME
    time_completed_at = "{:5.2f}s".format(elapsed)
    print("{0:<30} {1:>20}".format(md_uuid, time_completed_at))

    return
1315793
def wait(self):
        '''
        
        '''
        @param_to_property(action=["idle", "update"])
        def _wait(action, timeout=1000, package_name=None):
            if timeout / 1000 + 5 > int(os.environ.get("JSONRPC_TIMEOUT", 90)):
                http_timeout = timeout / 1000 + 5
            else:
                http_timeout = int(os.environ.get("JSONRPC_TIMEOUT", 90))
            if action == "idle":
                return self.server.jsonrpc_wrap(timeout=http_timeout).waitForIdle(timeout)
            elif action == "update":
                return self.server.jsonrpc_wrap(timeout=http_timeout).waitForWindowUpdate(package_name, timeout)
        return _wait