If you are are developing or testing the distributed system for automated grading, you may want to set up one or more worker machines in addition to your primary vagrant virtual machine.
Automated Worker Installation
These steps will create a worker machine alongside the normal Submitty machine.
- Make sure to destroy any existing vagrant machines with
vagrant destroy
-
Ensure you have Python 3 installed on your machine
- Generate configuration for the desired number of worker machines
python3 generate_workers.py [-n NUM] [--ip-range IP_RANGE] [--base-port PORT]
This will create or update a configuration file stored at
.vagrant/workers.json
. Now you can create the virtual machines with:vagrant up
If you happen to encounter error messages regarding IP addresses or port conflicts, you can manually edit the
workers.json
file as needed.NOTE: Do not edit the
workers.json
configuration file or run the aforementioned python script if there are any existing vagrant machines in your project. This can result in the existing VMs continuing to run in the background or storing their data with no clean way to remove them. - To delete the worker machines and revert to a normal development setup, you can first run
vagrant destroy
And confirm to delete all the existing virtual machines.
Next, you can delete the
workers.json
file, which will remove the worker configuration from your project. The nextvagrant up
should only create the primary development virtual machine without any workers.
Connecting to the Worker Machine
If you would like to ensure the worker is functioning properly, or enter the worker machine for managing it directly, you can follow these steps.
To connect to a worker machine through SSH, run:
vagrant ssh <worker-name>
If you want to test the connection between the primary VM and a worker, you can first vagrant ssh
into the primary machine and then run this command to SSH into the worker from there:
su submitty_daemon -c ssh submitty@<ip-address>
The IP address of the worker machine will be indicated in the .vagrant/workers.json
file.
NOTE: Depending on the performance of your computer and the size of the autograding queue passed to the worker, the SSH command may hang for some time.
Manual Worker Installation (VirtualBox)
-
Open the Virtual Box application.
-
Click
New
to create a new machine. Give it a useful name: e.g.,worker_machine_a
Specify the type:Linux
And the version:Ubuntu 64
-
Specify the amount of memory: 2048 = 2GB should be sufficient.
-
Create the disk as a
new virtual disk
. Specify RAM memory: 2048 (2GB) Create new virtual disk. ChooseVDI
ChooseDynamically allocated
Specify size: e.g., 20GB -
Download the Ubuntu 22.04 installer 64 bit .iso. Save this somewhere on your host computer.
-
Click on
Start
to power on. Browse your files to find the Ubuntu installer .iso we downloaded earlier. PressStart
. -
Follow the Ubuntu installation menu… Click
Install Ubuntu
. SelectEnglish
keyboard. Selectnormal
installation. Agree toErase disk & Install Ubuntu
. Specify your timezone. Then specify your username, computer name, password. Then click through various menus, and wait a while installing system. Then restart the VM to finish installation. -
At some point, it will suggest that you install updates for Ubuntu 22.04, go ahead and do that. You’ll probably have to reboot.
-
Allow ssh connections to the worker VM from outside (e.g., from your primary machine): from virtual box, select the VM, click on
Settings
, thenNetwork
,Enable Network Adapter
should be checked, then set Attached to:Bridged Adapter
-
From the VM, open a terminal and install a bunch of additional packages:
sudo apt update sudo apt install net-tools sudo apt install openssh-server sudo apt install git
-
Install Guest Additions (Improves screen resolution, copy paste to/from the VM, etc.)
While the VM is running, focus on the VM window. Then from the menu, select
Devices
->Insert guest additions CD image
Open a terminal in the VM Go to the guest additions CD directory, and run the guest additions installer:mount cd /media/<USERNAME>/VBox_GAs_<VERSION>/ sudo ./VBoxLinuxAdditions.run
-
Get a permanent IP address for your machine Go to your router, assign a fix ip address for your mac address E.g., in a browser, go to
192.168.0.1
and log in… Helpful command to find your mac address & current IP address:ifconfig
-
Prevent worker VM from going to sleep (so you can send autograding jobs to it at any time).
Settings
->privacy
->screen lock
->turn off screen lock
Settings
->power
->suspend & power button
->automatic suspend
== offSettings
->power
->blank screen
==never
-
Follow the worker installation instructions