diff options
author | Dmitry Mescheryakov <dmescheryakov@mirantis.com> | 2016-04-07 15:08:03 +0300 |
---|---|---|
committer | Dmitry Mescheryakov <dmescheryakov@mirantis.com> | 2016-04-07 15:08:03 +0300 |
commit | 09d56695656945da86e634fe49c0bfa3e3090436 (patch) | |
tree | 6175cdc821d9a688967bb7f0e82fd0528222cad8 /tools/simulator.py | |
parent | 7f1aef56976bcc35c5a3d2a5201e97fb4940edc9 (diff) | |
download | oslo-messaging-09d56695656945da86e634fe49c0bfa3e3090436.tar.gz |
Allow simulator to be launched from arbitrary directory
Right now simulator.py expects messages_length.yaml to be in the
current directory and as a result, it is impossible to launch
simulator while you are at the repository root.
The change makes simulator to search for the file in the same
directory as simulator itself is in.
Change-Id: Ic2ca21d87e2d888432dc6204c7b4b995a06aecbd
Diffstat (limited to 'tools/simulator.py')
-rwxr-xr-x | tools/simulator.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/simulator.py b/tools/simulator.py index 0a2af19..0bc4046 100755 --- a/tools/simulator.py +++ b/tools/simulator.py @@ -57,7 +57,8 @@ DISTRIBUTION_BUCKET_SIZE = 500 def init_random_generator(): data = [] - with open('./messages_length.yaml') as m_file: + file_dir = os.path.dirname(os.path.abspath(__file__)) + with open(os.path.join(file_dir, 'messages_length.yaml')) as m_file: content = yaml.safe_load(m_file) data += [int(n) for n in content[ 'test_data']['string_lengths'].split(', ')] |