diff --git a/composer/workflows/airflow_db_cleanup.py b/composer/workflows/airflow_db_cleanup.py index 45119168111..4fefdc99202 100644 --- a/composer/workflows/airflow_db_cleanup.py +++ b/composer/workflows/airflow_db_cleanup.py @@ -460,7 +460,7 @@ def cleanup_function(**context): dags = session.query(airflow_db_model.dag_id).distinct() session.commit() - list_dags = [str(list(dag)[0]) for dag in dags] + [None] + list_dags = [str(list(dag)[0]) for dag in dags] for dag_id in list_dags: query = build_query( session=session, diff --git a/endpoints/bookstore-grpc-transcoding/api_config_auth.yaml b/endpoints/bookstore-grpc-transcoding/api_config_auth.yaml index dfeaaf3264f..832be4e6d72 100644 --- a/endpoints/bookstore-grpc-transcoding/api_config_auth.yaml +++ b/endpoints/bookstore-grpc-transcoding/api_config_auth.yaml @@ -52,6 +52,12 @@ authentication: # Replace SERVICE-ACCOUNT-ID with your service account's email address. issuer: SERVICE-ACCOUNT-ID jwks_uri: https://www.googleapis.com/robot/v1/metadata/x509/SERVICE-ACCOUNT-ID + # Optional: if the JWTs you send (e.g. via jwt_token_gen.py's + # --audiences flag) use a custom "aud" claim instead of your Endpoints + # service name, uncomment this and set it to that same value, or ESP + # will reject the token with a JWT validation error. See + # https://cloud.google.com/endpoints/docs/grpc/troubleshoot-jwt + # audiences: YOUR-AUDIENCE-VALUE rules: # This auth rule will apply to all methods. - selector: "*" diff --git a/endpoints/bookstore-grpc/api_config_auth.yaml b/endpoints/bookstore-grpc/api_config_auth.yaml index dfeaaf3264f..832be4e6d72 100644 --- a/endpoints/bookstore-grpc/api_config_auth.yaml +++ b/endpoints/bookstore-grpc/api_config_auth.yaml @@ -52,6 +52,12 @@ authentication: # Replace SERVICE-ACCOUNT-ID with your service account's email address. issuer: SERVICE-ACCOUNT-ID jwks_uri: https://www.googleapis.com/robot/v1/metadata/x509/SERVICE-ACCOUNT-ID + # Optional: if the JWTs you send (e.g. via jwt_token_gen.py's + # --audiences flag) use a custom "aud" claim instead of your Endpoints + # service name, uncomment this and set it to that same value, or ESP + # will reject the token with a JWT validation error. See + # https://cloud.google.com/endpoints/docs/grpc/troubleshoot-jwt + # audiences: YOUR-AUDIENCE-VALUE rules: # This auth rule will apply to all methods. - selector: "*" diff --git a/texttospeech/snippets/streaming_tts_quickstart.py b/texttospeech/snippets/streaming_tts_quickstart.py index 90c65063e94..4a52b4f16b9 100644 --- a/texttospeech/snippets/streaming_tts_quickstart.py +++ b/texttospeech/snippets/streaming_tts_quickstart.py @@ -58,8 +58,19 @@ def request_generator(): streaming_responses = client.streaming_synthesize(request_generator()) - for response in streaming_responses: - print(f"Audio content size in bytes is: {len(response.audio_content)}") + # The response stream contains headerless linear PCM (LINEAR16) audio + # sampled at 24000 Hz. Write it to a standard playable .wav file by + # adding a proper WAV header with the stdlib `wave` module, rather than + # a hand-rolled byte header. + import wave + + with wave.open("streaming_tts_quickstart_output.wav", "wb") as wav_file: + wav_file.setnchannels(1) # LINEAR16 audio from this API is mono. + wav_file.setsampwidth(2) # 16-bit samples (LINEAR16) = 2 bytes/sample. + wav_file.setframerate(24000) # Sample rate used above. + for response in streaming_responses: + print(f"Audio content size in bytes is: {len(response.audio_content)}") + wav_file.writeframes(response.audio_content) # [END tts_synthezise_streaming]