Exemplo n.º 1
0
 def test_parallel(self):
     m = Cluster(local, local)
     import time
     t = time.time()
     ret = m["sleep"]("2")
     assert (len(ret) == 2)
     assert (2 <= time.time() - t < 4)
Exemplo n.º 2
0
 def test_sessions(self):
     m = Cluster(local, self.connect(), local, self.connect())
     # we should get 4 different proc ids
     ret, stdout, stderr = m.session().run("echo $$")
     ret = [int(pid) for pid in stdout]
     assert len(set(ret)) == 4
Exemplo n.º 3
0
 def test_locals(self):
     m = Cluster(local, local, local)
     # we should get 3 different proc ids
     ret = m["bash"]["-c"]["echo $$"]()
     ret = list(map(int, ret))
     assert len(set(ret)) == 3
Exemplo n.º 4
0
 def test_sessions(self):
     m = Cluster(local, self.connect(), local, self.connect())
     # we should get 4 different proc ids
     ret, stdout, stderr = m.session().run("echo $$")
     ret = [int(pid) for pid in stdout]
     assert(len(set(ret))==4)