Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add script to generate partition ids.

  • Loading branch information...
commit b373eaab5918488292075c962f4374dc8815c395 1 parent 46a5b4d
@jkreps jkreps authored
Showing with 32 additions and 0 deletions.
  1. +32 −0 test/integration/generate_partitions.py
View
32 test/integration/generate_partitions.py
@@ -0,0 +1,32 @@
+import sys
+import random
+
+if len(sys.argv) != 3:
+ print >> sys.stderr, "USAGE: python generate_partitions.py nodes partitions_per_node"
+ sys.exit()
+
+FORMAT_WIDTH = 10
+
+nodes = int(sys.argv[1])
+partitions = int(sys.argv[2])
+
+ids = range(nodes * partitions)
+
+# use known seed so this is repeatable
+random.seed(92873498274)
+random.shuffle(ids)
+
+for i in xrange(nodes):
+ print
+ print 'node', i
+ print '<partitions>'
+ print ' ',
+ node_ids = sorted(ids[i*partitions:(i+1)*partitions])
+ for j in xrange(len(node_ids)):
+ print str(node_ids[j]) + ',',
+ if j % FORMAT_WIDTH == FORMAT_WIDTH - 1:
+ print
+ print ' ',
+ print '</partitions>'
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.