Skip to content

Commit

Permalink
Add test call to file_io.delete_recursively.
Browse files Browse the repository at this point in the history
  • Loading branch information
anand-c-goog committed Oct 21, 2016
1 parent c1beb00 commit decbc26
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
11 changes: 0 additions & 11 deletions tensorflow/tools/gcs_test/gcs_smoke_wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ fi
cat ${LOG_FILE}
echo ""


# Clean up the newly created tfrecord file in GCS bucket.
# First, activate gcloud service account
"${GCLOUD_BIN}" auth activate-service-account \
Expand All @@ -96,13 +95,3 @@ 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}"

# 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}"
10 changes: 8 additions & 2 deletions tensorflow/tools/gcs_test/python/gcs_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

FLAGS = flags.FLAGS


def create_examples(num_examples, input_mean):
"""Create ExampleProto's containg data."""
ids = np.arange(num_examples).reshape([num_examples, 1])
Expand Down Expand Up @@ -64,12 +63,19 @@ def create_dir_test():
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)
starttime = int(round(time.time() * 1000))
print(file_io.list_directory(dir_name))
elapsed = int(round(time.time() * 1000)) - starttime
print("Listed directory %s in %s milliseconds" % (dir_name, elapsed))

# Delete directory.
print("Deleting directory %s." % dir_name)
starttime = int(round(time.time() * 1000))
file_io.delete_recursively(dir_name)
elapsed = int(round(time.time() * 1000)) - starttime
print("Deleted directory %s in %s milliseconds" % (dir_name, elapsed))

if __name__ == "__main__":
# Sanity check on the GCS bucket URL.
if not FLAGS.gcs_bucket_url or not FLAGS.gcs_bucket_url.startswith("gs://"):
Expand Down

0 comments on commit decbc26

Please sign in to comment.