OpenStack-like notification generator
Project description
notigen
=======
OpenStack-like notification generator.
It works like this: In OpenStack an operation is a series of notifications
connected by a common request_id. For example, to create an instance we would
have the following events:
compute.run_instance.start
scheduler.run_instance.start
scheduler.run_instance.scheduled
scheduler.run_instance.end
compute.instance.update
compute.instance.update
compute.instance.update
compute.instance.update
compute.instance.update
compute.instance.update
compute.run_instance.end
But, since this is a large system, we could have lots of these operations
going on currently. Each operation takes time to perform. So the
notifications generated by these operations are interleaved.
This library simulates these many concurrent operations. You tell
the EventGenerator how many new operations to start per minute
and it will. Note that you'll get a lot more notificationis than
the operations/second (since the operations persist over time in the
future).
The library tries to avoid bad sequences (like doing an update on
a deleted instance), but it can happen in some race conditions.
You can generate in real-time by passing in a real datetime or
you can generate the events as fast as possible by incrementing
a starting time by the tick amount. See the examples below.
To generate events in real-time ...
g = notigen.EventGenerator(100) # Number of operations per minute
now = datetime.datetime.utcnow()
start = now
nevents = 0
while nevents < 10000:
e = g.generate(now)
if e:
nevents += len(e)
now = datetime.datetime.utcnow()
To generate events as fast as possible ...
g = notigen.EventGenerator(100) # Not really relevant
now = datetime.datetime.utcnow()
start = now
nevents = 0
while nevents < 10000:
e = g.generate(now)
if e:
nevents += len(e)
now = g.move_to_next_tick(now)
Datetimes are returned as strings as OpenStack would.
=======
OpenStack-like notification generator.
It works like this: In OpenStack an operation is a series of notifications
connected by a common request_id. For example, to create an instance we would
have the following events:
compute.run_instance.start
scheduler.run_instance.start
scheduler.run_instance.scheduled
scheduler.run_instance.end
compute.instance.update
compute.instance.update
compute.instance.update
compute.instance.update
compute.instance.update
compute.instance.update
compute.run_instance.end
But, since this is a large system, we could have lots of these operations
going on currently. Each operation takes time to perform. So the
notifications generated by these operations are interleaved.
This library simulates these many concurrent operations. You tell
the EventGenerator how many new operations to start per minute
and it will. Note that you'll get a lot more notificationis than
the operations/second (since the operations persist over time in the
future).
The library tries to avoid bad sequences (like doing an update on
a deleted instance), but it can happen in some race conditions.
You can generate in real-time by passing in a real datetime or
you can generate the events as fast as possible by incrementing
a starting time by the tick amount. See the examples below.
To generate events in real-time ...
g = notigen.EventGenerator(100) # Number of operations per minute
now = datetime.datetime.utcnow()
start = now
nevents = 0
while nevents < 10000:
e = g.generate(now)
if e:
nevents += len(e)
now = datetime.datetime.utcnow()
To generate events as fast as possible ...
g = notigen.EventGenerator(100) # Not really relevant
now = datetime.datetime.utcnow()
start = now
nevents = 0
while nevents < 10000:
e = g.generate(now)
if e:
nevents += len(e)
now = g.move_to_next_tick(now)
Datetimes are returned as strings as OpenStack would.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
notigen-0.3.dev36.tar.gz
(56.7 kB
view details)
File details
Details for the file notigen-0.3.dev36.tar.gz
.
File metadata
- Download URL: notigen-0.3.dev36.tar.gz
- Upload date:
- Size: 56.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6bb660728b4670a29bf97c938039980b2139d45a2d3b8f94e07afc094a057af |
|
MD5 | 08e74234dbc375971aacc5ee12872f58 |
|
BLAKE2b-256 | b4ba620fffe8a5ab9bced160af8584744f3a1a34c4eca7e07c5bc9c928bce694 |