Open
Description
The procedure _build_python_path leads to some unexpected behavior (IMO) in two cases.
- If I start an experiment with
python3 main.py config.yml -s
while conda environment A is activated andconfig.yml
contains a venv variable pointing to conda environment B, the PYTHONPATH (or more precisely the value of sys.path) of environment A is copied and used in thesbatch.sh
file (Line 25). I would expect the PYTHONPATH to be exported with the PYTHONPATH (or sys.path) of the environment specified in the venv config variable. As it is now, the PYTHONPATH specified in and activated with environment B in Line 21 will be overwritten with the sbatch script in Line 25.
Lines 18 to 32 in da87c58
- When setting
experiment_copy_dst
orexperiment_copy_auto_dst
the generated PYTHONPATH still contains references to the original working directory (and not the copy) in some cases. As defined in https://docs.python.org/3/library/sys.html#sys.path, the first entry ofsys.path
is the directory "containing the script that was used to invoke the Python interpreter". As the script is invoked in the "uncopied" src directory, the PYTHONPATH will contain this entry if the script (the main.py file) is in a subfolder ofexperiment_copy_src
.
This happens because the code below only checks for exact copies ofsc["experiment_copy_src"]
and not paths containingsc["experiment_copy_src"]
. I think this also happens when the PYTHONPATH contains some manually added entries to subfolders ofsc["experiment_copy_src"]
. Changing the procedure to replace instances ofsc["experiment_copy_src"]
withdst
would solve this issue.
Lines 272 to 288 in 47d5eff