Make LearningTestTool Able to Use `khiops_env` if Requested
Description
Currently, kht_test.py in LearningTestTool/py does not use the settings in khiops_env.
This entails that, in order to make sure that LearningTestTool tests Khiops in (real) user-like conditions, LearningTestTool needs to replicate khiops_env settings.
For example, to match the export MPICH__INTERFACE_HOSTNAME=localhost command in khiops_env on MacOS, kht_test.py needs to detect the "Darwin" platform and replicate khiops_env behavior by adding the -host localhost options to mpiexec, which achieve the same effect (related issue on this point: #401).
The goal of this issue is to make LearningTestTool launchable in two modes:
- a "dev" mode, which keeps the current behavior; usable:
- by Khiops core developers, and
- in the standard CI tests which use the MODL* binaries directly
- a "package" / "release" mode, which executes
khiops_env --envto read the MPI command (and other settings); usable:- in the packaging CI tests (for all platforms)
- in the LearningTest full tests.
Context
- Khiops version: >= 10.2.3
- Scenario file (use
khiops -o scenario._kh): Any - OS description (use
khiops -s): All supported
It suffices to add a --environment option that gives the path to the desired khiops_env.
Alternative simple: réutiliser le paramètre existant binaries pour y cherche le khiops_env en priorité, et si non trouvé se rabattre sur la recherche des binaires comme actuellement
Alternative simple: réutiliser le paramètre existant
binariespour y cherche lekhiops_enven priorité, et si non trouvé se rabattre sur la recherche des binaires comme actuellement
Indeed, we can reuse this parameter as follows:
- if
khiops_envis found in thebinariesdirectory, then the paths to the KhiopsMODL_*andMODL_Coclusteringbinaries can be updated according to the values of theKHIOPS_PATHandKHIOPS_COCLUSTERING_PATHenvironment variables, respectively; - otherwise, the current behavior is kept.
Concretely, the changes would need to be done in the kht_test.py / build_tool_exe_path function, in the form of an if / else test on the existence of khiops_env in the tool_binaries_dir directory:
- if
khiops_envis found insidetool_binaries_dir, then:- if
tool_nameequalsKHIOPS, then assigntool_exe_paththe value ofKHIOPS_PATH; - else, if
tool_nameequalsCOCLUSTERING, then assigntool_exe_paththe value ofKHIOPS_COCLUSTERING_PATH; accessorily: - check whether these paths actually exist and update
error_messageaccordingly if at least one of them does not; - update
os.environaccording to the output oftool_binaries_dir/khiops_env --env;- then, the
os.environ["KHIOPS_MPI_COMMAND"]"would need to be used in thekht_test.py/evaluate_tool_on_test_dirfunction in order to updatekhiops_params; also, the other updates ofos.environwith the various MPI-specific variables could be removed;
- then, the
- if
- else, keep the current behavior unchanged.