From d53fa8488a357c82d19a750ea929493b6247fa06 Mon Sep 17 00:00:00 2001 From: George Thomas Date: Wed, 20 Dec 2023 07:17:55 -0800 Subject: [PATCH 01/15] (HP-572) check contents of pod --- jupyter-pystata-gen3-licensed/resources/wait_for_license.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh b/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh index 765a228a..986c6c67 100644 --- a/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh +++ b/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh @@ -1,6 +1,12 @@ # Signal to the distributor cron job that we want a license touch /tmp/waiting_for_license.flag +# check contents of pod +echo "Contents of data" +ls -l pd/data +echo "Contents of stata17" +ls -l /usr/local/stata17 + while [ ! -f /usr/local/stata17/stata.lic ]; do sleep 1; echo "Waiting for license."; done echo "Received a license. Starting jupyter." From c5fa20faf11efd1457158a68cf3964b57f607575 Mon Sep 17 00:00:00 2001 From: George Thomas Date: Wed, 20 Dec 2023 09:18:01 -0800 Subject: [PATCH 02/15] (HP-572) update path to data --- jupyter-pystata-gen3-licensed/resources/wait_for_license.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh b/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh index 986c6c67..42a28cc3 100644 --- a/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh +++ b/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh @@ -3,7 +3,7 @@ touch /tmp/waiting_for_license.flag # check contents of pod echo "Contents of data" -ls -l pd/data +ls -l /data echo "Contents of stata17" ls -l /usr/local/stata17 From 151b2a650c949b70bb3ddf2b67a705ad68fe7b9d Mon Sep 17 00:00:00 2001 From: George Thomas Date: Wed, 20 Dec 2023 09:28:31 -0800 Subject: [PATCH 03/15] (HP-572) add copy command for license --- jupyter-pystata-gen3-licensed/resources/wait_for_license.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh b/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh index 42a28cc3..b210e32b 100644 --- a/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh +++ b/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh @@ -7,6 +7,8 @@ ls -l /data echo "Contents of stata17" ls -l /usr/local/stata17 +cp /data/stata.lic /user/local/stata17/stata.lic + while [ ! -f /usr/local/stata17/stata.lic ]; do sleep 1; echo "Waiting for license."; done echo "Received a license. Starting jupyter." From f0befb149c0216ffa937298e1af7025ab663e5fb Mon Sep 17 00:00:00 2001 From: George Thomas Date: Wed, 20 Dec 2023 09:46:22 -0800 Subject: [PATCH 04/15] (HP-572) fix typo in file path --- jupyter-pystata-gen3-licensed/resources/wait_for_license.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh b/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh index b210e32b..85b49914 100644 --- a/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh +++ b/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh @@ -7,7 +7,7 @@ ls -l /data echo "Contents of stata17" ls -l /usr/local/stata17 -cp /data/stata.lic /user/local/stata17/stata.lic +cp /data/stata.lic /usr/local/stata17/stata.lic while [ ! -f /usr/local/stata17/stata.lic ]; do sleep 1; echo "Waiting for license."; done From 63956d2eaaecddbfb445460ea8ab8dcdf49a7882 Mon Sep 17 00:00:00 2001 From: George Thomas Date: Wed, 20 Dec 2023 10:42:46 -0800 Subject: [PATCH 05/15] (HP-572) add conditional for license exists --- .../resources/wait_for_license.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh b/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh index 85b49914..b69f30a0 100644 --- a/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh +++ b/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh @@ -1,14 +1,15 @@ # Signal to the distributor cron job that we want a license touch /tmp/waiting_for_license.flag -# check contents of pod -echo "Contents of data" -ls -l /data -echo "Contents of stata17" -ls -l /usr/local/stata17 - -cp /data/stata.lic /usr/local/stata17/stata.lic - +if [ -f /data/stata.lic ]; then + mv /data/stata.lic /usr/local/stata17/stata.lic +else + echo "Error: Missing license file /data/stata.lic" + # rm /tmp/waiting_for_license.flag + # exit 0 +fi + +# TODO: remove this after the distribute-licenses job is disabled while [ ! -f /usr/local/stata17/stata.lic ]; do sleep 1; echo "Waiting for license."; done echo "Received a license. Starting jupyter." From 55d0c853f748e284decae18acf4a76f8e5841a58 Mon Sep 17 00:00:00 2001 From: George Thomas Date: Thu, 4 Jan 2024 14:48:10 -0800 Subject: [PATCH 06/15] (HP-572) add debug statement --- jupyter-pystata-gen3-licensed/resources/wait_for_license.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh b/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh index b69f30a0..ebf696ff 100644 --- a/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh +++ b/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh @@ -1,6 +1,12 @@ # Signal to the distributor cron job that we want a license touch /tmp/waiting_for_license.flag +echo "DEBUG:" +date +ls -l /data +ls -l /home/jovian/pd +echo "Checking for license copied by sidecar" + if [ -f /data/stata.lic ]; then mv /data/stata.lic /usr/local/stata17/stata.lic else From 100ec60dbca1da66452676ca217385419f14073a Mon Sep 17 00:00:00 2001 From: George Thomas Date: Thu, 4 Jan 2024 15:40:21 -0800 Subject: [PATCH 07/15] (HP-572) wait for license from sidecar --- .../resources/wait_for_license.sh | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh b/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh index ebf696ff..5fe59686 100644 --- a/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh +++ b/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh @@ -4,19 +4,29 @@ touch /tmp/waiting_for_license.flag echo "DEBUG:" date ls -l /data -ls -l /home/jovian/pd +ls -l /home/jovyan/pd/data echo "Checking for license copied by sidecar" -if [ -f /data/stata.lic ]; then - mv /data/stata.lic /usr/local/stata17/stata.lic -else - echo "Error: Missing license file /data/stata.lic" - # rm /tmp/waiting_for_license.flag - # exit 0 -fi +# if [ -f /data/stata.lic ]; then +# mv /data/stata.lic /usr/local/stata17/stata.lic +# else +# echo "Error: Missing license file /data/stata.lic" +# # rm /tmp/waiting_for_license.flag +# # exit 0 +# fi +while [ ! -f /usr/local/stata17/stata.lic ]; +do + sleep 5 + echo "Checking for license" + if [ -f /data/stata.lic ]; then + mv /data/stata.lic /usr/local/stata17/stata.lic + fi +done + + # TODO: remove this after the distribute-licenses job is disabled -while [ ! -f /usr/local/stata17/stata.lic ]; do sleep 1; echo "Waiting for license."; done +# while [ ! -f /usr/local/stata17/stata.lic ]; do sleep 1; echo "Waiting for license."; done echo "Received a license. Starting jupyter." From e48eeebc7f01d157ccde946eeaf9ebcaeda5d3cc Mon Sep 17 00:00:00 2001 From: George Thomas Date: Thu, 4 Jan 2024 16:03:06 -0800 Subject: [PATCH 08/15] (HP-572) disable flag for cron, add debug statements --- .../resources/wait_for_license.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh b/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh index 5fe59686..7b32f581 100644 --- a/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh +++ b/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh @@ -1,5 +1,5 @@ # Signal to the distributor cron job that we want a license -touch /tmp/waiting_for_license.flag +# touch /tmp/waiting_for_license.flag echo "DEBUG:" date @@ -19,7 +19,11 @@ do sleep 5 echo "Checking for license" if [ -f /data/stata.lic ]; then - mv /data/stata.lic /usr/local/stata17/stata.lic + echo "Found license" + ls -l /data + cp /data/stata.lic /usr/local/stata17/stata.lic + echo "Copied license" + ls -l /usr/local/stata17/ fi done From 609567bac0de081ddd58d24e06298d8e6c1d669b Mon Sep 17 00:00:00 2001 From: George Thomas Date: Thu, 4 Jan 2024 17:36:46 -0800 Subject: [PATCH 09/15] (HP-572) upgrade gecko driver to 0.34 --- jupyter-pystata-gen3-licensed/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jupyter-pystata-gen3-licensed/Dockerfile b/jupyter-pystata-gen3-licensed/Dockerfile index 0994f3cd..c009bb6b 100644 --- a/jupyter-pystata-gen3-licensed/Dockerfile +++ b/jupyter-pystata-gen3-licensed/Dockerfile @@ -3,7 +3,7 @@ FROM quay.io/cdis/jupyter-pystata-user-licensed:1.2.0 USER root RUN apt-get update RUN apt-get install -y firefox -RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz +RUN wget https://github.com/mozilla/geckodriver/releases/download/v0.34.0/geckodriver-v0.34.0-linux64.tar.gz RUN tar -xvzf geckodriver* RUN mv geckodriver /bin/ From 5befcd45bc31fc64d0fb1cd407fe425ee1680a48 Mon Sep 17 00:00:00 2001 From: George Thomas Date: Thu, 4 Jan 2024 18:37:09 -0800 Subject: [PATCH 10/15] (HP-572) leave gecko driver logs for debugging --- jupyter-pystata-gen3-licensed/resources/wait_for_license.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh b/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh index 7b32f581..43bafbee 100644 --- a/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh +++ b/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh @@ -41,7 +41,7 @@ sleep 20 echo "Running Stata notebook init script." python3 /tmp/setup_licensed_notebook.py -rm geckodriver* +# rm geckodriver* echo "Init script done." rm /usr/local/stata17/stata.lic /tmp/waiting_for_license.flag From f8b153cd860757efb47e8aea6888bf47c2cf910d Mon Sep 17 00:00:00 2001 From: George Thomas Date: Fri, 5 Jan 2024 08:35:45 -0800 Subject: [PATCH 11/15] (HP-572) use FirefoxOptions for webdriver --- .../resources/setup_licensed_notebook.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jupyter-pystata-gen3-licensed/resources/setup_licensed_notebook.py b/jupyter-pystata-gen3-licensed/resources/setup_licensed_notebook.py index 5bcb435f..26622e10 100644 --- a/jupyter-pystata-gen3-licensed/resources/setup_licensed_notebook.py +++ b/jupyter-pystata-gen3-licensed/resources/setup_licensed_notebook.py @@ -1,12 +1,13 @@ from selenium import webdriver +from selenium.webdriver import FirefoxOptions from selenium.webdriver.common.keys import Keys from selenium.webdriver.firefox.options import Options from selenium.webdriver.common.by import By from selenium.webdriver.common.action_chains import ActionChains -opts = Options() -opts.headless = True +opts = FirefoxOptions() +opts.add_argument('--headless') browser = webdriver.Firefox(options=opts) print("Checking for .lic file") From ac8ca9a3a44cc481f581e697b46d6317b932e294 Mon Sep 17 00:00:00 2001 From: George Thomas Date: Wed, 10 Jan 2024 10:31:41 -0800 Subject: [PATCH 12/15] (HP-572) update base image: jupyter-pystata-user-licensed:1.2.1 --- jupyter-pystata-gen3-licensed/Dockerfile | 2 +- .../resources/wait_for_license.sh | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/jupyter-pystata-gen3-licensed/Dockerfile b/jupyter-pystata-gen3-licensed/Dockerfile index c009bb6b..d261e25a 100644 --- a/jupyter-pystata-gen3-licensed/Dockerfile +++ b/jupyter-pystata-gen3-licensed/Dockerfile @@ -1,4 +1,4 @@ -FROM quay.io/cdis/jupyter-pystata-user-licensed:1.2.0 +FROM quay.io/cdis/jupyter-pystata-user-licensed:1.2.1 USER root RUN apt-get update diff --git a/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh b/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh index 43bafbee..6f0001ba 100644 --- a/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh +++ b/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh @@ -1,10 +1,6 @@ # Signal to the distributor cron job that we want a license # touch /tmp/waiting_for_license.flag -echo "DEBUG:" -date -ls -l /data -ls -l /home/jovyan/pd/data echo "Checking for license copied by sidecar" # if [ -f /data/stata.lic ]; then @@ -14,6 +10,7 @@ echo "Checking for license copied by sidecar" # # rm /tmp/waiting_for_license.flag # # exit 0 # fi + while [ ! -f /usr/local/stata17/stata.lic ]; do sleep 5 @@ -27,8 +24,6 @@ do fi done - - # TODO: remove this after the distribute-licenses job is disabled # while [ ! -f /usr/local/stata17/stata.lic ]; do sleep 1; echo "Waiting for license."; done @@ -41,9 +36,9 @@ sleep 20 echo "Running Stata notebook init script." python3 /tmp/setup_licensed_notebook.py -# rm geckodriver* +rm geckodriver* echo "Init script done." -rm /usr/local/stata17/stata.lic /tmp/waiting_for_license.flag +rm /usr/local/stata17/stata.lic /data/stata.lic while true; do sleep 1; done From 91719f57ae29f2a13c93e9f058c804fe7b8affd8 Mon Sep 17 00:00:00 2001 From: George Thomas Date: Wed, 10 Jan 2024 13:11:32 -0800 Subject: [PATCH 13/15] (HP-572) delete old code --- .../resources/wait_for_license.sh | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh b/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh index 6f0001ba..49f8fa20 100644 --- a/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh +++ b/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh @@ -1,16 +1,7 @@ -# Signal to the distributor cron job that we want a license -# touch /tmp/waiting_for_license.flag +# Wait for license, start jupyter, initialize notebook, remove license echo "Checking for license copied by sidecar" -# if [ -f /data/stata.lic ]; then -# mv /data/stata.lic /usr/local/stata17/stata.lic -# else -# echo "Error: Missing license file /data/stata.lic" -# # rm /tmp/waiting_for_license.flag -# # exit 0 -# fi - while [ ! -f /usr/local/stata17/stata.lic ]; do sleep 5 @@ -24,9 +15,6 @@ do fi done -# TODO: remove this after the distribute-licenses job is disabled -# while [ ! -f /usr/local/stata17/stata.lic ]; do sleep 1; echo "Waiting for license."; done - echo "Received a license. Starting jupyter." start-notebook.sh $@ & From a56ae2c054ad954a1947b2effadb0a7e8a97cf90 Mon Sep 17 00:00:00 2001 From: George Thomas Date: Wed, 10 Jan 2024 13:14:19 -0800 Subject: [PATCH 14/15] (HP-572) remove debugging code --- jupyter-pystata-gen3-licensed/resources/wait_for_license.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh b/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh index 49f8fa20..b73f8c0b 100644 --- a/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh +++ b/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh @@ -8,10 +8,8 @@ do echo "Checking for license" if [ -f /data/stata.lic ]; then echo "Found license" - ls -l /data cp /data/stata.lic /usr/local/stata17/stata.lic echo "Copied license" - ls -l /usr/local/stata17/ fi done From bdb19b6f944d217202c053eeb2a982341884911d Mon Sep 17 00:00:00 2001 From: George Thomas Date: Wed, 10 Jan 2024 13:36:13 -0800 Subject: [PATCH 15/15] (HP-572) use 'mv' instead of 'cp' for license --- jupyter-pystata-gen3-licensed/resources/wait_for_license.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh b/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh index b73f8c0b..e6b127eb 100644 --- a/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh +++ b/jupyter-pystata-gen3-licensed/resources/wait_for_license.sh @@ -8,7 +8,7 @@ do echo "Checking for license" if [ -f /data/stata.lic ]; then echo "Found license" - cp /data/stata.lic /usr/local/stata17/stata.lic + mv /data/stata.lic /usr/local/stata17/stata.lic echo "Copied license" fi done @@ -25,6 +25,6 @@ python3 /tmp/setup_licensed_notebook.py rm geckodriver* echo "Init script done." -rm /usr/local/stata17/stata.lic /data/stata.lic +rm /usr/local/stata17/stata.lic while true; do sleep 1; done