Skip to content
Permalink
Browse files
fix: correct protobuf type for diagnose_cluster, update retry configs (
  • Loading branch information
yoshi-automation committed Jul 16, 2020
1 parent b539920 commit 822315ec3f2517ebb6ca199b72156ebd50e0518b
Showing with 2,027 additions and 1,572 deletions.
  1. +42 −42 google/cloud/dataproc_v1/gapic/autoscaling_policy_service_client.py
  2. +114 −23 google/cloud/dataproc_v1/gapic/autoscaling_policy_service_client_config.py
  3. +89 −89 google/cloud/dataproc_v1/gapic/cluster_controller_client.py
  4. +49 −26 google/cloud/dataproc_v1/gapic/cluster_controller_client_config.py
  5. +99 −99 google/cloud/dataproc_v1/gapic/job_controller_client.py
  6. +120 −30 google/cloud/dataproc_v1/gapic/job_controller_client_config.py
  7. +11 −11 google/cloud/dataproc_v1/gapic/transports/autoscaling_policy_service_grpc_transport.py
  8. +16 −16 google/cloud/dataproc_v1/gapic/transports/cluster_controller_grpc_transport.py
  9. +13 −13 google/cloud/dataproc_v1/gapic/transports/job_controller_grpc_transport.py
  10. +29 −29 google/cloud/dataproc_v1/gapic/transports/workflow_template_service_grpc_transport.py
  11. +177 −177 google/cloud/dataproc_v1/gapic/workflow_template_service_client.py
  12. +55 −32 google/cloud/dataproc_v1/gapic/workflow_template_service_client_config.py
  13. +1 −1 google/cloud/dataproc_v1/proto/autoscaling_policies_pb2.py
  14. +2 −2 google/cloud/dataproc_v1/proto/clusters.proto
  15. +9 −9 google/cloud/dataproc_v1/proto/clusters_pb2.py
  16. +1 −1 google/cloud/dataproc_v1/proto/jobs_pb2.py
  17. +1 −1 google/cloud/dataproc_v1/proto/operations_pb2.py
  18. +1 −1 google/cloud/dataproc_v1/proto/shared_pb2.py
  19. +1 −1 google/cloud/dataproc_v1/proto/workflow_templates_pb2.py
  20. +112 −21 google/cloud/dataproc_v1beta2/gapic/autoscaling_policy_service_client_config.py
  21. +89 −89 google/cloud/dataproc_v1beta2/gapic/cluster_controller_client.py
  22. +50 −27 google/cloud/dataproc_v1beta2/gapic/cluster_controller_client_config.py
  23. +99 −99 google/cloud/dataproc_v1beta2/gapic/job_controller_client.py
  24. +120 −30 google/cloud/dataproc_v1beta2/gapic/job_controller_client_config.py
  25. +16 −16 google/cloud/dataproc_v1beta2/gapic/transports/cluster_controller_grpc_transport.py
  26. +13 −13 google/cloud/dataproc_v1beta2/gapic/transports/job_controller_grpc_transport.py
  27. +29 −29 google/cloud/dataproc_v1beta2/gapic/transports/workflow_template_service_grpc_transport.py
  28. +177 −177 google/cloud/dataproc_v1beta2/gapic/workflow_template_service_client.py
  29. +54 −31 google/cloud/dataproc_v1beta2/gapic/workflow_template_service_client_config.py
  30. +1 −1 google/cloud/dataproc_v1beta2/proto/autoscaling_policies_pb2.py
  31. +1 −1 google/cloud/dataproc_v1beta2/proto/clusters_pb2.py
  32. +1 −1 google/cloud/dataproc_v1beta2/proto/jobs_pb2.py
  33. +1 −1 google/cloud/dataproc_v1beta2/proto/operations_pb2.py
  34. +1 −1 google/cloud/dataproc_v1beta2/proto/shared_pb2.py
  35. +1 −1 google/cloud/dataproc_v1beta2/proto/workflow_templates_pb2.py
  36. +5 −5 synth.metadata
  37. +14 −14 tests/unit/gapic/v1/test_autoscaling_policy_service_client_v1.py
  38. +57 −56 tests/unit/gapic/v1/test_cluster_controller_client_v1.py
  39. +65 −65 tests/unit/gapic/v1/test_job_controller_client_v1.py
  40. +84 −84 tests/unit/gapic/v1/test_workflow_template_service_client_v1.py
  41. +56 −56 tests/unit/gapic/v1beta2/test_cluster_controller_client_v1beta2.py
  42. +67 −67 tests/unit/gapic/v1beta2/test_job_controller_client_v1beta2.py
  43. +84 −84 tests/unit/gapic/v1beta2/test_workflow_template_service_client_v1beta2.py
@@ -218,31 +218,41 @@ def __init__(
self._inner_api_calls = {}

# Service calls
def update_autoscaling_policy(
def create_autoscaling_policy(
self,
parent,
policy,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Updates (replaces) autoscaling policy.
Disabled check for update_mask, because all updates will be full
replacements.
Creates new autoscaling policy.
Example:
>>> from google.cloud import dataproc_v1
>>>
>>> client = dataproc_v1.AutoscalingPolicyServiceClient()
>>>
>>> parent = client.region_path('[PROJECT]', '[REGION]')
>>>
>>> # TODO: Initialize `policy`:
>>> policy = {}
>>>
>>> response = client.update_autoscaling_policy(policy)
>>> response = client.create_autoscaling_policy(parent, policy)
Args:
policy (Union[dict, ~google.cloud.dataproc_v1.types.AutoscalingPolicy]): Required. The updated autoscaling policy.
parent (str): Required. The "resource name" of the region or location, as
described in https://cloud.google.com/apis/design/resource_names.
- For ``projects.regions.autoscalingPolicies.create``, the resource
name of the region has the following format:
``projects/{project_id}/regions/{region}``
- For ``projects.locations.autoscalingPolicies.create``, the resource
name of the location has the following format:
``projects/{project_id}/locations/{location}``
policy (Union[dict, ~google.cloud.dataproc_v1.types.AutoscalingPolicy]): Required. The autoscaling policy to create.
If a dict is provided, it must be of the same form as the protobuf
message :class:`~google.cloud.dataproc_v1.types.AutoscalingPolicy`
@@ -266,24 +276,24 @@ def update_autoscaling_policy(
ValueError: If the parameters are invalid.
"""
# Wrap the transport method to add retry and timeout logic.
if "update_autoscaling_policy" not in self._inner_api_calls:
if "create_autoscaling_policy" not in self._inner_api_calls:
self._inner_api_calls[
"update_autoscaling_policy"
"create_autoscaling_policy"
] = google.api_core.gapic_v1.method.wrap_method(
self.transport.update_autoscaling_policy,
default_retry=self._method_configs["UpdateAutoscalingPolicy"].retry,
default_timeout=self._method_configs["UpdateAutoscalingPolicy"].timeout,
self.transport.create_autoscaling_policy,
default_retry=self._method_configs["CreateAutoscalingPolicy"].retry,
default_timeout=self._method_configs["CreateAutoscalingPolicy"].timeout,
client_info=self._client_info,
)

request = autoscaling_policies_pb2.UpdateAutoscalingPolicyRequest(
policy=policy,
request = autoscaling_policies_pb2.CreateAutoscalingPolicyRequest(
parent=parent, policy=policy,
)
if metadata is None:
metadata = []
metadata = list(metadata)
try:
routing_header = [("policy.name", policy.name)]
routing_header = [("parent", parent)]
except AttributeError:
pass
else:
@@ -292,45 +302,35 @@ def update_autoscaling_policy(
)
metadata.append(routing_metadata)

return self._inner_api_calls["update_autoscaling_policy"](
return self._inner_api_calls["create_autoscaling_policy"](
request, retry=retry, timeout=timeout, metadata=metadata
)

def create_autoscaling_policy(
def update_autoscaling_policy(
self,
parent,
policy,
retry=google.api_core.gapic_v1.method.DEFAULT,
timeout=google.api_core.gapic_v1.method.DEFAULT,
metadata=None,
):
"""
Creates new autoscaling policy.
Updates (replaces) autoscaling policy.
Disabled check for update_mask, because all updates will be full
replacements.
Example:
>>> from google.cloud import dataproc_v1
>>>
>>> client = dataproc_v1.AutoscalingPolicyServiceClient()
>>>
>>> parent = client.region_path('[PROJECT]', '[REGION]')
>>>
>>> # TODO: Initialize `policy`:
>>> policy = {}
>>>
>>> response = client.create_autoscaling_policy(parent, policy)
>>> response = client.update_autoscaling_policy(policy)
Args:
parent (str): Required. The "resource name" of the region or location, as
described in https://cloud.google.com/apis/design/resource_names.
- For ``projects.regions.autoscalingPolicies.create``, the resource
name of the region has the following format:
``projects/{project_id}/regions/{region}``
- For ``projects.locations.autoscalingPolicies.create``, the resource
name of the location has the following format:
``projects/{project_id}/locations/{location}``
policy (Union[dict, ~google.cloud.dataproc_v1.types.AutoscalingPolicy]): Required. The autoscaling policy to create.
policy (Union[dict, ~google.cloud.dataproc_v1.types.AutoscalingPolicy]): Required. The updated autoscaling policy.
If a dict is provided, it must be of the same form as the protobuf
message :class:`~google.cloud.dataproc_v1.types.AutoscalingPolicy`
@@ -354,24 +354,24 @@ def create_autoscaling_policy(
ValueError: If the parameters are invalid.
"""
# Wrap the transport method to add retry and timeout logic.
if "create_autoscaling_policy" not in self._inner_api_calls:
if "update_autoscaling_policy" not in self._inner_api_calls:
self._inner_api_calls[
"create_autoscaling_policy"
"update_autoscaling_policy"
] = google.api_core.gapic_v1.method.wrap_method(
self.transport.create_autoscaling_policy,
default_retry=self._method_configs["CreateAutoscalingPolicy"].retry,
default_timeout=self._method_configs["CreateAutoscalingPolicy"].timeout,
self.transport.update_autoscaling_policy,
default_retry=self._method_configs["UpdateAutoscalingPolicy"].retry,
default_timeout=self._method_configs["UpdateAutoscalingPolicy"].timeout,
client_info=self._client_info,
)

request = autoscaling_policies_pb2.CreateAutoscalingPolicyRequest(
parent=parent, policy=policy,
request = autoscaling_policies_pb2.UpdateAutoscalingPolicyRequest(
policy=policy,
)
if metadata is None:
metadata = []
metadata = list(metadata)
try:
routing_header = [("parent", parent)]
routing_header = [("policy.name", policy.name)]
except AttributeError:
pass
else:
@@ -380,7 +380,7 @@ def create_autoscaling_policy(
)
metadata.append(routing_metadata)

return self._inner_api_calls["create_autoscaling_policy"](
return self._inner_api_calls["update_autoscaling_policy"](
request, retry=retry, timeout=timeout, metadata=metadata
)

@@ -2,45 +2,136 @@
"interfaces": {
"google.cloud.dataproc.v1.AutoscalingPolicyService": {
"retry_codes": {
"idempotent": ["DEADLINE_EXCEEDED", "UNAVAILABLE"],
"non_idempotent": [],
"retry_policy_4_codes": [
"DEADLINE_EXCEEDED",
"INTERNAL",
"UNAVAILABLE",
],
"retry_policy_1_codes": ["DEADLINE_EXCEEDED", "UNAVAILABLE"],
"retry_policy_6_codes": [
"INTERNAL",
"DEADLINE_EXCEEDED",
"UNAVAILABLE",
],
"no_retry_codes": [],
"retry_policy_3_codes": ["UNAVAILABLE"],
"retry_policy_2_codes": [
"DEADLINE_EXCEEDED",
"INTERNAL",
"UNAVAILABLE",
],
"no_retry_1_codes": [],
"retry_policy_5_codes": ["UNAVAILABLE"],
"retry_policy_7_codes": ["UNAVAILABLE"],
},
"retry_params": {
"default": {
"retry_policy_1_params": {
"initial_retry_delay_millis": 100,
"retry_delay_multiplier": 1.3,
"max_retry_delay_millis": 60000,
"initial_rpc_timeout_millis": 20000,
"initial_rpc_timeout_millis": 600000,
"rpc_timeout_multiplier": 1.0,
"max_rpc_timeout_millis": 20000,
"max_rpc_timeout_millis": 600000,
"total_timeout_millis": 600000,
}
},
"retry_policy_3_params": {
"initial_retry_delay_millis": 100,
"retry_delay_multiplier": 1.3,
"max_retry_delay_millis": 60000,
"initial_rpc_timeout_millis": 600000,
"rpc_timeout_multiplier": 1.0,
"max_rpc_timeout_millis": 600000,
"total_timeout_millis": 600000,
},
"retry_policy_2_params": {
"initial_retry_delay_millis": 100,
"retry_delay_multiplier": 1.3,
"max_retry_delay_millis": 60000,
"initial_rpc_timeout_millis": 900000,
"rpc_timeout_multiplier": 1.0,
"max_rpc_timeout_millis": 900000,
"total_timeout_millis": 900000,
},
"retry_policy_6_params": {
"initial_retry_delay_millis": 100,
"retry_delay_multiplier": 1.3,
"max_retry_delay_millis": 60000,
"initial_rpc_timeout_millis": 300000,
"rpc_timeout_multiplier": 1.0,
"max_rpc_timeout_millis": 300000,
"total_timeout_millis": 300000,
},
"retry_policy_7_params": {
"initial_retry_delay_millis": 100,
"retry_delay_multiplier": 1.3,
"max_retry_delay_millis": 60000,
"initial_rpc_timeout_millis": 900000,
"rpc_timeout_multiplier": 1.0,
"max_rpc_timeout_millis": 900000,
"total_timeout_millis": 900000,
},
"retry_policy_5_params": {
"initial_retry_delay_millis": 100,
"retry_delay_multiplier": 1.3,
"max_retry_delay_millis": 60000,
"initial_rpc_timeout_millis": 300000,
"rpc_timeout_multiplier": 1.0,
"max_rpc_timeout_millis": 300000,
"total_timeout_millis": 300000,
},
"retry_policy_4_params": {
"initial_retry_delay_millis": 100,
"retry_delay_multiplier": 1.3,
"max_retry_delay_millis": 60000,
"initial_rpc_timeout_millis": 600000,
"rpc_timeout_multiplier": 1.0,
"max_rpc_timeout_millis": 600000,
"total_timeout_millis": 600000,
},
"no_retry_params": {
"initial_retry_delay_millis": 0,
"retry_delay_multiplier": 0.0,
"max_retry_delay_millis": 0,
"initial_rpc_timeout_millis": 0,
"rpc_timeout_multiplier": 1.0,
"max_rpc_timeout_millis": 0,
"total_timeout_millis": 0,
},
"no_retry_1_params": {
"initial_retry_delay_millis": 0,
"retry_delay_multiplier": 0.0,
"max_retry_delay_millis": 0,
"initial_rpc_timeout_millis": 600000,
"rpc_timeout_multiplier": 1.0,
"max_rpc_timeout_millis": 600000,
"total_timeout_millis": 600000,
},
},
"methods": {
"UpdateAutoscalingPolicy": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default",
},
"CreateAutoscalingPolicy": {
"timeout_millis": 60000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default",
"timeout_millis": 600000,
"retry_codes_name": "no_retry_1_codes",
"retry_params_name": "no_retry_1_params",
},
"UpdateAutoscalingPolicy": {
"timeout_millis": 600000,
"retry_codes_name": "retry_policy_1_codes",
"retry_params_name": "retry_policy_1_params",
},
"GetAutoscalingPolicy": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default",
"timeout_millis": 600000,
"retry_codes_name": "retry_policy_1_codes",
"retry_params_name": "retry_policy_1_params",
},
"ListAutoscalingPolicies": {
"timeout_millis": 60000,
"retry_codes_name": "idempotent",
"retry_params_name": "default",
"timeout_millis": 600000,
"retry_codes_name": "retry_policy_1_codes",
"retry_params_name": "retry_policy_1_params",
},
"DeleteAutoscalingPolicy": {
"timeout_millis": 60000,
"retry_codes_name": "non_idempotent",
"retry_params_name": "default",
"timeout_millis": 600000,
"retry_codes_name": "no_retry_1_codes",
"retry_params_name": "no_retry_1_params",
},
},
}

0 comments on commit 822315e

Please sign in to comment.