Skip to content

Instantly share code, notes, and snippets.

@daniel-garcia
Created June 7, 2012 23:25
Show Gist options
  • Save daniel-garcia/2892328 to your computer and use it in GitHub Desktop.
Save daniel-garcia/2892328 to your computer and use it in GitHub Desktop.
#!/usr/bin/env zendmd
import uuid
import time
from MySQLdb import cursors
MAX_CHANGES = 10000
total_changes = 0
start_changes = time.time()
for d in dmd.Devices.getSubDevicesGen():
for comp in d.getDeviceComponents():
comp._random_attribute = str(uuid.uuid1())
total_changes += 1
# TODO: use setTitle() here to perform indexing
d._random_attribute = str(uuid.uuid1())
total_changes += 1
if total_changes > MAX_CHANGES:
break
elapsed_changes = time.time() - start_changes
print "Elapsed time in performing changes: %s" % elapsed_changes
commit()
elapsed_commit = time.time() - start_commit
print "Elapsed time in commit: %s" % elapsed_commit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment