✅ Run automated tests
What are automated tests?
A large part of the source code of OmniOpt2 is to make sure that everything works as expected. This code executes real test cases and looks at the results to check if they are as expected. Many things in OmniOpt2 get tested automatically to see if they work properly. All test related files are in the folder .tests.
Why would I want to run those?
OmniOpt2 is supposed to be run on a wide variety of Linux systems. Not every system specific thing can be caught, though, since I cannot test it manually on all the available Linux-distributions. If you encounter problems in OmniOpt2, I may ask you to run those tests and submit the output to me, so that I can debug it thoroughly.
You may have made a change to OmniOpt2 and want to see if it still runs and you haven't broken anything.
How to run tests?
To run all tests, which takes a lot of time, run:
./.tests/main
Possible options:
Parameter | Description | Type | Action | Default Value |
---|---|---|---|---|
Ungrouped - Extracted from --help | ||||
|
Exit on first error |
|
|
|
|
This help |
|
|
|
|
Allows to use coverage instead of python3 for coverage testing unit test coverage |
|
|
|
|
Only run quick tests |
|
|
|
|
Only run really quick tests |
|
|
|
|
Only run super quick tests |
|
|
|
|
Enables debug mode |
|
|
|
|
Disable link checker |
|
|
|
|
Disable linter |
|
|
|
|
Skip testing for proper job nrs |
|
|
|
|
Skip the first n tests |
|
||
|
Skip worker checks |
|
|
|
|
Disables plot tests |
|
|
Example on the quickest useful test
When this succeeds without any errors, you can be reasonably sure that OmniOpt2 will properly do the following things under normal circumstances:
- Run a simple run (one random step and 2 steps in total, so both model, SOBOL and BOTORCH_MODULAR get tested)
- Continue a run
- Continue an already continued run
- Test the of the number of results for all these jobs
- Plot scripts create svg files that contain strings that are to be expected
- Basic documentation tests are done
./.tests/main --num_random_steps=1 --max_eval=2 --reallyquick
All test scripts
adding_jobs_to_new_job
Test if adding jobs from existing jobs to new jobs works
all_shellscripts_with_help_have_help_page
See if all bash scripts have --help.
bandit
Tests for security-related python bugs and improvement suggestions.
check_if_results_csv_has_the_right_headers
Start an OmniOpt2 run and see if the results.csv has the proper results.
check_state_file_documentation
Test if all state files that are written are documented.
continued_constraint
Testing if continuing a constrained run works.
current_runs_plot_test
Plots all current projects in runs and tests if the plot script succeeded.
deadcode
Find unreachable and unused code.
doc_has_outdated_params
Test if any documentation page has outdated options for .omniopt.py/omniopt.
find_add_arguments_with_double_quotes
Find arguments in .omniopt.py that have double quotes and fail if they do, since other script that parse it need them to be single quotes.
find_double_add_arguments_help
Find arguments added multiple times in .omniopt.py.
find_double_function_names
Find function names that are defined twice or more.
find_double_function_thats_already_in_helper
Find functions that are defined in any .py and also .helpers.py, so that the they can be moved to the .helpers.py compeletly.
find_functions_that_are_defined_multiple_times
Find functions that are defined multiple times and could be moved to .helpers.py.
find_functions_with_missing_types
Find python-scripts with missing function return types.
find_missing_env_vars_documentation
Find environment variables that change how OmniOpt works that are not documented.
find_missing_toc_in_md_files
Find help documentation files missing the Table-of-Contents.
find_typos_in_bash
Finds typos in bash scripts.
find_typos_in_gui
Find typos in the GUI (PHP).
find_typos_in_js
Find typos in JavaScript-files.
find_typos_in_php
Find typos in php scripts.
find_typos_in_python
Find typos in python scripts.
find_undocumented_exit_codes
Check if all used exit codes are documented.
find_untyped_cli_args
Find CLI arguments that are not typed properly for mypy and beartype.
find_unused_but_documented_exit_codes
Find exit codes in documentation that are not used in OmniOpt2.
find_unused_functions_in_omniopt
Find functions in .omniopt.py that are unused.
find_unused_params
find parameters that are defined in OmniOpt but never used.
find_unused_params_in_plots
Find argparse parameter for plots that go unused.
find_unused_share_functions
Find functions in the share_functions.php that are not used anywhere.
find_wrong_order_definitions
Find definitions of functions that are in the wrong order.
find_wrongly_typed_cli_args
Find CLI arguments that have the wrong types.
flake8
Runs linter 'flake8' on python.
folder_structure
Tests if all files that are in the run subfolders are documented properly.
install_via_pip
Install via github and pip and test if it works properly.
js_syntax
Check syntax of JS scripts.
linkchecker
Checks all links on the site.
lint_python
Run python-linters only.
lizard
Test scripts for cyclomatic complexity.
missing_plot_metadata
Tests if al plot scripts have the metadata for the help pages, i.e. # EXPECTED FILES and # DESCRIPTION.
multiplication_constraint
Test non-standard constraints.
mypy
Run mypy to find variables that are not typed properly.
optimization_example
Simple optimization example based on the shekel-function.
Parameter | Description | Type | Action | Default Value |
---|---|---|---|---|
Ungrouped - Extracted from --help | ||||
|
Will be ignored |
|
|
|
|
Whether to fail or not |
|
||
|
Enable random SEM |
|
||
|
Number of results the example program should have (default: 1) |
|
||
|
This help |
|
|
|
|
Enables debug mode |
|
|
optimization_example_full_search
Optimization example based on the shekel-function.
Parameter | Description | Type | Action | Default Value |
---|---|---|---|---|
Ungrouped - Extracted from --help | ||||
|
This help |
|
|
|
|
Enables debug mode |
|
|
orchestrator
Tests if the orchestrator runs properly.
Parameter | Description | Type | Action | Default Value |
---|---|---|---|---|
Ungrouped - Extracted from --help | ||||
|
Don't run successful tests |
|
|
|
|
This help |
|
|
|
|
Enables debug mode |
|
|
php_files
Syntax check all PHP files.
php_search
Test if the search.php compiles and delivers proper results.
phpcs
Run a PHP linter.
plots
Test all plot scripts for different jobs.
post_job_pareto_front_calculation
Run an omniopt2 job with 2 result objectives, but cancel it, and test if the pareto front is calculated correctly afterwards.
pyflakes
Run pyflakes linter on .py files.
pylint
Runs pylint linter on python files.
radon
Find functions with too large cyclomatic complexity.
share
Tests the share page for PHP-syntax errors and other simple-to-test stuff.
share_tests
Run different tests for the share functions.
shellcheck
Lints bash files.
single_quotes_in_configloader
Tests if the config-loader in .omniopt.py has only single quotes, as double-quotes cause other scripts that parse it to fail.
state_files
Test if all state_files are properly documented.
unit_tests
Runs some basic unit-tests on different scripts.
wronggoing_stuff
Test if OmniOpt2 reacts properly if stuff goes wrong.
Parameter | Description | Type | Action | Default Value |
---|---|---|---|---|
Ungrouped - Extracted from --help | ||||
|
Don't run successful tests |
|
|
|
|
This help |
|
|
|
|
Enables debug mode |
|
|
linter
Run different linters.
Parameter | Description | Type | Action | Default Value |
---|---|---|---|---|
Ungrouped - Extracted from --help | ||||
|
Disable slow tests |
|
|
|
|
This help |
|
|
|
|
Don't fail on error |
|
|
optimization_example_all_float
Very simple single-objective-optimization-problem based on the shekel-function where all inputs are float.
Parameter | Description | Type | Action | Default Value |
---|---|---|---|---|
Ungrouped - Extracted from --help | ||||
|
Enable random SEM |
|
||
|
Any float |
|
||
|
Any float |
|
||
|
Any float |
|
||
|
Any float |
|
||
|
This help |
|
|
|
|
Enables debug mode |
|
|
start_simple_optimization_run
Start a simple optimization based on the shekel-function.
Parameter | Description | Type | Action | Default Value |
---|---|---|---|---|
Ungrouped - Extracted from --help | ||||
|
Maximum number of evaluations for this test |
|
||
|
Memory in GB (0 for all) |
|
||
|
Maximum number of parallel workers for this test |
|
||
|
Number of random steps |
|
||
|
Model name |
|
||
|
Perform grid search |
|
|
|
|
Number of GPUs per worker |
|
||
|
Time each subjob should run |
|
||
|
Adds a parameter to randomly fail |
|
|
|
|
Run locally even if SLURM is installed |
|
|
|
|
Use all_float logic |
|
|
|
|
Enable flame-graph |
|
|
|
|
One parameter |
|
|
|
|
Two parameters |
|
|
|
|
Nr of 'RESULT's (default: 1) |
|
||
|
Seed |
|
||
|
List of additional parameters |
|
||
|
Alternate min/max when nr_results > 1 |
|
|
|
|
Force ranges to be converted to choice |
|
|
|
|
Follow tail |
|
|
|
|
Generate all jobs at once |
|
|
|
|
Verbose output |
|
|
|
|
Revert to random if the model space is seemingly exhausted |
|
|
|
|
Override testname |
|
||
|
Show ram usage every n seconds |
|
||
|
Add random SEM to each result |
|
|
|
|
This help |
|
|
|
|
Enable debug mode |
|
|
test_seed
Test if the seed is properly used and results are consistent and deterministic.
Parameter | Description | Type | Action | Default Value |
---|---|---|---|---|
Ungrouped - Extracted from --help | ||||
|
Sets the seed value |
|
||
|
Number of GPUs |
|
||
|
MD5 hash value |
|
||
|
Displays this help message |
|
|
train_example_network
Starts an OmniOpt2 run that trains an example neural network.
Parameter | Description | Type | Action | Default Value |
---|---|---|---|---|
Ungrouped - Extracted from --help | ||||
|
This help |
|
|
|
|
Enables debug mode |
|
|
|
|
Data folder (default: data, possible options: data, data_tiny, data_full) |
|
||
|
Number of parallel jobs (default: 20, but at least --num_random_steps) |
|
||
|
Number of minutes for a single-worker to timeout (default: 30) |
|
||
|
Memory in GB (default 5) |
|
||
|
Max runtime in minutes (default: 300) |
|
||
|
Number of random steps |
|
||
|
Max number of evals (default: 200) |
|
||
|
Number of min dense layers (default: 1) |
|
||
|
Number of max dense (default: 10) |
|
||
|
Number of min dense_units layers (default: 1) |
|
||
|
Number of max dense_units (default: 10) |
|
||
|
Number of min conv_filters layers (default: 1) |
|
||
|
Number of max conv_filters (default: 10) |
|
||
|
Number of min conv layers (default: 1) |
|
||
|
Number of max conv (default: 10) |
|
||
|
Number of min epochs (default: 10) |
|
||
|
Number of max epochs (default: 40) |
|
||
|
Min height (default: 40) |
|
||
|
max height (default: 80) |
|
||
|
Min width (default: 40) |
|
||
|
max width (default: 80) |
|
||
|
Min learning_rate (default: 0.01) |
|
||
|
Max learning_rate (default: 0.4) |
|
||
|
Validation split (default: 0.2) |
|
||
|
Result names (default: VAL_ACCURACY=max VAL_LOSS=min RAM_USAGE=min RUNTIME=min) |
|
||
|
Follow the output (default: 0) |
|
|
|
|
Do gridsearch |
|
|
|
|
Generate all jobs at once |
|
|
|
|
Revert to random search when search space seems exhausted |
|
|
external_generator
Test external generator.
Parameter | Description | Type | Action | Default Value |
---|---|---|---|---|
Ungrouped - Extracted from --help | ||||
|
Memory in GB (default: 1) |
|
||
|
Time in minutes (default: 60) |
|
||
|
Timeout for worker (default: 60) |
|
||
|
Maximum evaluations (default: 2) |
|
||
|
Number of parallel jobs (default: 1) |
|
||
|
Number of GPUs (default: 1) |
|
||
|
Number of random steps (default: 1) |
|
||
|
External generator command (Base64 encoded) |
|
||
|
Show this help message and exit |
|
|
randomforest
Test if random forest works properly.
multi_results_different_models
Test multi-objective-optimization with different models.
tpe
Test the Tree Parzen Estimator model (TPE).
Parameter | Description | Type | Action | Default Value |
---|---|---|---|---|
Ungrouped - Extracted from --help | ||||
|
Maximum number of evaluations (default: 6) | |||
|
Number of random steps before model (default: 1) | |||
|
Number of parallel jobs (default: 2) | |||
|
Memory in GB per job (default: 4) | |||
|
Name for the test run (default: TPE) | |||
|
Use GPU (default: auto-detect) |
|
||
|
Additional parameters for the optimizer | |||
|
Show this help message |
|
|
all_oo_options_are_in_gui_and_vice_versa
Find GUI options that are not in OmniOpt2 or vice versa, so they always reflect each other.
main
Main test script, coordinates complete test runs
Parameter | Description | Type | Action | Default Value |
---|---|---|---|---|
Ungrouped - Extracted from --help | ||||
|
Exit on first error |
|
|
|
|
This help |
|
|
|
|
Allows to use coverage instead of python3 for coverage testing unit test coverage |
|
|
|
|
Only run quick tests |
|
|
|
|
Only run really quick tests |
|
|
|
|
Only run super quick tests |
|
|
|
|
Enables debug mode |
|
|
|
|
Disable link checker |
|
|
|
|
Disable linter |
|
|
|
|
Skip testing for proper job nrs |
|
|
|
|
Skip the first n tests |
|
||
|
Skip worker checks |
|
|
|
|
Disables plot tests |
|
|
transforms
Test transforms.
Parameter | Description | Type | Action | Default Value |
---|---|---|---|---|
Ungrouped - Extracted from --help | ||||
|
Maximum number of evaluations (default: 6) | |||
|
Number of random steps before model (default: 1) | |||
|
Number of parallel jobs (default: 2) | |||
|
Memory in GB per job (default: 4) | |||
|
Name for the test run (default: TRANSFORMS) | |||
|
Use GPU (default: auto-detect) |
|
||
|
Additional parameters for the optimizer | |||
|
Show this help message |
|
|