Destroys all nodes of a Ray cluster described by a config json.
489142
def teardown_cluster(config_file, yes, workers_only, override_cluster_name):
    """"""

    config = yaml.load(open(config_file).read())
    if override_cluster_name is not None:
        config["cluster_name"] = override_cluster_name
    validate_config(config)
    config = fillout_defaults(config)

    confirm("This will destroy your cluster", yes)

    provider = get_node_provider(config["provider"], config["cluster_name"])

    try:

        def remaining_nodes():
            if workers_only:
                A = []
            else:
                A = [
                    node_id for node_id in provider.non_terminated_nodes({
                        TAG_RAY_NODE_TYPE: "head"
                    })
                ]

            A += [
                node_id for node_id in provider.non_terminated_nodes({
                    TAG_RAY_NODE_TYPE: "worker"
                })
            ]
            return A

        # Loop here to check that both the head and worker nodes are actually
        #   really gone
        A = remaining_nodes()
        with LogTimer("teardown_cluster: Termination done."):
            while A:
                logger.info("teardown_cluster: "
                            "Terminating {} nodes...".format(len(A)))
                provider.terminate_nodes(A)
                time.sleep(1)
                A = remaining_nodes()
    finally:
        provider.cleanup()
403872
function destroy() {
         me.pool.push(this.offset);
         this.offset = undefined;

         this._super(me.Renderable, "destroy");
       }
88256
public void destroy() {
        if (mApplicationDepot != null) {
            mLog.info("Destroying ApplicationDepot");
            mApplicationDepot.destroy();
        }
        for (Iterator i = getPlugins().values().iterator(); i.hasNext(); )
            ((Plugin) i.next()).destroy();
    }
570657
function destroy() {
			each(crosshairs, function (crosshair) {
				if (crosshair) {
					crosshair.destroy();
				}
			});

			// Destroy and clear local variables
			each([box, label, group], function (obj) {
				if (obj) {
					obj.destroy();
				}
			});
			box = label = group = null;
		}
266671
function destroyServer(server, topology, callback) {
  LOCAL_SERVER_EVENTS.forEach(event => server.removeAllListeners(event));

  server.destroy(() => {
    topology.emit(
      'serverClosed',
      new monitoring.ServerClosedEvent(topology.s.id, server.description.address)
    );

    if (typeof callback === 'function') callback(null, null);
  });
}
614447
@Override
    public void destroyAll() {
        for (Layer layer : this.layerManager.getLayers()) {
            this.layerManager.getLayers().remove(layer);
            layer.onDestroy();
            if (layer instanceof TileLayer) {
                ((TileLayer<?>) layer).getTileCache().destroy();
            }
            if (layer instanceof TileRendererLayer) {
                LabelStore labelStore = ((TileRendererLayer) layer).getLabelStore();
                if (labelStore != null) {
                    labelStore.clear();
                }
            }
        }
        destroy();
    }
1074457
def destroy(self):
        """"""
        self._refresh_connection()

        self.push_queue = []
        index_name = self.document_class()._get_index()  # pylint: disable=protected-access
        connections.get_connection().indices.delete(index_name, ignore=404)

        self._mapping_created = False
1214771
public void destroy() {

		if (bundlesHandler != null) {
			ThreadLocalJawrContext.setInterruptProcessingBundle(true);
		}

		// Stop the config change listener.
		if (null != this.configChangeListenerThread) {
			configChangeListenerThread.stopPolling();
			try {
				configChangeListenerThread.interrupt();
				Thread.sleep(200);
			} catch (InterruptedException e) {
				// Nothing to do
			}
		}
		if (watcher != null) {
			watcher.stopWatching();
			try {
				watcher.interrupt();
				Thread.sleep(200);
			} catch (InterruptedException e) {
				// Nothing to do
			}
		}

		JmxUtils.unregisterJMXBean(servletContext, resourceType,
				jawrConfig.getProperty(JawrConstant.JAWR_JMX_MBEAN_PREFIX));

		ThreadLocalJawrContext.reset();
	}
1062297
public void destroy()
    {
        if (_ajpIn!=null)
            _ajpIn.destroy();
        _ajpIn=null;
        if (_ajpOut!=null)
            _ajpOut.destroy();
        _ajpOut=null;
        _remoteHost=null;
        _remoteAddr=null;
        _serverName=null;
    }
341639
public void destroy() {
        for (int j = 0; j < mApplications.length; j++) {
            if (mApplications[j] != null) {
                mApplications[j].destroy();
            }
        }
    }
193497
function () {
			this.writeDebug('destroy');
			// Reset
			this.reset();
			var $mapDiv = $('#' + this.settings.mapID);

			// Remove marker event listeners
			if (markers.length) {
				for(var i = 0; i <= markers.length; i++) {
					google.maps.event.removeListener(markers[i]);
				}
			}

			// Remove markup
			$('.' + this.settings.locationList + ' ul').empty();
			if ($mapDiv.hasClass('bh-sl-map-open')) {
				$mapDiv.empty().removeClass('bh-sl-map-open');
			}

			// Remove modal markup
			if (this.settings.modal === true) {
				$('. ' + this.settings.overlay).remove();
			}

			// Remove map style from container
			$mapDiv.attr('style', '');

			// Hide map container
			$this.hide();
			// Remove data
			$.removeData($this.get(0));
			// Remove namespaced events
			$(document).off(pluginName);
			// Unbind plugin
			$this.unbind();
		}
764737
@Override
    public void destroy()
    {
        this.externalProperties = null;
        Object connection = getConnectionPoolOrConnection();

        if (connection != null)
        {
            ((TransportClient) connection).close();

        }
    }
884738
function destroy(obj) {
    var meta = _emberMetalMeta.peekMeta(obj);
    var node, nodes, key, nodeObject;

    if (meta) {
      _emberMetalMeta.deleteMeta(obj);
      // remove chainWatchers to remove circular references that would prevent GC
      node = meta.readableChains();
      if (node) {
        NODE_STACK.push(node);
        // process tree
        while (NODE_STACK.length > 0) {
          node = NODE_STACK.pop();
          // push children
          nodes = node._chains;
          if (nodes) {
            for (key in nodes) {
              if (nodes[key] !== undefined) {
                NODE_STACK.push(nodes[key]);
              }
            }
          }
          // remove chainWatcher in node object
          if (node._watching) {
            nodeObject = node._object;
            if (nodeObject) {
              _emberMetalChains.removeChainWatcher(nodeObject, node._key, node);
            }
          }
        }
      }
    }
  }
1050881
def destroy(self):
        
        core.gear.pool.remove(self)    
        self.base.clear()
1098070
public function destroy()
    {
        $this->identifierMap = [];
        $this->objectMap = new \SplObjectStorage();
        $this->reconstitutedEntities = new \SplObjectStorage();
        $this->reconstitutedEntitiesData = [];
    }
1194238
function destroyMap (map) {
    var el = map.getContainer();
    map.remove();
    document.body.removeChild(el);
  }
1133011
function()  {
        if (this.element && this.element.parentNode == this.div) {
            this.div.removeChild(this.element);
            this.element = null;
        }
        if (this.map) {
            this.map.events.unregister('moveend', this, this.updateLink);
        }

        OpenLayers.Control.prototype.destroy.apply(this, arguments); 
    }