Skip to content

Commit 9fd07ec

Browse files
yoshi-automationbusunkim96
authored andcommitted
fix(videointelligence): make features a positional parameter in annotate_video, update retry config, make AnnotateVideo nonidempotent (via synth) (#9440)
1 parent 604f32d commit 9fd07ec

File tree

4 files changed

+22
-22
lines changed

4 files changed

+22
-22
lines changed

videointelligence/google/cloud/videointelligence_v1/gapic/video_intelligence_service_client.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -191,9 +191,9 @@ def __init__(
191191
# Service calls
192192
def annotate_video(
193193
self,
194+
features,
194195
input_uri=None,
195196
input_content=None,
196-
features=None,
197197
video_context=None,
198198
output_uri=None,
199199
location_id=None,
@@ -213,11 +213,11 @@ def annotate_video(
213213
>>>
214214
>>> client = videointelligence_v1.VideoIntelligenceServiceClient()
215215
>>>
216-
>>> input_uri = 'gs://cloud-samples-data/video/cat.mp4'
217216
>>> features_element = enums.Feature.LABEL_DETECTION
218217
>>> features = [features_element]
218+
>>> input_uri = 'gs://cloud-samples-data/video/cat.mp4'
219219
>>>
220-
>>> response = client.annotate_video(input_uri=input_uri, features=features)
220+
>>> response = client.annotate_video(features, input_uri=input_uri)
221221
>>>
222222
>>> def callback(operation_future):
223223
... # Handle result.
@@ -229,6 +229,7 @@ def annotate_video(
229229
>>> metadata = response.metadata()
230230
231231
Args:
232+
features (list[~google.cloud.videointelligence_v1.types.Feature]): Required. Requested video annotation features.
232233
input_uri (str): Input video location. Currently, only `Google Cloud
233234
Storage <https://cloud.google.com/storage/>`__ URIs are supported, which
234235
must be specified in the following format: ``gs://bucket-id/object-id``
@@ -241,7 +242,6 @@ def annotate_video(
241242
request as ``input_content``. If set, ``input_content`` should be unset.
242243
input_content (bytes): The video data bytes. If unset, the input video(s) should be specified
243244
via ``input_uri``. If set, ``input_uri`` should be unset.
244-
features (list[~google.cloud.videointelligence_v1.types.Feature]): Required. Requested video annotation features.
245245
video_context (Union[dict, ~google.cloud.videointelligence_v1.types.VideoContext]): Additional video context and/or feature-specific parameters.
246246
247247
If a dict is provided, it must be of the same form as the protobuf
@@ -288,9 +288,9 @@ def annotate_video(
288288
)
289289

290290
request = video_intelligence_pb2.AnnotateVideoRequest(
291+
features=features,
291292
input_uri=input_uri,
292293
input_content=input_content,
293-
features=features,
294294
video_context=video_context,
295295
output_uri=output_uri,
296296
location_id=location_id,

videointelligence/google/cloud/videointelligence_v1/gapic/video_intelligence_service_client_config.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77
},
88
"retry_params": {
99
"default": {
10-
"initial_retry_delay_millis": 1000,
11-
"retry_delay_multiplier": 2.5,
12-
"max_retry_delay_millis": 120000,
13-
"initial_rpc_timeout_millis": 120000,
10+
"initial_retry_delay_millis": 100,
11+
"retry_delay_multiplier": 1.3,
12+
"max_retry_delay_millis": 60000,
13+
"initial_rpc_timeout_millis": 20000,
1414
"rpc_timeout_multiplier": 1.0,
15-
"max_rpc_timeout_millis": 120000,
15+
"max_rpc_timeout_millis": 20000,
1616
"total_timeout_millis": 600000,
1717
}
1818
},
1919
"methods": {
2020
"AnnotateVideo": {
2121
"timeout_millis": 60000,
22-
"retry_codes_name": "idempotent",
22+
"retry_codes_name": "non_idempotent",
2323
"retry_params_name": "default",
2424
}
2525
},

videointelligence/synth.metadata

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
{
2-
"updateTime": "2019-10-09T12:39:48.814274Z",
2+
"updateTime": "2019-10-28T21:37:18.071018Z",
33
"sources": [
44
{
55
"generator": {
66
"name": "artman",
7-
"version": "0.38.0",
8-
"dockerImage": "googleapis/artman@sha256:0d2f8d429110aeb8d82df6550ef4ede59d40df9062d260a1580fce688b0512bf"
7+
"version": "0.40.3",
8+
"dockerImage": "googleapis/artman@sha256:c805f50525f5f557886c94ab76f56eaa09cb1da58c3ee95111fd34259376621a"
99
}
1010
},
1111
{
1212
"git": {
1313
"name": "googleapis",
1414
"remote": "https://github.com/googleapis/googleapis.git",
15-
"sha": "2dec8f98383214ad4fafa7680eb0cc46d6531976",
16-
"internalRef": "273619851"
15+
"sha": "3fb0873b5f8a4cf5be4f848d20e5ccb2bdee1a67",
16+
"internalRef": "277134185"
1717
}
1818
},
1919
{
2020
"template": {
2121
"name": "python_library",
2222
"origin": "synthtool.gcp",
23-
"version": "2019.5.2"
23+
"version": "2019.10.17"
2424
}
2525
}
2626
],

videointelligence/tests/unit/gapic/v1/test_video_intelligence_service_client_v1.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,17 +83,17 @@ def test_annotate_video(self):
8383
client = videointelligence_v1.VideoIntelligenceServiceClient()
8484

8585
# Setup Request
86-
input_uri = "gs://cloud-samples-data/video/cat.mp4"
8786
features_element = enums.Feature.LABEL_DETECTION
8887
features = [features_element]
88+
input_uri = "gs://cloud-samples-data/video/cat.mp4"
8989

90-
response = client.annotate_video(input_uri=input_uri, features=features)
90+
response = client.annotate_video(features, input_uri=input_uri)
9191
result = response.result()
9292
assert expected_response == result
9393

9494
assert len(channel.requests) == 1
9595
expected_request = video_intelligence_pb2.AnnotateVideoRequest(
96-
input_uri=input_uri, features=features
96+
features=features, input_uri=input_uri
9797
)
9898
actual_request = channel.requests[0][1]
9999
assert expected_request == actual_request
@@ -114,10 +114,10 @@ def test_annotate_video_exception(self):
114114
client = videointelligence_v1.VideoIntelligenceServiceClient()
115115

116116
# Setup Request
117-
input_uri = "gs://cloud-samples-data/video/cat.mp4"
118117
features_element = enums.Feature.LABEL_DETECTION
119118
features = [features_element]
119+
input_uri = "gs://cloud-samples-data/video/cat.mp4"
120120

121-
response = client.annotate_video(input_uri=input_uri, features=features)
121+
response = client.annotate_video(features, input_uri=input_uri)
122122
exception = response.exception()
123123
assert exception.errors[0] == error

0 commit comments

Comments
 (0)