-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathssh.py
80 lines (64 loc) · 2.95 KB
/
ssh.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# from pssh.agent import SSHAgent
# from pssh.utils import load_private_key
# from pssh.clients.native.parallel import ParallelSSHClient
# from gevent import joinall
# from pssh.utils import enable_host_logger
import os
# enable_host_logger()
# def run(hosts, command):
# client = ParallelSSHClient(hosts)
# output = client.run_command(command)
# client.join(output, consume_output=True)
# """for host, host_output in output.items():
# print(host, " : ")
# for line in host_output.stdout:
# print(line)
# for line in host_output.stderr:
# print(line)"""
def project_sync(hosts):
for host in hosts:
os.system("rsync -av --exclude='.git/' --exclude='data/' --exclude='models/' --exclude='updates/' -e 'ssh -o StrictHostKeyChecking=no' --delete /root/FL_Architecture/ root@" + host + ":/root/FL_Architecture")
def setup(rsync_hosts, pssh_hosts):
for host in rsync_hosts:
# os.system("rsync /Users/sc134/OneDrive - University of Illinois - Urbana/Distributed_Systems/cs-425-mp2 sc134@" + host + ":/home/sc134/")
# os.system("rsync -r /home/sc134/cs-425-mp3 sc134@" + host + ":/home/sc134/")
os.system("rsync -r /home/raunaks3/cs-425-mp3 raunaks3@" + host + ":/home/raunaks3/")
# run(pssh_hosts, "python3 main.py &")
os.system("python3 main.py")
rsync_hosts = [
# "fa23-cs425-3701.cs.illinois.edu",
"fa23-cs425-3702.cs.illinois.edu",
"fa23-cs425-3703.cs.illinois.edu",
"fa23-cs425-3704.cs.illinois.edu",
"fa23-cs425-3705.cs.illinois.edu",
"fa23-cs425-3706.cs.illinois.edu",
"fa23-cs425-3707.cs.illinois.edu",
"fa23-cs425-3708.cs.illinois.edu",
"fa23-cs425-3709.cs.illinois.edu",
"fa23-cs425-3710.cs.illinois.edu",
]
pssh_hosts = [
# "[email protected]",
"fa23-cs425-3704.cs.illinois.edu",
"fa23-cs425-3705.cs.illinois.edu",
"fa23-cs425-3706.cs.illinois.edu",
"fa23-cs425-3707.cs.illinois.edu",
"fa23-cs425-3708.cs.illinois.edu",
"fa23-cs425-3709.cs.illinois.edu",
"fa23-cs425-3710.cs.illinois.edu",
]
# pssh_hosts = [
# # "[email protected]",
# "[email protected]",
# "[email protected]",
# "[email protected]",
# "[email protected]",
# "[email protected]",
# "[email protected]",
# "[email protected]",
# "[email protected]",
# # "[email protected]",
# ]
setup(rsync_hosts, pssh_hosts)