Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- node_list = {'cn000': 28, 'cn001': 28}
- children, pid = [], 0
- for node, ntasks in nnode_list.items():
- pid_range = range(pid, pid + ntasks)
- pid += ntasks
- for worker in pid_range:
- chile = pexpect.spawn(worker_command % worker)
- children.append(child)
- from pexpect import pxssh
- from socket import gethostname
- from getpass import getuser
- connections, pid = [], 0
- for node, ntasks in node_list.items():
- pid_range = range(pid, pid + ntasks)
- pid += ntasks
- if node == gethostname():
- children = []
- for worker in pid_range:
- child = pexpect.spawn(worker_command % worker)
- children.append(child)
- connections.append(children)
- if node != gethostname():
- ssh = pxssh.pxssh()
- ssh.login(node, getuser())
- for worker in pid_range:
- ssh.sendline(worker_command % worker)
- connections.append(ssh)
Add Comment
Please, Sign In to add comment