Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

adding an env for the location of the python interpreter to use with …

…dashi
  • Loading branch information...
commit 69ee781d7436c6f8fe2f009d1cb75f286b066300 1 parent 5f25c30
bresnaha authored
View
113 scale_scripts/concur_pingpong.py
@@ -1,113 +0,0 @@
-import socket
-import sys
-from threading import Timer
-from threading import Thread
-from dashi import bootstrap
-import datetime
-import simplejson as json
-
-class DashiConcurScalePonger(object):
-
- def __init__(self, CFG):
- self.CFG = CFG
- self.dashi = bootstrap.dashi_connect(CFG.test.ponger_name, CFG)
- self.done = False
- self.dashi.handle(self.ping, "ping")
- self.dashi.handle(self.final_msg, "final_msg")
-
- def ping(self, from_name=None):
- #print "ponging to %s" % (from_name)
- self.dashi.fire(from_name, "pong")
-
- def final_msg(self):
- print "received final message"
- self.done = True
- sys.exit(0)
-
- def go(self):
- while not self.done:
- try:
- self.dashi.consume()
- except socket.timeout, ex:
- pass
-
-
-class DashiConcurScalePinger(Thread):
-
- def __init__(self, CFG, cnt):
- Thread.__init__(self)
- self._myname = CFG.test.pinger_name + "_" + str(cnt)
- self.CFG = CFG
- self.dashi = bootstrap.dashi_connect(self._myname, CFG)
- self.done = False
- self.end_time = None
- self.start_time = None
- self.message_count = 0
- self.dashi.handle(self.pong, "pong")
- self.timer = Timer(float(CFG.test.runtime), self.timeout)
-
- def run(self):
- self.go()
-
- def go(self):
- self.timer.start()
- #print "sending first ping to %s" % (self.CFG.test.ponger_name)
- self.dashi.fire(self.CFG.test.ponger_name, "ping", from_name=self._myname)
- while not self.done:
- try:
- self.dashi.consume(count=1, timeout=10)
- except socket.timeout, ex:
- pass
-
- def timeout(self):
- self.end_time = datetime.datetime.now()
- self.done = True
-
- def pong(self):
- #print "got pong"
- self.message_count = self.message_count + 1
- self.dashi.fire(self.CFG.test.ponger_name, "ping", from_name=self._myname)
-
-
-def main(argv):
- CFG = bootstrap.configure(argv=argv)
-
- if CFG.test.type == "ping":
- sender_count = int(CFG.test.concur)
- print "sender count %d" % (sender_count)
- thrs = []
- start_time = datetime.datetime.now()
- for i in range(0, sender_count):
- sender = DashiConcurScalePinger(CFG, i)
- thrs.append(sender)
- sender.start()
-
- msg_count_total = 0
- for t in thrs:
- t.join()
- msg_count_total = msg_count_total + t.message_count
- end_time = datetime.datetime.now()
-
- tm = end_time - start_time
- preci = float(tm.microseconds) / 1000000.0
- runtime = tm.seconds + preci
-
- res = {}
- res['testname'] = "concurtest"
- res['message_count'] = msg_count_total
- res['runtime'] = runtime
- res['process_type'] = "pinger"
- res['connection_count'] = len(thrs)
- print "JSON: %s" % (json.dumps(res))
- else:
- print "ponger go"
- receiver = DashiConcurScalePonger(CFG)
- receiver.go()
-
-
-
-if __name__ == '__main__':
- print "start"
- rc = main(sys.argv)
- print "exit"
- sys.exit(rc)
View
96 scale_scripts/pingpong.py
@@ -1,96 +0,0 @@
-import socket
-import sys
-from threading import Timer
-import threading
-from dashi import bootstrap
-import datetime
-import simplejson as json
-
-class DashiScalePonger(object):
-
- def __init__(self, CFG):
- self.CFG = CFG
- self.dashi = bootstrap.dashi_connect(CFG.test.ponger_name, CFG)
- self.done = False
- self.dashi.handle(self.ping, "ping")
- self.dashi.handle(self.final_msg, "final_msg")
-
- def ping(self):
- self.dashi.fire(self.CFG.test.pinger_name, "pong")
-
- def final_msg(self):
- print "received final message"
- self.done = True
- sys.exit(0)
-
- def go(self):
- while not self.done:
- try:
- self.dashi.consume()
- except socket.timeout, ex:
- pass
-
-
-class DashiScalePinger(object):
-
- def __init__(self, CFG):
- self.CFG = CFG
- self.dashi = bootstrap.dashi_connect(CFG.test.pinger_name, CFG)
- self.done = False
- self.end_time = None
- self.start_time = None
- self.message_count = 0
- self.dashi.handle(self.pong, "pong")
- self.timer = Timer(float(CFG.test.runtime), self.timeout)
-
- def go(self):
- self.timer.start()
- self.start_time = datetime.datetime.now()
- print "sending first ping"
- self.dashi.fire(self.CFG.test.ponger_name, "ping")
- while not self.done:
- try:
- self.dashi.consume(count=1, timeout=2)
- except socket.timeout, ex:
- pass
- print "sending final message"
- self.dashi.fire(self.CFG.test.ponger_name, "final_msg")
-
- def timeout(self):
- self.end_time = datetime.datetime.now()
- self.done = True
-
- def pong(self):
- self.message_count = self.message_count + 1
- self.dashi.fire(self.CFG.test.ponger_name, "ping")
-
- def get_results(self):
- tm = self.end_time - self.start_time
- preci = float(tm.microseconds) / 1000000.0
- tm = tm.seconds + preci
- res = {}
- res['testname'] = self.CFG.test.name
- res['message_count'] = self.message_count
- res['runtime'] = tm
- res['process_type'] = "pinger"
-
- return res
-
-def main(argv):
- CFG = bootstrap.configure(argv=argv)
-
- if CFG.test.type == "ping":
- sender = DashiScalePinger(CFG)
- sender.go()
- res = sender.get_results()
- print "JSON: %s" % (json.dumps(res))
- else:
- receiver = DashiScalePonger(CFG)
- receiver.go()
-
-
-
-if __name__ == '__main__':
- rc = main(sys.argv)
- print "exit"
- sys.exit(rc)
View
2  scale_scripts/run_call_pingpong.sh
@@ -11,7 +11,7 @@ mkdir $out_dir
out_file=$out_dir/pingpong.data
l_conf_file=`pwd`/ping.yml
r_conf_file=/tmp/conf.yml
-py=/home/bresnaha/DASHITESTS/bin/python
+py=$DASHITESTS_PY
l_pgm_file=`pwd`/call_pingpong.py
r_pgm_file=/tmp/call_pingpong.py
View
2  scale_scripts/run_concur_pingpong.sh
@@ -11,7 +11,7 @@ mkdir $out_dir
out_file=$out_dir/pingpong.data
l_conf_file=`pwd`/ping.yml
r_conf_file=/tmp/conf.yml
-py=/home/bresnaha/DASHITESTS/bin/python
+py=$DASHITESTS_PY
l_pgm_file=`pwd`/concur_pingpong.py
r_pgm_file=/tmp/concur_pingpong.py
View
2  scale_scripts/run_pingpong.sh
@@ -11,7 +11,7 @@ mkdir $out_dir
out_file=$out_dir/pingpong.data
l_conf_file=`pwd`/ping.yml
r_conf_file=/tmp/conf.yml
-py=/home/bresnaha/DASHITESTS/bin/python
+py=$DASHITESTS_PY
l_pgm_file=`pwd`/pingpong.py
r_pgm_file=/tmp/pingpong.py
View
2  scale_scripts/run_throughput_all.sh
@@ -9,7 +9,7 @@ mkdir $out_dir
out_file=$out_dir/throughput.size.data
l_conf_file=`pwd`/conf.yml
r_conf_file=/tmp/conf.yml
-py=/home/bresnaha/DASHITESTS/bin/python
+py=$DASHITESTS_PY
l_pgm_file=`pwd`/throughput.py
r_pgm_file=/tmp/throughput.py
View
2  scale_scripts/run_throughput_entry_count.sh
@@ -9,7 +9,7 @@ mkdir $out_dir
out_file=$out_dir/throughput.size.data
l_conf_file=`pwd`/conf.yml
r_conf_file=/tmp/conf.yml
-py=/home/bresnaha/DASHITESTS/bin/python
+py=$DASHITESTS_PY
l_pgm_file=`pwd`/throughput.py
r_pgm_file=/tmp/throughput.py
View
2  scale_scripts/run_throughput_entry_size.sh
@@ -9,7 +9,7 @@ mkdir $out_dir
out_file=$out_dir/throughput.size.data
l_conf_file=`pwd`/conf.yml
r_conf_file=/tmp/conf.yml
-py=/home/bresnaha/pycharmVE/bin/python
+py=$DASHITESTS_PY
l_pgm_file=`pwd`/throughput.py
r_pgm_file=/tmp/throughput.py
Please sign in to comment.
Something went wrong with that request. Please try again.