Fix multihop
authorLucia Guevgeozian Odizzio <lucia.guevgeozian_odizzio@inria.fr>
Thu, 22 May 2014 13:55:40 +0000 (15:55 +0200)
committerLucia Guevgeozian Odizzio <lucia.guevgeozian_odizzio@inria.fr>
Thu, 22 May 2014 13:55:40 +0000 (15:55 +0200)
examples/linux/multihop_ssh.py
src/nepi/resources/linux/application.py
src/nepi/resources/linux/node.py
src/nepi/util/sshfuncs.py

index a141fab..8bcd47f 100755 (executable)
@@ -27,7 +27,7 @@ ec = ExperimentController(exp_id)
 
 # server
 node1 = ec.register_resource("LinuxNode")
-ec.set(node1, "hostname", "wlab19.")
+ec.set(node1, "hostname", "wlab29.")
 ec.set(node1, "username", "root")
 ec.set(node1, "gatewayUser", "etourdi")
 ec.set(node1, "gateway", "etourdi.pl.sophia.inria.fr")
@@ -46,7 +46,7 @@ ec.set(node2, "cleanProcesses", True)
 app1 = ec.register_resource("LinuxApplication")
 video= "../big_buck_bunny_240p_mpeg4_lq.ts"
 ec.set(app1, "sources", video)
-command = "cat ${SRC}/big_buck_bunny_240p_mpeg4_lq.ts| nc wlab5 1234" 
+command = "cat ${SRC}/big_buck_bunny_240p_mpeg4_lq.ts| nc wlab5. 1234" 
 ec.set(app1, "command", command)
 ec.register_connection(app1, node1)
 
index 45efd21..af6ae34 100644 (file)
@@ -282,10 +282,11 @@ class LinuxApplication(ResourceManager):
             procs = dict()
             ps_aux = "ps aux |awk '{print $2,$11}'"
             (out, err), proc = self.node.execute(ps_aux)
-            for line in out.strip().split("\n"):
-                parts = line.strip().split(" ")
-                procs[parts[0]] = parts[1]
-            pickle.dump(procs, open("/tmp/save.proc", "wb"))
+            if len(out) != 0:
+                for line in out.strip().split("\n"):
+                    parts = line.strip().split(" ")
+                    procs[parts[0]] = parts[1]
+                pickle.dump(procs, open("/tmp/save.proc", "wb"))
             
         # create run dir for application
         self.node.mkdir(self.run_home)
index 6de7cd9..01a1d40 100644 (file)
@@ -418,15 +418,19 @@ class LinuxNode(ResourceManager):
                 pids_temp = dict()
                 ps_aux = "ps aux |awk '{print $2,$11}'"
                 (out, err), proc = self.execute(ps_aux)
-                for line in out.strip().split("\n"):
-                    parts = line.strip().split(" ")
-                    pids_temp[parts[0]] = parts[1]
-                kill_pids = set(pids_temp.items()) - set(pids.items())
-                kill_pids = ' '.join(dict(kill_pids).keys())
-
-                cmd = ("killall tcpdump || /bin/true ; " +
-                    "kill $(ps aux | grep '[n]epi' | awk '{print $2}') || /bin/true ; " +
-                    "kill %s || /bin/true ; " % kill_pids)
+                if len(out) != 0:
+                    for line in out.strip().split("\n"):
+                        parts = line.strip().split(" ")
+                        pids_temp[parts[0]] = parts[1]
+                    kill_pids = set(pids_temp.items()) - set(pids.items())
+                    kill_pids = ' '.join(dict(kill_pids).keys())
+
+                    cmd = ("killall tcpdump || /bin/true ; " +
+                        "kill $(ps aux | grep '[n]epi' | awk '{print $2}') || /bin/true ; " +
+                        "kill %s || /bin/true ; " % kill_pids)
+                else:
+                    cmd = ("killall tcpdump || /bin/true ; " +
+                        "kill $(ps aux | grep '[n]epi' | awk '{print $2}') || /bin/true ; ")
             else:
                 cmd = ("killall tcpdump || /bin/true ; " +
                     "kill $(ps aux | grep '[n]epi' | awk '{print $2}') || /bin/true ; ")
index 9a416ae..b06abdb 100644 (file)
@@ -252,9 +252,9 @@ def rexec(command, host, user,
 
     if gw:
         if gwuser:
-            proxycommand = 'ProxyCommand=ssh %s@%s -W %%h:%%p' % (gwuser, gw)
+            proxycommand = 'ProxyCommand=ssh -q %s@%s -W %%h:%%p' % (gwuser, gw)
         else:
-            proxycommand = 'ProxyCommand=ssh %%r@%s -W %%h:%%p' % gw
+            proxycommand = 'ProxyCommand=ssh -q %%r@%s -W %%h:%%p' % gw
         args.extend(['-o', proxycommand])
 
     if agent:
@@ -347,9 +347,9 @@ def rcopy(source, dest,
 
     if gw:
         if gwuser:
-            proxycommand = 'ProxyCommand=ssh %s@%s -W %%h:%%p' % (gwuser, gw)
+            proxycommand = 'ProxyCommand=ssh -q %s@%s -W %%h:%%p' % (gwuser, gw)
         else:
-            proxycommand = 'ProxyCommand=ssh %%r@%s -W %%h:%%p' % gw
+            proxycommand = 'ProxyCommand=ssh -q %%r@%s -W %%h:%%p' % gw
         args.extend(['-o', proxycommand])
 
     if recursive: