diff options
author | Patrick Nguyen <drpng@google.com> | 2016-10-20 12:09:18 -0800 |
---|---|---|
committer | TensorFlower Gardener <gardener@tensorflow.org> | 2016-10-20 13:19:03 -0700 |
commit | c5ab3dd177dc16bb211821e38219f350a613b5e8 (patch) | |
tree | 69f38f2790f85f31dae60b6b7c6b136b3b380daa /tensorflow/tools/gcs_test | |
parent | 8532897352ada1d8ecd3ca1dd17aaa869a42d4b8 (diff) |
Merge changes from github.
Change: 136750267
Diffstat (limited to 'tensorflow/tools/gcs_test')
-rwxr-xr-x | tensorflow/tools/gcs_test/gcs_smoke_wrapper.sh | 12 | ||||
-rw-r--r-- | tensorflow/tools/gcs_test/python/gcs_smoke.py | 23 |
2 files changed, 34 insertions, 1 deletions
diff --git a/tensorflow/tools/gcs_test/gcs_smoke_wrapper.sh b/tensorflow/tools/gcs_test/gcs_smoke_wrapper.sh index 89a0dd9169..68800d67af 100755 --- a/tensorflow/tools/gcs_test/gcs_smoke_wrapper.sh +++ b/tensorflow/tools/gcs_test/gcs_smoke_wrapper.sh @@ -95,4 +95,14 @@ if [[ -z ${NEW_TFREC_URL} ]]; then fi "${GSUTIL_BIN}" rm "${NEW_TFREC_URL}" && \ echo "Cleaned up new tfrecord file in GCS: ${NEW_TFREC_URL}" || \ - die "FAIL: Unable to clean up new tfrecord file in GCS: ${NEW_TFREC_URL}"
\ No newline at end of file + die "FAIL: Unable to clean up new tfrecord file in GCS: ${NEW_TFREC_URL}" + +# Also clean up newly created GCS dir. +NEW_DIR_URL=$(grep "Creating dir" "${LOG_FILE}" | \ + awk '{print $NF}') +if [[ -z ${NEW_DIR_URL} ]]; then + die "FAIL: Unable to determine the URL to the new directory created in GCS." +fi +"${GSUTIL_BIN}" rm -r "${NEW_DIR_URL}" && \ + echo "Cleaned up new directory created in GCS: ${NEW_DIR_URL}" || \ + die "FAIL: Unable to clean up new directory created in GCS: ${NEW_DIR_URL}" diff --git a/tensorflow/tools/gcs_test/python/gcs_smoke.py b/tensorflow/tools/gcs_test/python/gcs_smoke.py index 5db03afb4d..0e0018fc2f 100644 --- a/tensorflow/tools/gcs_test/python/gcs_smoke.py +++ b/tensorflow/tools/gcs_test/python/gcs_smoke.py @@ -19,10 +19,12 @@ from __future__ import print_function import random import sys +import time import numpy as np import tensorflow as tf from tensorflow.core.example import example_pb2 +from tensorflow.python.lib.io import file_io flags = tf.app.flags flags.DEFINE_string("gcs_bucket_url", "", @@ -48,6 +50,25 @@ def create_examples(num_examples, input_mean): examples.append(ex) return examples +def create_dir_test(): + """Verifies file_io directory handling methods .""" + + starttime = int(round(time.time() * 1000)) + dir_name = "%s/tf_gcs_test_%s" % (FLAGS.gcs_bucket_url, starttime) + print("Creating dir %s" % dir_name) + file_io.create_dir(dir_name) + elapsed = int(round(time.time() * 1000)) - starttime + print("Created directory in: %d milliseconds" % elapsed) + # Check that the directory exists. + dir_exists = file_io.is_directory(dir_name) + print("%s directory exists: %s" % (dir_name, dir_exists)) + + # List contents of just created directory. + starttime = int(round(time.time() * 1000)) + print("Listing directory %s." % dir_name) + print(file_io.list_directory(dir_name)) + elapsed = int(round(time.time() * 1000)) - starttime + print("Listed directory %s in %s milliseconds" % (dir_name, elapsed)) if __name__ == "__main__": # Sanity check on the GCS bucket URL. @@ -110,3 +131,5 @@ if __name__ == "__main__": except tf.errors.OutOfRangeError: print("Successfully caught the expected OutOfRangeError while " "reading one more record than is available") + + create_dir_test() |