38 cloudFPGA Support Package (cfsp)
39 cfsp is a command-line tool that helps a cloudFPGA user to work with cloudFPGA Resource Manager (cFRM).
41 cfsp [-c CFGFILE] [--version] [--help] [--username=<username>] [--password=<password>] [--project=<project>]
42 [--image_id=<image_id>]...
43 [--node_ip=<node_ip>]...
44 [--node_id=<node_id>]...
45 [--cluster_id=<cluster_id>]
46 [--image_file=<image_file>] [--comment=<comment>] [--sig_file=<sig_file>] [--pr_verify_rpt=<pr_verify_rpt] [--dont_verify_memory=<dont_verify_memory>]
47 [--limit=<limit>] [--repeat=<repeat>]
48 [<command>] [<args>...]
51 user Adding or showing the credentials of a user.
52 cluster Creating, showing and deleting clusters.
53 image Uploading, showing and deleting FPGA images.
54 instance Creating, showing and deleting instances.
55 debug Requests and returns the status information of all instances in acluster.
58 -h --help Show this screen.
59 -v --version Show version.
60 -c --config CFGFILE Specify the configfile that rsnapshot should use
61 [default: ./user.json]
62 --username=<username> Your ZYC2 username [default: username_example].
63 --password=<password> Your ZYC2 password [default: password_example].
64 --project=<password> The user's project [default: project_example].
65 --image_id=<image_id> The id of the uploaded FPGA image, or NON_FPGA for a CPU VM node.
66 --node_ip=<node_ip> The ip of the user's VM, e.g. a ZYC2 VM.
67 --node_id=<node_id> The id (rank) of either the VPN user's VM or FPGAs.
68 --cluster_id=<cluster_id> The id of a cluster to update or extend.
69 --image_file=<image_file> The FPGA image file to be uploaded [default: ./image.bit].
70 --comment=<comment> A comment for the FPGA image file to be uploaded [default: None].
71 --sig_file=<sig_file> An FPGA bitstream signature file containing hashes from the build process.
72 --pr_verify_rpt=<pr_verify_rpt An FPGA report containing the output of the automatically run pr_verify command.
73 --dont_verify_memory=<dont_verify_memory> If 1, don't verify the DDR4 memory during setup [default: 0].
74 --limit=<limit> The limit of get for clusters, images, instances [default: 100].
75 --repeat=<repeat> The numper of times to repeat the command [default: 1].
77 See 'cfsp help <command>' for more information on a specific command.
79 Copyright IBM Research, licensed under the Apache License 2.0.
83 from __future__
import print_function, unicode_literals
88 from docopt
import docopt
90 from PyInquirer
import prompt, print_json
91 from pprint
import pprint
94 sys.path.append(os.path.dirname(os.path.abspath(__file__)))
102 from cfsp_util
import print_usage
107 version_path = os.path.dirname(os.path.abspath(__file__))+
"/version.txt"
108 with open(version_path,
"r")
as fh:
110 __version__ = line.rstrip(
"\n")
121 args = docopt(__doc__, version=__version__)
122 args[
'<args>'] = [
'load']
127 argv = [args[
'<command>']] + args[
'<args>']
131 for repeat_id
in tqdm(range(0,
int(args[
'--repeat']))):
133 print(
"INFO: Repeat #"+
str(repeat_id))
134 if args[
'<command>'] ==
'user':
136 elif args[
'<command>'] ==
'cluster':
138 cfrm_response=cfsp_cluster.main(args)
139 elif args[
'<command>'] ==
'image':
141 cfrm_response=cfsp_image.main(args)
142 elif args[
'<command>'] ==
'instance':
144 cfrm_response=cfsp_instance.main(args)
145 elif args[
'<command>'] ==
'debug':
147 cfrm_response=cfsp_debug.main(args)
148 elif args[
'<command>']
in [
'help',
None]:
149 if args[
'<args>'] == [
'user']:
151 print(docopt(cfsp_user.__doc__, argv=argv))
152 elif args[
'<args>'] == [
'cluster']:
153 print(docopt(cfsp_cluster.__doc__, argv=argv))
154 elif args[
'<args>'] == [
'image']:
155 print(docopt(cfsp_image.__doc__, argv=argv))
156 elif args[
'<args>'] == [
'instance']:
157 print(docopt(cfsp_instance.__doc__, argv=argv))
158 elif args[
'<args>'] == [
'debug']:
159 print(docopt(cfsp_debug.__doc__, argv=argv))
161 print(docopt(__doc__, version=__version__))
163 print(
"ERROR: unknown command. Aborting...")
164 exit(print(docopt(__doc__, version=__version__)))
167 pprint(cfrm_response)
169 return(cfrm_response)
172 if __name__ ==
'__main__':
173 if not (hasattr(sys,
'real_prefix')
or (hasattr(sys,
'base_prefix')
and sys.base_prefix != sys.prefix)):
175 print(
"ERROR: It looks like this cFSP isn't running in a virtual environment. Aborting.")
178 args = docopt(__doc__, version=__version__)
def check_credentials(CFGFILE)