forked from spcl/serverless-benchmarks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.py
executable file
·65 lines (53 loc) · 2.34 KB
/
install.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
#!/usr/bin/env python3
import argparse
import os
import subprocess
parser = argparse.ArgumentParser(description="Install SeBS and dependencies.")
for deployment in ["aws", "azure", "gcp", "local"]:
parser.add_argument(f"--{deployment}", action="store_const", const=True, default=True, dest=deployment)
parser.add_argument(f"--no-{deployment}", action="store_const", const=False, dest=deployment)
parser.add_argument("--with-pypapi", action="store_true")
args = parser.parse_args()
def execute(cmd):
ret = subprocess.run(
cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True
)
if ret.returncode:
raise RuntimeError(
"Running {} failed!\n Output: {}".format(cmd, ret.stdout.decode("utf-8"))
)
return ret.stdout.decode("utf-8")
env_dir="sebs-virtualenv"
if not os.path.exists(env_dir):
print("Creating Python virtualenv at {}".format(env_dir))
execute("python3 -mvenv {}".format(env_dir))
execute(". {}/bin/activate && pip install --upgrade pip".format(env_dir))
else:
print("Using existing Python virtualenv at {}".format(env_dir))
print("Install Python dependencies with pip")
execute(". {}/bin/activate && pip3 install -r requirements.txt".format(env_dir))
if args.aws:
print("Install Python dependencies for AWS")
execute(". {}/bin/activate && pip3 install -r requirements.aws.txt".format(env_dir))
if args.azure:
print("Install Python dependencies for Azure")
execute(". {}/bin/activate && pip3 install -r requirements.azure.txt".format(env_dir))
if args.gcp:
print("Install Python dependencies for GCP")
execute(". {}/bin/activate && pip3 install -r requirements.gcp.txt".format(env_dir))
if args.local:
print("Install Python dependencies for local")
execute(". {}/bin/activate && pip3 install -r requirements.local.txt".format(env_dir))
print("Initialize Docker image for local storage.")
execute("docker pull minio/minio:latest")
print("Initialize git submodules")
execute("git submodule update --init --recursive")
if args.with_pypapi:
print("Build and install pypapi")
cur_dir = os.getcwd()
os.chdir(os.path.join("third-party", "pypapi"))
execute("git checkout low_api_overflow")
execute("pip3 install -r requirements.txt")
execute("python3 setup.py build")
execute("python3 pypapi/papi_build.py")
os.chdir(cur_dir)