Beispiel #1
0
import Scarab
import sys
import time
import string

if len(sys.argv) != 2 and len(sys.argv) != 3:
	raise "usage error", "usage: tim-echo URL [COUNT]"

connection = Scarab.connect_to(sys.argv[1])
if len(sys.argv) == 3:
    count = int(sys.argv[2])
else:
    count = 1000

t1 = time.time()
for ii in range(count):
	connection.call('root', 'echo', ['testing'])
total_time = time.time() - t1
ms = (float(total_time) / float(count)) * 1000.0
print "%d calls in %d seconds, %.2fms/call" % (count, total_time, ms )
Beispiel #2
0
import Scarab
import sys
import time
import string
import regex

if len(sys.argv) < 4:
	raise "usage error", "usage: scarab URL OBJECT METHOD [ARGS ...]"

scarab_url = sys.argv[1]
object = sys.argv[2]
method = sys.argv[3]

# Convert the argument list into procedure parameters
arglist = []
for arg in sys.argv[4:]:
	if regex.match("^\s*['\"p({]", arg) != -1:
		arglist.append(eval(arg))
	else:
		arglist.append(arg)

# open a connection to the server
connection = Scarab.connect_to(scarab_url)

# call the method on the remote server
result = connection.call(object, method, arglist)
print result
Beispiel #3
0
import Scarab
import sys
import time
import string

if len(sys.argv) != 2 and len(sys.argv) != 3:
    raise "usage error", "usage: tim-echo URL [COUNT]"

connection = Scarab.connect_to(sys.argv[1])
if len(sys.argv) == 3:
    count = int(sys.argv[2])
else:
    count = 1000

t1 = time.time()
for ii in range(count):
    connection.call('root', 'echo', ['testing'])
total_time = time.time() - t1
ms = (float(total_time) / float(count)) * 1000.0
print "%d calls in %d seconds, %.2fms/call" % (count, total_time, ms)
Beispiel #4
0
# Echo has one method, `echo'.  `echo' returns it's first argument
# back to the caller.


class Echo:
    def echo(self, string):
        return string


# Echo server program
import Scarab

server = Scarab.server_on()
server.globals['root'] = Echo()

print "Server listening on: " + server.url

server.run_loop()
Beispiel #5
0
# Echo has one method, `echo'.  `echo' returns it's first argument
# back to the caller.

class Echo:

	def echo(self, string):
		return string

# Echo server program
import Scarab

server = Scarab.server_on()
server.globals['root'] = Echo()

print "Server listening on: " + server.url

server.run_loop()