From be76af636850bda9c30c879a20d559ab5c22e825 Mon Sep 17 00:00:00 2001 From: meihuisu Date: Sun, 19 Jan 2025 17:37:01 +0000 Subject: [PATCH] wip --- ucvm_v22_7_quakeworx/Dockerfile | 45 +++++++++++++-------- ucvm_v22_7_quakeworx/build_one_quakeworx.py | 2 +- ucvm_v22_7_quakeworx/target/plot_cross.sh | 2 +- ucvm_v22_7_quakeworx/target/plot_profile.sh | 2 +- ucvm_v22_7_quakeworx/target/plot_slice.sh | 2 +- ucvm_v22_7_quakeworx/target/query.sh | 2 + ucvm_v22_7_quakeworx/target/setup | 6 +++ 7 files changed, 40 insertions(+), 21 deletions(-) create mode 100755 ucvm_v22_7_quakeworx/target/query.sh create mode 100755 ucvm_v22_7_quakeworx/target/setup diff --git a/ucvm_v22_7_quakeworx/Dockerfile b/ucvm_v22_7_quakeworx/Dockerfile index 17a96bc..e757c22 100644 --- a/ucvm_v22_7_quakeworx/Dockerfile +++ b/ucvm_v22_7_quakeworx/Dockerfile @@ -33,9 +33,10 @@ RUN useradd -ms /bin/bash -g $APP_GRPNAME --uid $APP_UID $APP_UNAME ENV HOME=/home/$APP_UNAME # Added steps to manage home directory permissions -RUN mkdir -p $HOME/.local \ - && chown -R $APP_UID:$APP_GID $HOME \ - && chmod -R 755 $HOME +RUN mkdir -p $HOME/.local && \ + mkdir -p $HOME/result && \ + chown -R $APP_UID:$APP_GID $HOME &&\ + chmod -R 755 $HOME WORKDIR /home/$APP_UNAME @@ -91,21 +92,28 @@ WORKDIR /home/$APP_UNAME/app/src/largefiles RUN ./get_largefiles.py -m $MODELID && ./stage_largefiles.py WORKDIR /home/$APP_UNAME/app/src -RUN ./ucvm_setup.py -a -d -p /home/$APP_UNAME/app/ucvm >& ./ucvm_setup_install.log +RUN ./ucvm_setup.py -a -d -p /home/$APP_UNAME/app/ucvm >& ./ucvm_setup_install.log && \ + source /home/$APP_UNAME/app/ucvm/conf/ucvm_env.sh + # Remove the src directories to save space WORKDIR /home/$APP_UNAME/app RUN rm -rf src -ENV PATH="/usr/local/opt/conda/bin:${PATH}" -ARG PATH="/usr/local/opt/conda/bin:${PATH}" -ENV PYTHONPATH="/home/ucvmuser/.local/lib/python3.12/site-packages/pycvm:${PYTHONPATH}" -ARG PYTHONPATH="/home/ucvmuser/.local/lib/python3.12/site-packages/pycvm:${PYTHONPATH}" +ENV PATH="/usr/local/opt/conda/bin:${HOME}/.local/bin:${PATH}" +ARG PATH="/usr/local/opt/conda/bin:${HOME}/.local/bin:${PATH}" +ENV PYTHONPATH="/usr/local/opt/conda/envs/plotPython/lib/python3.12/site-packages:${HOME}/.local/lib/python3.12/site-packages/pycvm:${PYTHONPATH}" +ARG PYTHONPATH="/usr/local/opt/conda/envs/plotPython/lib/python3.12/site-packages:${HOME}/.local/lib/python3.12/site-packages/pycvm:${PYTHONPATH}" + +#import site +#print(site.getsitepackages()) +#also "/usr/local/opt/conda/envs/plotPython/lib/python3.12/site-packages:${PYTHON_PATH}" + # Install plotting libraries as root -WORKDIR /home/$APP_UNAME/app -RUN git clone https://github.com/SCECcode/ucvm_plotting.git -WORKDIR /home/$APP_UNAME/app/ucvm_plotting +WORKDIR $HOME/app +RUN git clone https://github.com/SCECcode/ucvm_plotting.git -b withAnaconda3 +WORKDIR $HOME/app/ucvm_plotting RUN ./unpack-dist ## not able to unpack into system spot and so ended up at ## /home/ucvmuser/.local/lib/python3.12/site-packages/pycvm/ @@ -118,9 +126,13 @@ LABEL org.scec.responsible_person="Philip Maechling" LABEL org.scec.primary_contact="maechlin@usc.edu" LABEL version="ucvm_v22_7" -RUN echo "source /home/$APP_UNAME/app/ucvm/conf/ucvm_env.sh" >> /home/$APP_UNAME/.bashrc && \ - echo "export PATH=\"/usr/local/opt/conda/bin:$PATH\"" >> /home/$APP_UNAME/.bashrc && \ - echo "conda activate plotPython" >> /home/$APP_UNAME/.bashrc +RUN echo "source $HOME/app/ucvm/conf/ucvm_env.sh" >> $HOME/.bashrc && \ + echo "export PATH=\"/usr/local/opt/conda/bin:$PATH\"" >> $HOME/.bashrc && \ + echo "conda activate plotPython" >> $HOME/.bashrc + +RUN echo "source $HOME/app/ucvm/conf/ucvm_env.sh" > $HOME/setup && \ + echo "cd $HOME/app/ucvm_plotting; ./unpack-dist" >> $HOME/setup && \ + echo "cd $HOME/app/target" >> $HOME/setup # Added steps to manage home directory permissions RUN chown -R $APP_UID:$APP_GID $HOME && \ @@ -128,7 +140,7 @@ RUN chown -R $APP_UID:$APP_GID $HOME && \ USER $APP_UNAME -WORKDIR /home/$APP_UNAME +WORKDIR $HOME # Expose the port JupyterLab will run on EXPOSE 8888 @@ -136,8 +148,7 @@ EXPOSE 8888 # Define file input/output mounted disk #VOLUME /home/$APP_UNAME/app/target -SHELL ["/bin/bash", "--login", "-c"] -CMD ["/bin/bash" ] +CMD ["/bin/bash", "--login" ] # Define the command to run JupyterLab #ENTRYPOINT ["/usr/local/opt/conda/bin/jupyter", "lab", "--ip=0.0.0.0", "--no-browser", "--allow-root"] diff --git a/ucvm_v22_7_quakeworx/build_one_quakeworx.py b/ucvm_v22_7_quakeworx/build_one_quakeworx.py index e4858fd..26da38c 100755 --- a/ucvm_v22_7_quakeworx/build_one_quakeworx.py +++ b/ucvm_v22_7_quakeworx/build_one_quakeworx.py @@ -38,4 +38,4 @@ print("pushing models: " + m + " with sceccode/ucvm_227_%s_quakeworx:%s" % (m,mdate)) cmd = "docker push sceccode/ucvm_227_%s_quakeworx:%s" % (m,mdate) print(cmd) - os.system(cmd) +# os.system(cmd) diff --git a/ucvm_v22_7_quakeworx/target/plot_cross.sh b/ucvm_v22_7_quakeworx/target/plot_cross.sh index 0d43992..a6b20a3 100755 --- a/ucvm_v22_7_quakeworx/target/plot_cross.sh +++ b/ucvm_v22_7_quakeworx/target/plot_cross.sh @@ -1,2 +1,2 @@ -plot_cross_section.py -s 0 -h 1176 -d vs -c cvmh -a sd -o cross_cvmh.png -i $UCVM_INSTALL_PATH -v 50 -b 33.9542,-118.7512 -u 33.9651,-117.5753 -e 5000 +plot_cross_section.py -s 0 -h 1176 -d vs -c cvmh -a sd -o ../../result/cross_cvmh.png -i $UCVM_INSTALL_PATH -v 50 -b 33.9542,-118.7512 -u 33.9651,-117.5753 -e 5000 diff --git a/ucvm_v22_7_quakeworx/target/plot_profile.sh b/ucvm_v22_7_quakeworx/target/plot_profile.sh index 7b87544..d620f15 100755 --- a/ucvm_v22_7_quakeworx/target/plot_profile.sh +++ b/ucvm_v22_7_quakeworx/target/plot_profile.sh @@ -1,3 +1,3 @@ -plot_depth_profile.py -i $UCVM_INSTALL_PATH -d vs -c cvmh -o profile_cvmh.png -C 'CVM-H v15.1.1' -v 100 -b 0 -s 34.0625,-118.1633 -e 30000 +plot_depth_profile.py -i $UCVM_INSTALL_PATH -d vs -c cvmh -o ../../result/profile_cvmh.png -C 'CVM-H v15.1.1' -v 100 -b 0 -s 34.0625,-118.1633 -e 30000 diff --git a/ucvm_v22_7_quakeworx/target/plot_slice.sh b/ucvm_v22_7_quakeworx/target/plot_slice.sh index 21de73d..42572b5 100755 --- a/ucvm_v22_7_quakeworx/target/plot_slice.sh +++ b/ucvm_v22_7_quakeworx/target/plot_slice.sh @@ -1,3 +1,3 @@ -plot_horizontal_slice.py -d vs -c cvmh -s 0.011 -a sd -o slice_cvmh.png -i $UCVM_INSTALL_PATH -b 33.585,-118.7904 -u 34.559,-117.5492 -e 1000 +plot_horizontal_slice.py -d vs -c cvmh -s 0.011 -a sd -o ../../result/slice_cvmh.png -i $UCVM_INSTALL_PATH -b 33.585,-118.7904 -u 34.559,-117.5492 -e 1000 diff --git a/ucvm_v22_7_quakeworx/target/query.sh b/ucvm_v22_7_quakeworx/target/query.sh new file mode 100755 index 0000000..fd67e14 --- /dev/null +++ b/ucvm_v22_7_quakeworx/target/query.sh @@ -0,0 +1,2 @@ +ucvm_query -m cvmh -f $UCVM_INSTALL_PATH/conf/ucvm.conf -l 34.11,-118.08,1000 + diff --git a/ucvm_v22_7_quakeworx/target/setup b/ucvm_v22_7_quakeworx/target/setup new file mode 100755 index 0000000..6ae7401 --- /dev/null +++ b/ucvm_v22_7_quakeworx/target/setup @@ -0,0 +1,6 @@ +source /home/ucvmuser/app/ucvm/conf/ucvm_env.sh +cd /home/ucvmuser/app/ucvm_plotting; ./unpack-dist +cd /home/ucvmuser/app/target + +export PYTHONPATH="/usr/local/opt/conda/envs/plotPython/lib/python3.12/site-packages:${PYTHONPATH}" +