Skip to content

Commit

Permalink
docs: add multiprocessing note (via synth) (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshi-automation authored May 28, 2020
1 parent 95ee60d commit 9fdc8e6
Show file tree
Hide file tree
Showing 12 changed files with 552 additions and 559 deletions.
2 changes: 0 additions & 2 deletions packages/google-cloud-redis/.kokoro/publish-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

#!/bin/bash

set -eo pipefail

# Disable buffering, so that the logs stream through.
Expand Down
2 changes: 2 additions & 0 deletions packages/google-cloud-redis/docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
.. include:: README.rst

.. include:: multiprocessing.rst

Api Reference
-------------
.. toctree::
Expand Down
7 changes: 7 additions & 0 deletions packages/google-cloud-redis/docs/multiprocessing.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.. note::

Because this client uses :mod:`grpcio` library, it is safe to
share instances across threads. In multiprocessing scenarios, the best
practice is to create client instances *after* the invocation of
:func:`os.fork` by :class:`multiprocessing.Pool` or
:class:`multiprocessing.Process`.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class CloudRedisClient(object):
- As such, Redis instances are resources of the form:
``/projects/{project_id}/locations/{location_id}/instances/{instance_id}``
Note that location\_id must be referring to a GCP ``region``; for
Note that location_id must be referring to a GCP ``region``; for
example:
- ``projects/redpepper-1290/locations/us-central1/instances/my-redis``
Expand Down Expand Up @@ -424,7 +424,8 @@ def create_instance(
metadata=None,
):
"""
Creates a Redis instance based on the specified tier and memory size.
Creates a Redis instance based on the specified tier and memory
size.
By default, the instance is accessible from the project's `default
network <https://cloud.google.com/compute/docs/networks-and-firewalls#networks>`__.
Expand Down Expand Up @@ -465,8 +466,8 @@ def create_instance(
parent (str): Required. The resource name of the instance location using the form:
``projects/{project_id}/locations/{location_id}`` where ``location_id``
refers to a GCP region.
instance_id (str): Required. The logical name of the Redis instance in the customer project
with the following restrictions:
instance_id (str): Required. The logical name of the Redis instance in the customer
project with the following restrictions:
- Must contain only lowercase letters, numbers, and hyphens.
- Must start with a letter.
Expand Down Expand Up @@ -574,9 +575,9 @@ def update_instance(
>>> metadata = response.metadata()
Args:
update_mask (Union[dict, ~google.cloud.redis_v1.types.FieldMask]): Required. Mask of fields to update. At least one path must be supplied
in this field. The elements of the repeated paths field may only include
these fields from ``Instance``:
update_mask (Union[dict, ~google.cloud.redis_v1.types.FieldMask]): Required. Mask of fields to update. At least one path must be
supplied in this field. The elements of the repeated paths field may
only include these fields from ``Instance``:
- ``displayName``
- ``labels``
Expand All @@ -585,8 +586,8 @@ def update_instance(
If a dict is provided, it must be of the same form as the protobuf
message :class:`~google.cloud.redis_v1.types.FieldMask`
instance (Union[dict, ~google.cloud.redis_v1.types.Instance]): Required. Update description. Only fields specified in update\_mask are
updated.
instance (Union[dict, ~google.cloud.redis_v1.types.Instance]): Required. Update description. Only fields specified in update_mask
are updated.
If a dict is provided, it must be of the same form as the protobuf
message :class:`~google.cloud.redis_v1.types.Instance`
Expand Down Expand Up @@ -886,8 +887,8 @@ def failover_instance(
name (str): Required. Redis instance resource name using the form:
``projects/{project_id}/locations/{location_id}/instances/{instance_id}``
where ``location_id`` refers to a GCP region.
data_protection_mode (~google.cloud.redis_v1.types.DataProtectionMode): Optional. Available data protection modes that the user can choose. If
it's unspecified, data protection mode will be LIMITED\_DATA\_LOSS by
data_protection_mode (~google.cloud.redis_v1.types.DataProtectionMode): Optional. Available data protection modes that the user can choose.
If it's unspecified, data protection mode will be LIMITED_DATA_LOSS by
default.
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class DataProtectionMode(enum.IntEnum):
Specifies different modes of operation in relation to the data retention.
Attributes:
DATA_PROTECTION_MODE_UNSPECIFIED (int): Defaults to LIMITED\_DATA\_LOSS if a data protection mode is not
DATA_PROTECTION_MODE_UNSPECIFIED (int): Defaults to LIMITED_DATA_LOSS if a data protection mode is not
specified.
LIMITED_DATA_LOSS (int): Instance failover will be protected with data loss control. More
specifically, the failover will only be performed if the current
Expand Down Expand Up @@ -90,7 +90,7 @@ class Tier(enum.IntEnum):
Attributes:
TIER_UNSPECIFIED (int): Not set.
BASIC (int): BASIC tier: standalone instance
STANDARD_HA (int): STANDARD\_HA tier: highly available primary/replica instances
STANDARD_HA (int): STANDARD_HA tier: highly available primary/replica instances
"""

TIER_UNSPECIFIED = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ def get_instance(self):
def create_instance(self):
"""Return the gRPC stub for :meth:`CloudRedisClient.create_instance`.
Creates a Redis instance based on the specified tier and memory size.
Creates a Redis instance based on the specified tier and memory
size.
By default, the instance is accessible from the project's `default
network <https://cloud.google.com/compute/docs/networks-and-firewalls#networks>`__.
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ class CloudRedisClient(object):
- As such, Redis instances are resources of the form:
``/projects/{project_id}/locations/{location_id}/instances/{instance_id}``
Note that location\_id must be refering to a GCP ``region``; for
example:
Note that location_id must be refering to a GCP ``region``; for example:
- ``projects/redpepper-1290/locations/us-central1/instances/my-redis``
"""
Expand Down Expand Up @@ -425,7 +424,8 @@ def create_instance(
metadata=None,
):
"""
Creates a Redis instance based on the specified tier and memory size.
Creates a Redis instance based on the specified tier and memory
size.
By default, the instance is accessible from the project's `default
network <https://cloud.google.com/compute/docs/networks-and-firewalls#networks>`__.
Expand Down Expand Up @@ -466,8 +466,8 @@ def create_instance(
parent (str): Required. The resource name of the instance location using the form:
``projects/{project_id}/locations/{location_id}`` where ``location_id``
refers to a GCP region.
instance_id (str): Required. The logical name of the Redis instance in the customer project
with the following restrictions:
instance_id (str): Required. The logical name of the Redis instance in the customer
project with the following restrictions:
- Must contain only lowercase letters, numbers, and hyphens.
- Must start with a letter.
Expand Down Expand Up @@ -575,9 +575,9 @@ def update_instance(
>>> metadata = response.metadata()
Args:
update_mask (Union[dict, ~google.cloud.redis_v1beta1.types.FieldMask]): Required. Mask of fields to update. At least one path must be supplied
in this field. The elements of the repeated paths field may only include
these fields from ``Instance``:
update_mask (Union[dict, ~google.cloud.redis_v1beta1.types.FieldMask]): Required. Mask of fields to update. At least one path must be
supplied in this field. The elements of the repeated paths field may
only include these fields from ``Instance``:
- ``displayName``
- ``labels``
Expand All @@ -586,8 +586,8 @@ def update_instance(
If a dict is provided, it must be of the same form as the protobuf
message :class:`~google.cloud.redis_v1beta1.types.FieldMask`
instance (Union[dict, ~google.cloud.redis_v1beta1.types.Instance]): Required. Update description. Only fields specified in update\_mask are
updated.
instance (Union[dict, ~google.cloud.redis_v1beta1.types.Instance]): Required. Update description. Only fields specified in update_mask
are updated.
If a dict is provided, it must be of the same form as the protobuf
message :class:`~google.cloud.redis_v1beta1.types.Instance`
Expand Down Expand Up @@ -887,8 +887,8 @@ def failover_instance(
name (str): Required. Redis instance resource name using the form:
``projects/{project_id}/locations/{location_id}/instances/{instance_id}``
where ``location_id`` refers to a GCP region.
data_protection_mode (~google.cloud.redis_v1beta1.types.DataProtectionMode): Optional. Available data protection modes that the user can choose. If
it's unspecified, data protection mode will be LIMITED\_DATA\_LOSS by
data_protection_mode (~google.cloud.redis_v1beta1.types.DataProtectionMode): Optional. Available data protection modes that the user can choose.
If it's unspecified, data protection mode will be LIMITED_DATA_LOSS by
default.
retry (Optional[google.api_core.retry.Retry]): A retry object used
to retry requests. If ``None`` is specified, requests will
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class DataProtectionMode(enum.IntEnum):
Specifies different modes of operation in relation to the data retention.
Attributes:
DATA_PROTECTION_MODE_UNSPECIFIED (int): Defaults to LIMITED\_DATA\_LOSS if a data protection mode is not
DATA_PROTECTION_MODE_UNSPECIFIED (int): Defaults to LIMITED_DATA_LOSS if a data protection mode is not
specified.
LIMITED_DATA_LOSS (int): Instance failover will be protected with data loss control. More
specifically, the failover will only be performed if the current
Expand Down Expand Up @@ -90,7 +90,7 @@ class Tier(enum.IntEnum):
Attributes:
TIER_UNSPECIFIED (int): Not set.
BASIC (int): BASIC tier: standalone instance
STANDARD_HA (int): STANDARD\_HA tier: highly available primary/replica instances
STANDARD_HA (int): STANDARD_HA tier: highly available primary/replica instances
"""

TIER_UNSPECIFIED = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ def get_instance(self):
def create_instance(self):
"""Return the gRPC stub for :meth:`CloudRedisClient.create_instance`.
Creates a Redis instance based on the specified tier and memory size.
Creates a Redis instance based on the specified tier and memory
size.
By default, the instance is accessible from the project's `default
network <https://cloud.google.com/compute/docs/networks-and-firewalls#networks>`__.
Expand Down
Loading

0 comments on commit 9fdc8e6

Please sign in to comment.