Skip to content

Commit

Permalink
Use main branch of MAGE repository by default and allow it to be reco…
Browse files Browse the repository at this point in the history
…nfigured
  • Loading branch information
samkumar committed May 23, 2021
1 parent c40ebd9 commit 19498ea
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
12 changes: 8 additions & 4 deletions magebench.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ def generate_ckks_keys(c):
finally:
shutil.rmtree("./ckks_keys")

def provision_cluster(c):
def provision_cluster(c, repository, checkout):
def provision_machine(machine, id):
remote.exec_script(machine.public_ip_address, "./scripts/provision.sh", "{0} {1}".format(machine.provider, c.setup))
remote.exec_script(machine.public_ip_address, "./scripts/provision.sh", "{0} {1} {2} {3}".format(machine.provider, c.setup, repository, checkout))
remote.copy_to(machine.public_ip_address, False, "./cluster.json", "~")
if id < c.num_lan_machines:
remote.exec_script(machine.public_ip_address, "./scripts/generate_configs.py", "~/cluster.json {0} lan ~/config {1}".format(id, "true" if c.setup.startswith("paired") else "false"))
Expand Down Expand Up @@ -75,13 +75,13 @@ def spawn(args):
print("Waiting three minutes for the machines to start up...")
time.sleep(180)
print("Provisioning the machines...")
provision_cluster(c)
provision_cluster(c, args.repository, args.checkout)
print("Done.")

def provision(args):
c = cluster.Cluster.load_from_file("cluster.json")
print("Provisioning the machines...")
provision_cluster(c)
provision_cluster(c, args.repository, args.checkout)
print("Done.")

def parse_program(program):
Expand Down Expand Up @@ -270,6 +270,8 @@ def fetch_logs_from(machine, id):
parser_spawn.add_argument("-d", "--large-work-disk", action = "store_true")
parser_spawn.add_argument("-g", "--gcloud-machine-locations", action = "extend", nargs = "+", choices = ("oregon", "iowa", "virginia"))
parser_spawn.add_argument("-s", "--wan-setup", default = "regular")
parser_spawn.add_argument("-r", "--repository", default = "https://github.com/ucbrise/mage")
parser_spawn.add_argument("-c", "--checkout", default = "main")
parser_spawn.set_defaults(func = spawn)

parser_provision = subparsers.add_parser("provision")
Expand Down Expand Up @@ -328,6 +330,8 @@ def fetch_logs_from(machine, id):
parser_purge.add_argument("-d", "--large-work-disk", action = "store_true")
parser_purge.add_argument("-g", "--gcloud-machine-locations", action = "extend", nargs = "+", choices = ("oregon", "iowa", "virginia"))
parser_purge.add_argument("-s", "--wan-setup", default = "regular")
parser_purge.add_argument("-r", "--repository", default = "https://github.com/ucbrise/mage")
parser_purge.add_argument("-c", "--checkout", default = "main")
parser_purge.set_defaults(func = purge)

parser_fetch_logs = subparsers.add_parser("fetch-logs")
Expand Down
8 changes: 5 additions & 3 deletions scripts/provision.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,12 @@ then
fi

# Use the latest version of MAGE
REMOTE=tobuild

pushd ~/work/mage
git fetch origin
git checkout dev
git pull origin dev
git remote add $REMOTE $3
git fetch $REMOTE
git checkout ${REMOTE}/${4}
make
popd

Expand Down

0 comments on commit 19498ea

Please sign in to comment.