forked from rlberry-py/rlberry
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade from python3.9 to python3.10 (rlberry-py#335)
* update python version 3.9 -> 3.10 for Azure CI * update python version 3.9 -> 3.10 for Azure CI * update changelog for python version 3.9 -> 3.10 * add shield about python version * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * [Apptainer/Singularity scipts] add scripts to test current version of python, and specific version of python,. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
0b0e3ea
commit e5b39fa
Showing
9 changed files
with
139 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
|
||
To test rlberry, you can use this script to create a container that install the latest version, run the tests, and send the result by email. | ||
(or you can check inside the .sh file to only get the part you need) | ||
|
||
:warning: **WARNING** :warning: : In both files, you have to update the paths and names | ||
|
||
## .def | ||
Scripts to build your apptainer. | ||
2 scripts : | ||
- 1 with the "current" version of python (from ubuntu:last) | ||
- 1 with a specific version of python to choose | ||
|
||
## .sh | ||
Script to run your apptainer and send the report | ||
use chmod +x [name].sh to make it executable | ||
|
||
To run this script you need to install "mailutils" first (to send the report by email) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
# Set the email recipient and subject | ||
recipient="[email protected],[email protected]" | ||
attachment="test_report.txt" | ||
|
||
# Build, then run, the Apptainer container and capture the test results | ||
cd [Path_to_your_apptainer_folder] | ||
#build the apptainer from the .def file into an .sif image | ||
apptainer build --fakeroot --force rlberry_apptainer_base.sif rlberry_apptainer_base.def | ||
#Run the "runscript" section, and export the result inside a file (named previously) | ||
apptainer run --fakeroot --overlay my_overlay/ rlberry_apptainer.sif > "$attachment" | ||
|
||
|
||
# Send the test results by email | ||
exit_code=$(cat [path]/exit_code.txt) # Read the exit code from the file | ||
|
||
if [ $exit_code -eq 0 ]; then | ||
# Initialization when the exit code is 0 (success) | ||
subject="Rlberry : Succes Monthly Test Report" | ||
core_message="Success. Please find attached the monthly test report." | ||
else | ||
# Initialization when the exit code is not 0 (failed) | ||
subject="Rlberry : Failed Monthly Test Report" | ||
core_message="Failed. Please find attached the monthly test report." | ||
fi | ||
|
||
echo "$core_message" | mail -s "$subject" -A "$attachment" "$recipient" -aFrom:"Rlberry_Monthly_tests" |
37 changes: 37 additions & 0 deletions
37
scripts/apptainer_for_tests/rlberry_apptainer__specific_python.def
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
Bootstrap: docker | ||
From: ubuntu:latest | ||
|
||
#script for the build | ||
%post -c /bin/bash | ||
|
||
#get the last Ubuntu Update, and add the desdsnakes ppa to acces other python version | ||
apt-get update \ | ||
&& apt-get upgrade -y | ||
apt-get install -y software-properties-common | ||
add-apt-repository ppa:deadsnakes/ppa -y | ||
apt-get update | ||
|
||
# Install python, and graphic and basic libs. Don't forget to change [version] by the python you want (python[version] > python3.11), then set the new python as "main" python | ||
DEBIAN_FRONTEND=noninteractive TZ=Etc/UTC apt-get install -y python[version] python[version]-dev python[version]-venv python3-pip git ffmpeg libsm6 libxext6 libsdl2-dev xvfb x11-xkb-utils --no-install-recommends | ||
update-alternatives --install /usr/bin/python3 python3 /usr/bin/python[version] 1 | ||
pip3 install --upgrade pip | ||
|
||
|
||
#Remove the old tmp folder if it exist, then install rlberry | ||
if [ -d /tmp/rlberry_test_dir[version] ]; then /bin/rm -r /tmp/rlberry_test_dir[version]; fi | ||
git clone https://github.com/rlberry-py/rlberry.git /tmp/rlberry_test_dir[version] | ||
|
||
#Install all the lib we need to run rlberry and its tests | ||
pip3 install rlberry[torch_agents] opencv-python pytest pytest-xvfb pytest-xprocess tensorboard #--break-system-packages | ||
pip3 install gymnasium[other] | ||
|
||
#Environmment variable, Don't forget to change [version] | ||
%environment | ||
export LC_ALL=C | ||
export PATH="/usr/bin/python[version]:$PATH" | ||
|
||
#script that will be executed with the "run" command : run the tests in rlberry, then export the exit code inside a text file | ||
%runscript | ||
cd /tmp/rlberry_test_dir[version] && \ | ||
pytest rlberry | ||
echo $? > [path]/exit_code.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
Bootstrap: docker | ||
From: ubuntu:latest | ||
|
||
#script for the build | ||
%post -c /bin/bash | ||
|
||
#get the last Ubuntu Update, | ||
apt-get update \ | ||
&& apt-get upgrade -y | ||
|
||
# Install python, and graphic and basic libs. | ||
apt-get install -y software-properties-common python3-pip git ffmpeg libsm6 libxext6 libsdl2-dev xvfb x11-xkb-utils | ||
|
||
#Remove the old tmp folder if it exist, then download rlberry | ||
if [ -d /tmp/rlberry_test_dir ]; then /bin/rm -r /tmp/rlberry_test_dir; fi | ||
git clone https://github.com/rlberry-py/rlberry.git /tmp/rlberry_test_dir | ||
|
||
#Install all the lib we need to run rlberry and its tests | ||
pip3 install rlberry[torch_agents] opencv-python pytest pytest-xvfb pytest-xprocess tensorboard #--break-system-packages | ||
pip3 install gymnasium[other] | ||
|
||
%environment | ||
export LC_ALL=C | ||
|
||
#script that will be executed with the "run" command : run the tests in rlberry, the longtests, and then export the exit code inside a text file | ||
%runscript | ||
pip list | ||
cd /tmp/rlberry_test_dir && \ | ||
pytest rlberry && \ | ||
pytest long_tests/rl_agent/ltest_mbqvi_applegold.py long_tests/torch_agent/ltest_a2c_cartpole.py long_tests/torch_agent/ltest_ctn_ppo_a2c_pendulum.py long_tests/torch_agent/ltest_dqn_montaincar.py | ||
|
||
echo $? > [path]/exit_code.txt | ||
|
||
#Run all the long test | ||
#pytest long_tests/**/*.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters