Skip to content

Instantly share code, notes, and snippets.

@queertypes
Created January 21, 2014 21:30
Show Gist options
  • Save queertypes/8548791 to your computer and use it in GitHub Desktop.
Save queertypes/8548791 to your computer and use it in GitHub Desktop.
import random
import time
import uuid
import pyrax
pyrax.set_credential_file('/whatever')
pyrax.queues.client_id = str(uuid.uuid4())
pid_gen = lambda: str(random.randint(1, 999999))
while True:
project = pid()
body = {'start': 1, 'end': 2, 'type': 'usage', 'total': 100,
'project_id': project, 'event_id': str(uuid.uuid4()),
'data_center': 'ORD1'}
print('Posting on behalf of %s' % project)
pyrax.queues.post_message('tasks', ttl=120, body=body)
@queertypes
Copy link
Author

Needs time.sleep(1) above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment