From 28c88d261d3cdaa48c8989f88d72d58fad13a750 Mon Sep 17 00:00:00 2001 From: Bu Sun Kim Date: Thu, 14 Nov 2019 15:27:05 -0800 Subject: [PATCH] Revert "fix(videointelligence): make `features` a positional parameter in `annotate_video`, update retry config, make AnnotateVideo nonidempotent (via synth) (#9440)" This reverts commit 9fd07ecccb5d808ea9208204c8b0f4fdf7fcd063. --- .../gapic/video_intelligence_service_client.py | 10 +++++----- .../video_intelligence_service_client_config.py | 12 ++++++------ .../v1/test_video_intelligence_service_client_v1.py | 10 +++++----- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/videointelligence/google/cloud/videointelligence_v1/gapic/video_intelligence_service_client.py b/videointelligence/google/cloud/videointelligence_v1/gapic/video_intelligence_service_client.py index 86210ceaad2e..f872f349fde8 100644 --- a/videointelligence/google/cloud/videointelligence_v1/gapic/video_intelligence_service_client.py +++ b/videointelligence/google/cloud/videointelligence_v1/gapic/video_intelligence_service_client.py @@ -191,9 +191,9 @@ def __init__( # Service calls def annotate_video( self, - features, input_uri=None, input_content=None, + features=None, video_context=None, output_uri=None, location_id=None, @@ -213,11 +213,11 @@ def annotate_video( >>> >>> client = videointelligence_v1.VideoIntelligenceServiceClient() >>> + >>> input_uri = 'gs://cloud-samples-data/video/cat.mp4' >>> features_element = enums.Feature.LABEL_DETECTION >>> features = [features_element] - >>> input_uri = 'gs://cloud-samples-data/video/cat.mp4' >>> - >>> response = client.annotate_video(features, input_uri=input_uri) + >>> response = client.annotate_video(input_uri=input_uri, features=features) >>> >>> def callback(operation_future): ... # Handle result. @@ -229,7 +229,6 @@ def annotate_video( >>> metadata = response.metadata() Args: - features (list[~google.cloud.videointelligence_v1.types.Feature]): Required. Requested video annotation features. input_uri (str): Input video location. Currently, only `Google Cloud Storage `__ URIs are supported, which must be specified in the following format: ``gs://bucket-id/object-id`` @@ -242,6 +241,7 @@ def annotate_video( request as ``input_content``. If set, ``input_content`` should be unset. input_content (bytes): The video data bytes. If unset, the input video(s) should be specified via ``input_uri``. If set, ``input_uri`` should be unset. + features (list[~google.cloud.videointelligence_v1.types.Feature]): Required. Requested video annotation features. video_context (Union[dict, ~google.cloud.videointelligence_v1.types.VideoContext]): Additional video context and/or feature-specific parameters. If a dict is provided, it must be of the same form as the protobuf @@ -288,9 +288,9 @@ def annotate_video( ) request = video_intelligence_pb2.AnnotateVideoRequest( - features=features, input_uri=input_uri, input_content=input_content, + features=features, video_context=video_context, output_uri=output_uri, location_id=location_id, diff --git a/videointelligence/google/cloud/videointelligence_v1/gapic/video_intelligence_service_client_config.py b/videointelligence/google/cloud/videointelligence_v1/gapic/video_intelligence_service_client_config.py index 70a9b8812235..74dc2121caff 100644 --- a/videointelligence/google/cloud/videointelligence_v1/gapic/video_intelligence_service_client_config.py +++ b/videointelligence/google/cloud/videointelligence_v1/gapic/video_intelligence_service_client_config.py @@ -7,19 +7,19 @@ }, "retry_params": { "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 20000, + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 2.5, + "max_retry_delay_millis": 120000, + "initial_rpc_timeout_millis": 120000, "rpc_timeout_multiplier": 1.0, - "max_rpc_timeout_millis": 20000, + "max_rpc_timeout_millis": 120000, "total_timeout_millis": 600000, } }, "methods": { "AnnotateVideo": { "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", + "retry_codes_name": "idempotent", "retry_params_name": "default", } }, diff --git a/videointelligence/tests/unit/gapic/v1/test_video_intelligence_service_client_v1.py b/videointelligence/tests/unit/gapic/v1/test_video_intelligence_service_client_v1.py index d34b37cf76b1..fca6c1e165bd 100644 --- a/videointelligence/tests/unit/gapic/v1/test_video_intelligence_service_client_v1.py +++ b/videointelligence/tests/unit/gapic/v1/test_video_intelligence_service_client_v1.py @@ -83,17 +83,17 @@ def test_annotate_video(self): client = videointelligence_v1.VideoIntelligenceServiceClient() # Setup Request + input_uri = "gs://cloud-samples-data/video/cat.mp4" features_element = enums.Feature.LABEL_DETECTION features = [features_element] - input_uri = "gs://cloud-samples-data/video/cat.mp4" - response = client.annotate_video(features, input_uri=input_uri) + response = client.annotate_video(input_uri=input_uri, features=features) result = response.result() assert expected_response == result assert len(channel.requests) == 1 expected_request = video_intelligence_pb2.AnnotateVideoRequest( - features=features, input_uri=input_uri + input_uri=input_uri, features=features ) actual_request = channel.requests[0][1] assert expected_request == actual_request @@ -114,10 +114,10 @@ def test_annotate_video_exception(self): client = videointelligence_v1.VideoIntelligenceServiceClient() # Setup Request + input_uri = "gs://cloud-samples-data/video/cat.mp4" features_element = enums.Feature.LABEL_DETECTION features = [features_element] - input_uri = "gs://cloud-samples-data/video/cat.mp4" - response = client.annotate_video(features, input_uri=input_uri) + response = client.annotate_video(input_uri=input_uri, features=features) exception = response.exception() assert exception.errors[0] == error