Skip to content

Clean up branding in the Cloud Bigtable autoscaler, and fix some typos #991

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions bigtable/autoscaler/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ Google Cloud Bigtable Python Samples
This directory contains samples for Google Cloud Bigtable. `Google Cloud Bigtable`_ is Google's NoSQL Big Data database service. It's the same database that powers many core Google services, including Search, Analytics, Maps, and Gmail.


This sample demonstrates using `Stackdriver monitoring`_,
This sample demonstrates how to use `Stackdriver Monitoring`_
to scale Cloud Bigtable based on CPU usage.

.. _Stackdriver Monitoring: http://cloud.google.com/monitoring/docs
.. _Stackdriver Monitoring: http://cloud.google.com/monitoring/docs/


.. _Google Cloud Bigtable: https://cloud.google.com/bigtable/docs
.. _Google Cloud Bigtable: https://cloud.google.com/bigtable/docs/

Setup
-------------------------------------------------------------------------------
Expand Down Expand Up @@ -90,7 +90,7 @@ To run this sample:
[--short_sleep SHORT_SLEEP] [--long_sleep LONG_SLEEP]
bigtable_instance bigtable_cluster

Scales Bigtable clusters based on CPU usage.
Scales Cloud Bigtable clusters based on CPU usage.

positional arguments:
bigtable_instance ID of the Cloud Bigtable instance to connect to.
Expand All @@ -99,11 +99,11 @@ To run this sample:
optional arguments:
-h, --help show this help message and exit
--high_cpu_threshold HIGH_CPU_THRESHOLD
If Bigtable CPU usages is above this threshold, scale
up
If Cloud Bigtable CPU usage is above this threshold,
scale up
--low_cpu_threshold LOW_CPU_THRESHOLD
If Bigtable CPU usages is above this threshold, scale
up
If Cloud Bigtable CPU usage is below this threshold,
scale down
--short_sleep SHORT_SLEEP
How long to sleep in seconds between checking metrics
after no scale operation
Expand Down
6 changes: 3 additions & 3 deletions bigtable/autoscaler/README.rst.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
product:
name: Google Cloud Bigtable
short_name: Cloud Bigtable
url: https://cloud.google.com/bigtable/docs
url: https://cloud.google.com/bigtable/docs/
description: >
`Google Cloud Bigtable`_ is Google's NoSQL Big Data database service. It's
the same database that powers many core Google services, including Search,
Analytics, Maps, and Gmail.

description: |
This sample demonstrates using `Stackdriver monitoring`_,
This sample demonstrates how to use `Stackdriver Monitoring`_
to scale Cloud Bigtable based on CPU usage.

.. _Stackdriver Monitoring: http://cloud.google.com/monitoring/docs
.. _Stackdriver Monitoring: http://cloud.google.com/monitoring/docs/

setup:
- auth
Expand Down
30 changes: 15 additions & 15 deletions bigtable/autoscaler/autoscaler.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

"""Sample that demonstrates how to use Bigtable Stackdriver metrics to
autoscale Google Cloud Bigtable."""
"""Sample that demonstrates how to use Stackdriver Monitoring metrics to
programmatically scale a Google Cloud Bigtable cluster."""

import argparse
import time
Expand All @@ -25,10 +25,10 @@


def get_cpu_load():
"""Returns the most recent Bigtable CPU load measurement.
"""Returns the most recent Cloud Bigtable CPU load measurement.

Returns:
float: The most recent Bigtable CPU usage metric
float: The most recent Cloud Bigtable CPU usage metric
"""
# [START bigtable_cpu]
client = monitoring.Client()
Expand All @@ -40,16 +40,16 @@ def get_cpu_load():


def scale_bigtable(bigtable_instance, bigtable_cluster, scale_up):
"""Scales the number of Bigtable nodes up or down.
"""Scales the number of Cloud Bigtable nodes up or down.

Edits the number of nodes in the Bigtable cluster to be increased
Edits the number of nodes in the Cloud Bigtable cluster to be increased
or decreased, depending on the `scale_up` boolean argument. Currently
the `incremental` strategy from `strategies.py` is used.


Args:
bigtable_instance (str): Cloud Bigtable instance id to scale
bigtable_cluster (str): Cloud Bigtable cluster id to scale
bigtable_instance (str): Cloud Bigtable instance ID to scale
bigtable_cluster (str): Cloud Bigtable cluster ID to scale
scale_up (bool): If true, scale up, otherwise scale down
"""
# [START bigtable_scale]
Expand Down Expand Up @@ -87,14 +87,14 @@ def main(
low_cpu_threshold,
short_sleep,
long_sleep):
"""Main loop runner that autoscales Bigtable.
"""Main loop runner that autoscales Cloud Bigtable.

Args:
bigtable_instance (str): Cloud Bigtable instance id to autoscale
bigtable_instance (str): Cloud Bigtable instance ID to autoscale
high_cpu_threshold (float): If CPU is higher than this, scale up.
low_cpu_threshold (float): If CPU is higher than this, scale down.
low_cpu_threshold (float): If CPU is lower than this, scale down.
short_sleep (int): How long to sleep after no operation
long_sleep (int): How long to sleep after the cluster nodes are
long_sleep (int): How long to sleep after the number of nodes is
changed
"""
cluster_cpu = get_cpu_load()
Expand All @@ -112,7 +112,7 @@ def main(

if __name__ == '__main__':
parser = argparse.ArgumentParser(
description='Scales Bigtable clusters based on CPU usage.')
description='Scales Cloud Bigtable clusters based on CPU usage.')
parser.add_argument(
'bigtable_instance',
help='ID of the Cloud Bigtable instance to connect to.')
Expand All @@ -121,11 +121,11 @@ def main(
help='ID of the Cloud Bigtable cluster to connect to.')
parser.add_argument(
'--high_cpu_threshold',
help='If Bigtable CPU usages is above this threshold, scale up',
help='If Cloud Bigtable CPU usage is above this threshold, scale up',
default=0.6)
parser.add_argument(
'--low_cpu_threshold',
help='If Bigtable CPU usages is above this threshold, scale up',
help='If Cloud Bigtable CPU usage is below this threshold, scale down',
default=0.2)
parser.add_argument(
'--short_sleep',
Expand Down