From aa7d7eaebd55ead90c438e38d31e09d9a57846e2 Mon Sep 17 00:00:00 2001 From: Yu-Han Liu Date: Thu, 30 May 2019 16:15:13 -0700 Subject: [PATCH] explicitly set timeout in steaming_annotate_video, and comment --- video/cloud-client/analyze/beta_snippets.py | 25 ++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/video/cloud-client/analyze/beta_snippets.py b/video/cloud-client/analyze/beta_snippets.py index 356b9ec114d..ac91a086342 100644 --- a/video/cloud-client/analyze/beta_snippets.py +++ b/video/cloud-client/analyze/beta_snippets.py @@ -325,7 +325,10 @@ def stream_generator(): requests = stream_generator() # streaming_annotate_video returns a generator. - responses = client.streaming_annotate_video(requests) + # The default timeout is about 300 seconds. + # To process longer videos it should be set to + # larger than the length (in seconds) of the stream. + responses = client.streaming_annotate_video(requests, timeout=600) # Each response corresponds to about 1 second of video. for response in responses: @@ -385,7 +388,10 @@ def stream_generator(): requests = stream_generator() # streaming_annotate_video returns a generator. - responses = client.streaming_annotate_video(requests) + # The default timeout is about 300 seconds. + # To process longer videos it should be set to + # larger than the length (in seconds) of the stream. + responses = client.streaming_annotate_video(requests, timeout=600) # Each response corresponds to about 1 second of video. for response in responses: @@ -442,7 +448,10 @@ def stream_generator(): requests = stream_generator() # streaming_annotate_video returns a generator. - responses = client.streaming_annotate_video(requests) + # The default timeout is about 300 seconds. + # To process longer videos it should be set to + # larger than the length (in seconds) of the stream. + responses = client.streaming_annotate_video(requests, timeout=600) # Each response corresponds to about 1 second of video. for response in responses: @@ -519,7 +528,10 @@ def stream_generator(): requests = stream_generator() # streaming_annotate_video returns a generator. - responses = client.streaming_annotate_video(requests) + # The default timeout is about 300 seconds. + # To process longer videos it should be set to + # larger than the length (in seconds) of the stream. + responses = client.streaming_annotate_video(requests, timeout=600) # Each response corresponds to about 1 second of video. for response in responses: @@ -585,7 +597,10 @@ def stream_generator(): requests = stream_generator() # streaming_annotate_video returns a generator. - responses = client.streaming_annotate_video(requests) + # The default timeout is about 300 seconds. + # To process longer videos it should be set to + # larger than the length (in seconds) of the stream. + responses = client.streaming_annotate_video(requests, timeout=600) for response in responses: # Check for errors.