-
Notifications
You must be signed in to change notification settings - Fork 4
3.3 Debug guide
This is a guide on how to set up the debug environment for this project as well as how to debug multiple components at the same time. You should have installed all required tools recommended inside the Developer installation guide before beginning this guide.
First the dataset path must be set to the controllers app-data path or else, the controller and frontend will not use the same path or crash. The app-data/datasets path may not exist yet on your system as it is created during the first execution:
Change the launchSettings.json of the frontend.
On windows change the path inside the IISExpress (line 9) configuration, and change the path before the MetaAutoML folder to match your system's location of the MetaAutoML folder.
On Mac change the path inside the Kestrel (line 25) configuration, and change the path before the MetaAutoML folder to match your system's location of the MetaAutoML folder but also change the slashes from double backslash to single slashes:
Next, you must uncomment the appropriate connection string the frontend will use to connect to the MS SQL database. The connection strings are available inside the appsettings.json file.
Only one connection string must be uncommented at any time! If you use the default MS SQL database installed by visual studio use the DEFAULT CONNECTION STRING, uncomment line 9. If you use a separately installed MS SQL database use the LOCAL CONNECTION STRING, uncomment line 12. If you use the development docker-compose MS SQL database use DOCKER CONNECTION STRING, uncomment line 15.
Now open Visual Studio and select the BlazorBoilerplate.sln file as "open a project or solution" source. Select the BlazorBoilerplate.Server project in the top bar next to the debug buttons and IISExpress on windows, on Mac select Kestrel:
Info: if this is the first time starting the application, it might take a while before the web page is displayed. Blazor is setting up the local ML SQL database.
After a while a browser with the login page will open automatically:
You can log in using the default user:
Name: user
Password: +User123
Important: You also need to start the Controller project and MongoDB server. Without the Controller, the Frontend can not retrieve information from the Controller and will crash or display several errors.
Each component within the Backend can be opened up individually using the startvscode.cmd (windows) and startvscode.sh (unix) scripts in the corresponding folder.
Run the startvscode script in the controller folder (e.g. controller/startvscode.cmd).
Run the setupvenv script in the controller folder (setupvenv.cmd for windows, setupvenv.sh for unix). This will set up a virtual python environment and install all dependencies of the project. This process may take a while.
Possible Errors:
- If an error is shown because of missing permissions, delete the controller/.venv folder and rerun the script as administrator or sudo.
- If an error is shown because python could not be found, make sure that python is in your PATH or otherwise globally available. (As a workaround, you can edit the setupvenv script and replace "python" with the full path to your installed python.exe)
VS Code will display a popup if you want to use the newly created venv for debugging, press yes. Now we are located within said venv, which we can check looking at the bottom right of VS Code:
In case nothing with Python is displayed, manually select any Python file first within VS Code. In case you only see your current Python version without any venv annotation like in the screenshot, press the python number, and VS Code will prompt you to choose between all available environments:
Now select the one with the venv path.
Switching to the debug menu in VS Code, the controller can be debugged:
Info: Every backend component has a preconfigured debug profile for VS Code. When opening the debug menu in VS Code, the component name will be recognized automatically. Depending on your OS you must change the selected debug config from WIN to UNIX. The correct name is displayed in front of the config name:
The adapter setup works exactly the same as the controller only that the scripts in the corresponding adapter folder have to be used. E.g. adapters/AutoCVE/startvscode.sh and adapters/AutoCVE/setupvenv.sh
All adapters are found in the adapters folder.
Within each adapter the training-path variable inside the development config must be updated. It must point to the local system path where the MetaAutoML folder is located: config_development.json
Follow the instruction for debugging the controller from above.
The adapter unit tests can be debugged using VSCodes integrated debugger.
Each adapter has a launch.config in the .vscode folder. You can use a working configuration and change the file path the a test case under tests/test_*.py
. In that case you will need to make changes to the test file: The TestCase class has a setUp
and tearDown
you need to comment out. They are present in case the test is run from the repositories root directory.
If you want to run the tests from the root directory you can do so using the Run/Debug this file button in the test file. You must set your python path to include more directories. For Autokeras you need to inlcude:
PYTHONPATH extensions
PYTHONPATH=${PYTHONPATH}:../../adapters/AutoKeras/AutoMLs
PYTHONPATH=${PYTHONPATH}:../../adapters/Utils/Utils
PYTHONPATH=${PYTHONPATH}:../../adapters/Utils/AutoMLs
PYTHONPATH=${PYTHONPATH}:../../adapters/GRPC/Adapter
PYTHONPATH=${PYTHONPATH}:utils
PYTHONPATH=${PYTHONPATH}:adapters/AutoKeras/dependency-injection
PYTHONPATH=${PYTHONPATH}:controller
PYTHONPATH=${PYTHONPATH}:controller/managers
PYTHONPATH=${PYTHONPATH}:controller/persistence
Debugging the entire OMA-ML project can be accomplished by executing the Frontend within Visual Studio and every Backend component with a separate instance of Visual Studio Code opened in their respective folder. It is important to note that debugging all AutoML Adapters at the same time might require a lot of resources, therefore only recommended for strong multicore systems.
If this is not possible, it is also viable to only execute one AutoML solution. The frontend will display every AutoML Adapter as failed in such a case, but the running AutoML will not be influenced by that.
To download test datasets from Kaggle some unit tests use the Kaggle API, which uses API Tokens to authentificate. For this to work a kaggle.json file is required, which should be located in in the auth folder at the project root. The file can be downloaded from https://www.kaggle.com by going to Profile -> "Account" -> "Create new API Token".
To run unit tests open the Test-Explorer tab and klick the green run arrow.
To debug a unit test select the preconfigured debug profile of the test you want to run, as described in the Debug section.