-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofile.py
59 lines (46 loc) · 1.91 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
"""OCT Alveo V70 profile with post-boot script.
"""
# Import the Portal object.
import geni.portal as portal
# Import the ProtoGENI library.
# Import the Portal object.
import geni.portal as portal
# Import the ProtoGENI library.
import geni.rspec.pg as pg
# We use the URN library below.
import geni.urn as urn
# Emulab extension
import geni.rspec.emulab
# Create a portal context.
pc = portal.Context()
# Create a Request object to start building the RSpec.
request = pc.makeRequestRSpec()
# Pick your image.
imageList = [('urn:publicid:IDN+emulab.net+image+emulab-ops//UBUNTU20-64-STD', 'UBUNTU 20.04'),
('urn:publicid:IDN+emulab.net+image+emulab-ops//UBUNTU22-64-STD', 'UBUNTU 22.04')]
dockerImageList = [('pytorch'), ('tensorflow'), ('tensorflow2')]
pc.defineParameter("osImage", "Select Image",
portal.ParameterType.IMAGE,
imageList[0], imageList,
longDescription="Supported operating systems are Ubuntu and CentOS.")
pc.defineParameter("dockerImage", "Docker Image",
portal.ParameterType.STRING,
dockerImageList[0], dockerImageList,
longDescription="Supported docker images.")
# Retrieve the values the user specifies during instantiation.
params = pc.bindParameters()
pc.verifyParameters()
# Process nodes, adding to FPGA network
# Create a node and add it to the request
name = "node"
node = request.RawPC(name)
node.disk_image = params.osImage
# Assign to the node hosting the FPGA.
node.hardware_type = "fpga-r760-v70"
# Set Storage
#node.disk = 40
bs = node.Blockstore("bs", "/docker")
bs.size = "80GB"
node.component_manager_id = "urn:publicid:IDN+cloudlab.umass.edu+authority+cm"
node.addService(pg.Execute(shell="bash", command="sudo /local/repository/post-boot.sh " + params.dockerImage + " >> /local/repository/output_log.txt"))
pc.printRequestRSpec(request)