forked from linhbngo/cluster-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofile.py
71 lines (57 loc) · 2.4 KB
/
profile.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
# Import the Portal object.
import geni.portal as portal
# Import the ProtoGENI library.
import geni.rspec.pg as pg
import geni.rspec.igext as IG
# Create a portal context.
pc = portal.Context()
# Create a Request object to start building the RSpec.
request = pc.makeRequestRSpec()
tourDescription = \
"""
This profile provides the template for a full research cluster with head node, scheduler, compute nodes, and shared file systems.
First node (head) should contain:
- Shared home directory using Networked File System
- Management server for SLURM
Second node (metadata) should contain:
- Metadata server for SLURM
Third node (storage):
- Shared software directory (/software) using Networked File System
Remaining three nodes (computing):
- Compute nodes
"""
#
# Setup the Tour info with the above description and instructions.
#
tour = IG.Tour()
tour.Description(IG.Tour.TEXT,tourDescription)
request.addTour(tour)
prefixForIP = "192.168.1."
link = request.LAN("lan")
for i in range(6):
if i == 0:
node = request.XenVM("head")
node.routable_control_ip = "true"
elif i == 1:
node = request.XenVM("metadata")
elif i == 2:
node = request.XenVM("storage")
else:
node = request.XenVM("compute-" + str(i-2))
node.cores = 16
node.ram = 4096
node.disk_image = "urn:publicid:IDN+emulab.net+image+emulab-ops:CENTOS7-64-STD"
iface = node.addInterface("if" + str(i))
iface.component_id = "eth1"
iface.addAddress(pg.IPv4Address(prefixForIP + str(i + 1), "255.255.255.0"))
link.addInterface(iface)
node.addService(pg.Execute(shell="sh", command="sudo chmod 755 /local/repository/passwordless.sh"))
node.addService(pg.Execute(shell="sh", command="sudo /local/repository/passwordless.sh"))
node.addService(pg.Execute(shell="sh", command="sudo chmod 755 /local/repository/install_mpi.sh"))
node.addService(pg.Execute(shell="sh", command="sudo /local/repository/install_mpi.sh"))
# This code segment is added per Benjamin Walker's solution to address the StrictHostKeyCheck issue of ssh
# node.addService(pg.Execute(shell="sh", command="sudo chmod 755 /local/repository/ssh_setup.sh"))
# node.addService(pg.Execute(shell="sh", command="sudo -H -u lngo bash -c '/local/repository/ssh_setup.sh'"))
node.addService(pg.Execute(shell="sh", command="sudo su lngo -c 'cp /local/repository/source/* /users/lngo'"))
# Print the RSpec to the enclosing page.
pc.printRequestRSpec(request)