npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

zones-for-google-cloud

v0.2.0

Published

list zones in Google Cloud that are up, meet various requirements, and are in regions with available project quota

Downloads

21

Readme

zones-for-google-cloud

Extract a list of zones in Google Compute Engine[tm] suitable for starting a particular VM.

You can specify the region of the world (prefix), CPU type (platform), number of CPUs, disk, or other requirements and get a list of zones that are "UP" where your project has quota meeting these requirements.

Bear in mind that doesn't mean you won't get a ZONE_RESOURCE_POOL_EXHAUSTED or similar error, but since it returns a list of zones, you can then write your code to retry, do random choice, or temporary blacklisting, or other techniques to improve success rate on vm launch.

Installation

npm i @google-cloud/compute -S npm i zones-for-google-cloud -S

JS Engine Compatiblity

Includes ES6+ code. Intended for deployment on node.js

Initialization

const compute = require('@google-cloud/compute')(); // requires credentials when run outside of Google Cloud
const zonesForGoogleCloud = require('zones-for-google-cloud')(compute);

Usage

returns Promises

{...} is a placeholder for additional code

Resolves to an Array of Strings containing names of some Google Compute Engine Zones that are UP, start with us-, support Intel Skylake (required for 64 or 96 cpu VMs), in a region where you have at least 64 PREEMPTIBLE_CPUS (or CPUS, if PREEMPTIBLE_CPUS quota is undefined) quota

zonesForGoogleCloud.find({
   prefix: 'us-',
   platform: 'Intel Skylake',
   requirements: { PREEMPTIBLE_CPUS: 64 }
}).then(...startMyVMInOneOfTheseZones...)

All parameters are optional, in which case you get a list of all zones that are up.

requirements is an object, where the keys are Google Cloud Platform regional metrics and the values are the additional amounts needed. The METRICS ARE ALL CAPS and match the metric names in gcloud compute region describe us-central1

Tests

The tests were run on a Google Cloud VM with full access to Google Compute Engine.

Running these tests outside Google Cloud will fail unless appropriate credentials are added to the line initializing compute.

Copyright

Copyright 2018 Paul Brewer, Economic and Financial Technology Consulting LLC

License

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

No relationship to Google, Inc.

This software is 3rd party software. This software is not a product of Google, Inc.

Google Compute Engine[tm] is a trademark of Google, Inc.