Skip to content

Commit

Permalink
some tweaks/experiments
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin Normoyle committed Apr 6, 2014
1 parent a7bcea0 commit 5e1b4dd
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 22 deletions.
6 changes: 3 additions & 3 deletions py/testdir_multi_jvm/test_exec_multi_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def execit(n, bucket, path, src_key, hex_key, timeoutSecs=60, retryDelaySecs=1,
h2e.exec_expr(node=h2o.nodes[np1], execExpr=execExpr, timeoutSecs=30)
else:
# flip to one if the prior value is 1 (unless you're the zero case
execExpr = "r%s = (r%s==1) ? 1 : 0;" % (np1, np)
execExpr = "r%s = (r%s==1) ? c(1) : c(0);" % (np1, np)
print "Sending request to node: %s" % h2o.nodes[np1],
(resultExec, fpResult) = h2e.exec_expr(node=h2o.nodes[np1], execExpr=execExpr, timeoutSecs=30)
while fpResult != 1:
Expand Down Expand Up @@ -69,12 +69,12 @@ def test_exec_multi_node(self):
h2o.beta_features = True
for node in h2o.nodes:
# get this key known to this node
execExpr = "r1 = c(0,0); r2 = c(0,0); r3 = c(0,0); r4 = c(0,0)"
execExpr = "r0 = c(0); r1 = c(0); r2 = c(0);"
print "Sending request to node: %s" % node
h2e.exec_expr(node=node, execExpr=execExpr, timeoutSecs=30)

# test the store expression
execExpr = "(r1==0) ? c(0,0) : c(1,1)"
execExpr = "(r1==0) ? c(0) : c(1)"
print "Sending request to node: %s" % node
h2e.exec_expr(node=node, execExpr=execExpr, timeoutSecs=30)

Expand Down
23 changes: 16 additions & 7 deletions py/testdir_multi_jvm/test_exec_multi_node2.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# overrides the calc below if not None
OUTSTANDING = 5
TRIALMAX = 10
TEST_MUX = True
READ_ONLY = True

# problem with keyboard interrupt described
# http://bryceboe.com/2012/02/14/python-multiprocessing-pool-and-keyboardinterrupt-revisited/
Expand All @@ -26,12 +28,18 @@ def execit(n, bucket, path, src_key, hex_key, timeoutSecs=60, retryDelaySecs=1,
# doesn't work cause we can't have racing writers
# execExpr = "r2 = (r2==%s) ? %s+1 : %s" % (np1, np1)
if np == 0:
execExpr = "r%s = c(1,1)" % np1
if READ_ONLY:
execExpr = "(r%s==1) ? c(1) : c(0);" % np
else:
execExpr = "r%s = c(1)" % np1
print "Sending request to node: %s" % h2o.nodes[np1],
h2e.exec_expr(node=h2o.nodes[np1], execExpr=execExpr, timeoutSecs=30)
else:
# flip to one if the prior value is 1 (unless you're the zero case
execExpr = "r%s = (r%s==c(1,1)) ? c(1,1) : c(0,0);" % (np1, np)
if READ_ONLY:
execExpr = "(r%s==1) ? c(1) : c(0);" % np
else:
execExpr = "r%s = (r%s==1) ? c(1) : c(0);" % (np1, np)
print "Sending request to node: %s" % h2o.nodes[np1],
(resultExec, fpResult) = h2e.exec_expr(node=h2o.nodes[np1], execExpr=execExpr, timeoutSecs=30)
while fpResult != 1:
Expand Down Expand Up @@ -70,14 +78,15 @@ def test_exec_multi_node2(self):
h2o.beta_features = True
for node in h2o.nodes:
# get this key known to this node
execExpr = "r1 = c(0,0); r2 = c(0,0); r3 = c(0,0); r4 = c(0,0)"
execExpr = "r0=c(0); r1 = c(0); r2 = c(0);"
print "Sending request to node: %s" % node
h2e.exec_expr(node=node, execExpr=execExpr, timeoutSecs=30)

# test the store expression
execExpr = "(r1==c(0,0)) ? c(0,0) : c(1,1)"
print "Sending request to node: %s" % node
h2e.exec_expr(node=node, execExpr=execExpr, timeoutSecs=30)
if TEST_MUX:
# test the store expression
execExpr = "(r1==0) ? c(0) : c(1)"
print "Sending request to node: %s" % node
h2e.exec_expr(node=node, execExpr=execExpr, timeoutSecs=30)

global OUTSTANDING
if not OUTSTANDING:
Expand Down
28 changes: 16 additions & 12 deletions py/testdir_multi_jvm/test_exec_multi_node3.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
OUTSTANDING = 5
TRIALMAX = 10
INIT_ONLY = False
TEST_MUX_STORE = False
INIT_MANY = False

# problem with keyboard interrupt described
# http://bryceboe.com/2012/02/14/python-multiprocessing-pool-and-keyboardinterrupt-revisited/
Expand All @@ -30,18 +32,19 @@ def execit(n, bucket, path, src_key, hex_key, timeoutSecs=60, retryDelaySecs=1,
print "Do Nothing"
return hex_key

for j in range(3):
for j in range(1):
execExpr = "(r%s==c(1,1)) ? c(1,1) : c(0,0);" % np
print "Sending request to node: %s" % h2o.nodes[np1],
(resultExec, fpResult) = h2e.exec_expr(node=h2o.nodes[np1], execExpr=execExpr, timeoutSecs=30)

execExpr = "(r%s==c(1,1)) ? c(1,1) : c(0,0);" % np1
print "Sending request to node: %s" % h2o.nodes[np1],
(resultExec, fpResult) = h2e.exec_expr(node=h2o.nodes[np1], execExpr=execExpr, timeoutSecs=30)
if INIT_MANY:
execExpr = "(r%s==c(1,1)) ? c(1,1) : c(0,0);" % np1
print "Sending request to node: %s" % h2o.nodes[np1],
(resultExec, fpResult) = h2e.exec_expr(node=h2o.nodes[np1], execExpr=execExpr, timeoutSecs=30)

execExpr = "(r%s==c(1,1)) ? c(1,1) : c(0,0);" % np2
print "Sending request to node: %s" % h2o.nodes[np1],
(resultExec, fpResult) = h2e.exec_expr(node=h2o.nodes[np1], execExpr=execExpr, timeoutSecs=30)
execExpr = "(r%s==c(1,1)) ? c(1,1) : c(0,0);" % np2
print "Sending request to node: %s" % h2o.nodes[np1],
(resultExec, fpResult) = h2e.exec_expr(node=h2o.nodes[np1], execExpr=execExpr, timeoutSecs=30)

return hex_key

Expand Down Expand Up @@ -73,17 +76,18 @@ def tearDownClass(cls):
def test_exec_multi_node3(self):
h2o.beta_features = True

for initTrial in range(2):
for initTrial in range(1):
for node in h2o.nodes:
# get this key known to this node
execExpr = "r0 = c(0,0); r1 = c(0,0); r2 = c(0,0);"
print "Sending request to node: %s" % node
h2e.exec_expr(node=node, execExpr=execExpr, timeoutSecs=30)

# test the store expression
execExpr = "(r1==c(0,0)) ? c(0,0) : c(1,1)"
print "Sending request to node: %s" % node
h2e.exec_expr(node=node, execExpr=execExpr, timeoutSecs=30)
if TEST_MUX_STORE:
# test the store expression
execExpr = "(r1==c(0,0)) ? c(0,0) : c(1,1)"
print "Sending request to node: %s" % node
h2e.exec_expr(node=node, execExpr=execExpr, timeoutSecs=30)

global OUTSTANDING
if not OUTSTANDING:
Expand Down

0 comments on commit 5e1b4dd

Please sign in to comment.