Handler to update a topology
340543
@VisibleForTesting
  void updateTopologyHandler(String topologyName, Config updateConfig)
      throws TopologyRuntimeManagementException, PackingException, UpdateDryRunResponse {
    assert !potentialStaleExecutionData;
    String newParallelism = updateConfig.getStringValue(RUNTIME_MANAGER_COMPONENT_PARALLELISM_KEY);
    String newContainerNumber = updateConfig.getStringValue(RUNTIME_MANAGER_CONTAINER_NUMBER_KEY);
    String userRuntimeConfig = updateConfig.getStringValue(RUNTIME_MANAGER_RUNTIME_CONFIG_KEY);
    LOG.info("userRuntimeConfig " + userRuntimeConfig
        + "; newParallelism " + newParallelism
        + "; newContainerNumber " + newContainerNumber);

    // parallelism and runtime config can not be updated at the same time.
    if (((newParallelism != null && !newParallelism.isEmpty())
        || (newContainerNumber != null && !newContainerNumber.isEmpty()))
        && userRuntimeConfig != null && !userRuntimeConfig.isEmpty()) {
      throw new TopologyRuntimeManagementException(
          "parallelism or container number "
              + "and runtime config can not be updated at the same time.");
    }
    if (userRuntimeConfig != null && !userRuntimeConfig.isEmpty()) {
      // Update user runtime config if userRuntimeConfig parameter is available
      updateTopologyUserRuntimeConfig(topologyName, userRuntimeConfig);
    } else if (newContainerNumber != null && !newContainerNumber.isEmpty()) {
      // Update container count if newContainerNumber parameter is available
      updateTopologyContainerCount(topologyName, newContainerNumber, newParallelism);
    } else if (newParallelism != null && !newParallelism.isEmpty()) {
      // Update parallelism if newParallelism parameter is available
      updateTopologyComponentParallelism(topologyName, newParallelism);
    } else {
      throw new TopologyRuntimeManagementException("Missing arguments. Not taking action.");
    }
    // Clean the connection when we are done.
    LOG.fine("Scheduler updated topology successfully.");
  }
1038418
def _updateEndpoints(self,*args,**kwargs):
        

        sender = self.sender()
        if not self.ignoreEvents:
            self.ignoreEvents = True

            for binding in self.bindings.values():
                if binding.instanceId == id(sender):
                    continue
                
                if args: 
                    binding.setter(*args,**kwargs)
                else:
                    binding.setter(self.bindings[id(sender)].getter())

            self.ignoreEvents = False
936889
function(topology) {
  const maxWireVersion = topology.lastIsMaster().maxWireVersion;
  if (maxWireVersion < RETRYABLE_WIRE_VERSION) {
    return false;
  }

  if (!topology.logicalSessionTimeoutMinutes) {
    return false;
  }

  if (topologyType(topology) === TopologyType.Single) {
    return false;
  }

  return true;
}
275925
def update(self, data):
        """"""
        self.name = data["name"]
        self.description = data['description']
        self.win_index = data['win_index']
        # Other attributes are optional
        if conf.use_winpcapy:
            self._update_pcapdata()
        try:
            self.ip = socket.inet_ntoa(get_if_raw_addr(data['guid']))
        except (KeyError, AttributeError, NameError):
            pass
        try:
            self.mac = data['mac']
        except KeyError:
            pass
1172286
def _on_socket_push_updates(self, resp):
        
        # TODO: check to make sure resp['meta']['bundleid']==bundleid ?
        # TODO: handle added parameters
        # TODO: handle removed (isDeleted) parameters

        for item in resp['data']:
            if item['id'] in self.uniqueids:
                # then we're updating something in the parameter (or deleting)
                param = self.get_parameter(uniqueid=item['id'])
                for attr, value in item['attributes'].items():
                    if hasattr(param, "_{}".format(attr)):
                        logger.info("updates from server: setting {}@{}={}".
                                    format(attr, param.twig, value))
                        setattr(param, "_{}".format(attr), value)
            else:
                self._attach_param_from_server(item)
947585
def update(self, **kwargs):
        

        # When updating properties used only on controller we don't need to call the compute
        update_compute = False

        old_json = self.__json__()

        compute_properties = None
        # Update node properties with additional elements
        for prop in kwargs:
            if getattr(self, prop) != kwargs[prop]:
                if prop not in self.CONTROLLER_ONLY_PROPERTIES:
                    update_compute = True

                # We update properties on the compute and wait for the anwser from the compute node
                if prop == "properties":
                    compute_properties = kwargs[prop]
                else:
                    setattr(self, prop, kwargs[prop])

        self._list_ports()
        # We send notif only if object has changed
        if old_json != self.__json__():
            self.project.controller.notification.emit("node.updated", self.__json__())
        if update_compute:
            data = self._node_data(properties=compute_properties)
            response = yield from self.put(None, data=data)
            yield from self.parse_node_response(response.json)
        self.project.dump()
62825
def _update(self, **kwargs):
        """"""
        if 'content' in kwargs:
            content = kwargs.pop('content')
            path = self._construct_path_to_source_content()
            self._http.put(path, json.dumps({'content': content}))
        super(Resource, self)._update(**kwargs)
1279480
function onSkeletonUpdate(skeleton) {
    for (var c in connections) {
        connections[c].sendUTF(JSON.stringify(skeleton));
    }
}
1279115
def update_payload(self, fields=None):
        """"""
        payload = super(Subnet, self).update_payload(fields)
        if 'from_' in payload:
            payload['from'] = payload.pop('from_')
        return {u'subnet': payload}
796670
def update_org_smarthost(self, orgid, serverid, data):
        """"""
        return self.api_call(
            ENDPOINTS['orgsmarthosts']['update'],
            dict(orgid=orgid, serverid=serverid),
            body=data)
686773
def update!(opts={})
      response = Hubspot::Connection.post_json(FORM_PATH, params: { form_guid: @guid }, body: opts)
      self.send(:assign_properties, response)
      self
    end
807380
def update(self, lb, name=None, algorithm=None, protocol=None,
            halfClosed=None, port=None, timeout=None, httpsRedirect=None):
        
        body = {}
        if name is not None:
            body["name"] = name
        if algorithm is not None:
            body["algorithm"] = algorithm
        if protocol is not None:
            body["protocol"] = protocol
        if halfClosed is not None:
            body["halfClosed"] = halfClosed
        if port is not None:
            body["port"] = port
        if timeout is not None:
            body["timeout"] = timeout
        if httpsRedirect is not None:
            body["httpsRedirect"] = httpsRedirect
        if not body:
            # Nothing passed
            return
        body = {"loadBalancer": body}
        uri = "/loadbalancers/%s" % utils.get_id(lb)
        try:
            resp, resp_body = self.api.method_put(uri, body=body)
        except exc.ClientException as e:
            message = e.message
            details = e.details
            if message and details:
                errmsg = "%s - %s" % (message, details)
            else:
                errmsg = message
            raise exc.InvalidLoadBalancerParameters(errmsg)
        return resp, resp_body
584502
public void submitTopology() throws TopologySubmissionException {
    // build primary runtime config first
    Config primaryRuntime = Config.newBuilder()
          .putAll(LauncherUtils.getInstance().createPrimaryRuntime(topology)).build();
    // call launcher directly here if in dry-run mode
    if (Context.dryRun(config)) {
      callLauncherRunner(primaryRuntime);
      return;
    }
    // 1. Do prepare work
    // create an instance of state manager
    String statemgrClass = Context.stateManagerClass(config);
    IStateManager statemgr;

    // Create an instance of the launcher class
    String launcherClass = Context.launcherClass(config);
    ILauncher launcher;

    // create an instance of the uploader class
    String uploaderClass = Context.uploaderClass(config);
    IUploader uploader;

    // create an instance of state manager
    try {
      statemgr = ReflectionUtils.newInstance(statemgrClass);
    } catch (IllegalAccessException | InstantiationException | ClassNotFoundException e) {
      throw new TopologySubmissionException(
          String.format("Failed to instantiate state manager class '%s'", statemgrClass), e);
    }

    // create an instance of launcher
    try {
      launcher = ReflectionUtils.newInstance(launcherClass);
    } catch (IllegalAccessException | InstantiationException | ClassNotFoundException e) {
      throw new LauncherException(
          String.format("Failed to instantiate launcher class '%s'", launcherClass), e);
    }

    // create an instance of uploader
    try {
      uploader = ReflectionUtils.newInstance(uploaderClass);
    } catch (IllegalAccessException | InstantiationException | ClassNotFoundException e) {
      throw new UploaderException(
          String.format("Failed to instantiate uploader class '%s'", uploaderClass), e);
    }

    // Put it in a try block so that we can always clean resources
    try {
      // initialize the state manager
      statemgr.initialize(config);

      // initialize the uploader
      uploader.initialize(config);

      // TODO(mfu): timeout should read from config
      SchedulerStateManagerAdaptor adaptor = new SchedulerStateManagerAdaptor(statemgr, 5000);

      // Check if topology is already running
      validateSubmit(adaptor, topology.getName());

      LOG.log(Level.FINE, "Topology {0} to be submitted", topology.getName());

      Config runtimeWithoutPackageURI = Config.newBuilder()
          .putAll(primaryRuntime)
          .putAll(LauncherUtils.getInstance().createAdaptorRuntime(adaptor))
          .put(Key.LAUNCHER_CLASS_INSTANCE, launcher)
          .build();

      PackingPlan packingPlan = LauncherUtils.getInstance()
          .createPackingPlan(config, runtimeWithoutPackageURI);

      // The packing plan might call for a number of containers different than the config
      // settings. If that's the case we need to modify the configs to match.
      runtimeWithoutPackageURI =
          updateNumContainersIfNeeded(runtimeWithoutPackageURI, topology, packingPlan);

      // If the packing plan is valid we will upload necessary packages
      URI packageURI = uploadPackage(uploader);

      // Update the runtime config with the packageURI
      Config runtimeAll = Config.newBuilder()
          .putAll(runtimeWithoutPackageURI)
          .put(Key.TOPOLOGY_PACKAGE_URI, packageURI)
          .build();

      callLauncherRunner(runtimeAll);

    } catch (LauncherException | PackingException e) {
      // we undo uploading of topology package only if launcher fails to
      // launch topology, which will throw LauncherException or PackingException
      uploader.undo();
      throw e;
    } finally {
      SysUtils.closeIgnoringExceptions(uploader);
      SysUtils.closeIgnoringExceptions(launcher);
      SysUtils.closeIgnoringExceptions(statemgr);
    }
  }
637640
def update_payload(self, fields=None):
        """"""
        payload = super(HostCollection, self).update_payload(fields)
        if 'system_ids' in payload:
            payload['system_uuids'] = payload.pop('system_ids')
        return payload
112520
def on_change(self, server_description):
        """"""
        # We do no I/O holding the lock.
        with self._lock:
            # Monitors may continue working on ismaster calls for some time
            # after a call to Topology.close, so this method may be called at
            # any time. Ensure the topology is open before processing the
            # change.
            # Any monitored server was definitely in the topology description
            # once. Check if it's still in the description or if some state-
            # change removed it. E.g., we got a host list from the primary
            # that didn't include this server.
            if (self._opened and
                    self._description.has_server(server_description.address)):
                self._process_change(server_description)
1046773
@Override
    public void activate(String topologyName) throws TException {
        try {
            NimbusUtils.transitionName(data, topologyName, true, StatusType.activate);
            notifyTopologyActionListener(topologyName, "activate");
        } catch (NotAliveException e) {
            String errMsg = "Activate Error, topology " + topologyName + " is not alive!";
            LOG.error(errMsg, e);
            throw new NotAliveException(errMsg);
        } catch (Exception e) {
            String errMsg = "Failed to activate topology " + topologyName;
            LOG.error(errMsg, e);
            throw new TException(errMsg);
        }
    }
321425
function updateUrl (cb, urlNode, options) {
  return cb(urlNode.url, options)
    .then((response) => {
      if (response) {
        Object.assign(urlNode, response)
      }
    })
    .catch(() => {
    })
}