Start Function

This module is run upon login from a student or teacher account. It allows the user to select the scenario they are taking part in and provides them with instructions.

start.batch_scenario(args)[source]

Allows a teacher to select a scenario with several student IDs at a time.

Parameters:args – Arguments from the ‘get_args’ function in this module.
start.cleanup()[source]

Clean all docker systems to reduce VM size

start.containers(args)[source]

Allows running the ‘example’ function in each container for testing purposes

Parameters:args – Arguments from the ‘get_args’ function in this module.
TODO
Add filter for containers that contain an ‘example’ function, currently choosing a container without one would cause an uncaught error. [Priority=low]
start.get_args()[source]

Checks command line arguments to see if we’re a student, teacher, or developer.

Example

>>> sys.argv[1] = 'teacher'
>>> get_args()['teacher']
True
>>> get_args()['developer']
False
Return type:Dict
Returns:Returns a dictionary with the current directory, our teacher status, and our student status.
start.get_scenarios(directory)[source]

Gets a list of enabled scenarios in the given directory and returns them. Scenarios are listed by their ‘weight’, a value defined in their class used for ordering.

Example

>>> print(get_scenarios('/vagrant/scenarios/')[0].name)
Host Scanning
Parameters:directory – Directory to look for scenarios in, usually ‘$ProjectRoot/scenarios/’
Returns:List[Scenario]
start.main()[source]

Run if we’re the main file

start.run_scenario(args)[source]

Allows a student to select a single scenario to take part in.

Parameters:args – Arguments from the ‘get_args’ function in this module.
start.test_scenarios(args)[source]

Runs every enables scenario with the seed 1-5 for testing purposes

Parameters:args – Arguments from the ‘get_args’ function in this module.
TODO
Could generate random seeds for this? [Priority=low]