Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1108)

Unified Diff: tools/telemetry/third_party/gsutil/third_party/boto/bin/dynamodb_dump

Issue 1260493004: Revert "Add gsutil 4.13 to telemetry/third_party" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/third_party/gsutil/third_party/boto/bin/dynamodb_dump
diff --git a/tools/telemetry/third_party/gsutil/third_party/boto/bin/dynamodb_dump b/tools/telemetry/third_party/gsutil/third_party/boto/bin/dynamodb_dump
deleted file mode 100644
index 8b6aada77b81f2c5df0dcc3c005225b3d67c247c..0000000000000000000000000000000000000000
--- a/tools/telemetry/third_party/gsutil/third_party/boto/bin/dynamodb_dump
+++ /dev/null
@@ -1,75 +0,0 @@
-#!/usr/bin/env python
-
-import argparse
-import errno
-import os
-
-import boto
-from boto.compat import json
-
-
-DESCRIPTION = """Dump the contents of one or more DynamoDB tables to the local filesystem.
-
-Each table is dumped into two files:
- - {table_name}.metadata stores the table's name, schema and provisioned
- throughput.
- - {table_name}.data stores the table's actual contents.
-
-Both files are created in the current directory. To write them somewhere else,
-use the --out-dir parameter (the target directory will be created if needed).
-"""
-
-
-def dump_table(table, out_dir):
- metadata_file = os.path.join(out_dir, "%s.metadata" % table.name)
- data_file = os.path.join(out_dir, "%s.data" % table.name)
-
- with open(metadata_file, "w") as metadata_fd:
- json.dump(
- {
- "name": table.name,
- "schema": table.schema.dict,
- "read_units": table.read_units,
- "write_units": table.write_units,
- },
- metadata_fd
- )
-
- with open(data_file, "w") as data_fd:
- for item in table.scan():
- # JSON can't serialize sets -- convert those to lists.
- data = {}
- for k, v in item.iteritems():
- if isinstance(v, (set, frozenset)):
- data[k] = list(v)
- else:
- data[k] = v
-
- data_fd.write(json.dumps(data))
- data_fd.write("\n")
-
-
-def dynamodb_dump(tables, out_dir):
- try:
- os.makedirs(out_dir)
- except OSError as e:
- # We don't care if the dir already exists.
- if e.errno != errno.EEXIST:
- raise
-
- conn = boto.connect_dynamodb()
- for t in tables:
- dump_table(conn.get_table(t), out_dir)
-
-
-if __name__ == "__main__":
- parser = argparse.ArgumentParser(
- prog="dynamodb_dump",
- description=DESCRIPTION
- )
- parser.add_argument("--out-dir", default=".")
- parser.add_argument("tables", metavar="TABLES", nargs="+")
-
- namespace = parser.parse_args()
-
- dynamodb_dump(namespace.tables, namespace.out_dir)

Powered by Google App Engine
This is Rietveld 408576698