Tensorflow/GCS: Check whether we are running under GCE before trying to obtain auth...
authorA. Unique TensorFlower <gardener@tensorflow.org>
Wed, 21 Mar 2018 13:57:06 +0000 (06:57 -0700)
committerTensorFlower Gardener <gardener@tensorflow.org>
Wed, 21 Mar 2018 13:59:59 +0000 (06:59 -0700)
commitabd5b15ababbb5601f02691620d4d8e094cff64e
tree15d6dff2c18ab0ec3ed82838eef27821ebebc34b
parent73a5fb686c10f044f245b27f246ff56f690ada1f
Tensorflow/GCS: Check whether we are running under GCE before trying to obtain auth token from GCE. Before this change, if a process is not running under GCE, the token request to metadata server would time out after 3+ minutes of retry. After this change, the check is bypassed, and we return an empty token to the caller. At that point, the caller's request to read/write a file in GCS would either succeed or fail depending on whether the bucket is publicly accessible.

PiperOrigin-RevId: 189900977
tensorflow/core/platform/cloud/BUILD
tensorflow/core/platform/cloud/fake_env.cc [new file with mode: 0644]
tensorflow/core/platform/cloud/fake_env.h [new file with mode: 0644]
tensorflow/core/platform/cloud/gce_env_utils.cc [new file with mode: 0644]
tensorflow/core/platform/cloud/gce_env_utils.h [new file with mode: 0644]
tensorflow/core/platform/cloud/gcp_env_utils_test.cc [new file with mode: 0644]
tensorflow/core/platform/cloud/google_auth_provider.cc
tensorflow/core/platform/cloud/google_auth_provider.h
tensorflow/core/platform/cloud/google_auth_provider_test.cc
tensorflow/core/platform/env.h