Skip to content

Commit

Permalink
fetch python version at runtime
Browse files Browse the repository at this point in the history
Signed-off-by: lugi0 <[email protected]>
  • Loading branch information
lugi0 committed Oct 8, 2024
1 parent ee6b49a commit eba9798
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"outputs": [],
"source": [
"!pip install model_registry==0.2.6a1"
"!pip install --no-index --find-links . model_registry-0.2.6a1-py3-none-any.whl"
]
},
{
Expand Down
27 changes: 14 additions & 13 deletions ods_ci/tests/Resources/Page/ODH/JupyterHub/JupyterLabLauncher.robot
Original file line number Diff line number Diff line change
Expand Up @@ -135,21 +135,22 @@ Run Cell And Get Output
RETURN ${output}

Python Version Check
[Arguments] ${expected_version}=3.8
Add And Run JupyterLab Code Cell In Active Notebook !python --version
Wait Until JupyterLab Code Cell Is Not Active
#Get the text of the last output cell
${output} = Get Text (//div[contains(@class,"jp-OutputArea-output")])[last()]
#start is inclusive, end exclusive, get x.y from Python x.y.z string
${output} = Fetch From Right ${output} ${SPACE}
${vers} = Get Substring ${output} 0 3
${status} = Run Keyword And Return Status Should Match ${vers} ${expected_version}
IF '${status}' == 'FAIL' Run Keyword And Continue On Failure FAIL "Expected Python at version ${expected_version}, but found at v ${vers}"

[Documentation] Checks that the X.Y python version of the current Jupyterlab instance matches an expected one
[Arguments] ${expected_version}=3.8
${vers} = Get XY Python Version From Jupyterlab
${status} = Run Keyword And Return Status Should Match ${vers} ${expected_version}
IF '${status}' == 'FAIL' Run Keyword And Continue On Failure FAIL "Expected Python at version ${expected_version}, but found at v ${vers}" # robocop: disable

Get XY Python Version From Jupyterlab
[Documentation] Fetches the X.Y Python version from the current Jupyterlab instance
${output}= Run Cell And Get Output !python --version
${output}= Fetch From Right ${output} ${SPACE}
${vers}= Get Substring ${output} 0 3
RETURN ${vers}

Maybe Select Kernel
${is_kernel_selected} = Run Keyword And Return Status Page Should Not Contain Element xpath=//div[@class="jp-Dialog-buttonLabel"][.="Select"]
IF not ${is_kernel_selected} Click Button xpath=//div[@class="jp-Dialog-buttonLabel"][.="Select"]/..
${is_kernel_selected} = Run Keyword And Return Status Page Should Not Contain Element xpath=//div[@class="jp-Dialog-buttonLabel"][.="Select"]
IF not ${is_kernel_selected} SeleniumLibrary.Click Button xpath=//div[@class="jp-Dialog-buttonLabel"][.="Select"]/..

Clean Up Server
[Documentation] Cleans up user server and checks that everything has been removed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ Verify Model Registry Integration With Secured-DB
... workbench_namespace=${PRJ_TITLE}
# In the latest minimal python image these dependencies are not found by pip even though the UI shows them to be
# present. Switch to installing model registry from pip directly.
# Download Python Client Dependencies ${MR_PYTHON_CLIENT_FILES} ${MR_PYTHON_CLIENT_WHL_VERSION}
# Upload Python Client Files In The Workbench ${MR_PYTHON_CLIENT_FILES}
Download Python Client Dependencies ${MR_PYTHON_CLIENT_FILES} ${MR_PYTHON_CLIENT_WHL_VERSION}
Upload Python Client Files In The Workbench ${MR_PYTHON_CLIENT_FILES}
Upload Certificate To Jupyter Notebook ${CERTS_DIRECTORY}/domain.crt
Upload Certificate To Jupyter Notebook openshift_ca.crt
Jupyter Notebook Can Query Model Registry ${JUPYTER_NOTEBOOK}
Expand Down Expand Up @@ -309,7 +309,12 @@ Remove Deployment Files
Download Python Client Dependencies
[Documentation] Download the model-registry package for a specific platform
[Arguments] ${destination} ${package_version}
${result}= Run Process command=pip download --platform=manylinux2014_x86_64 --python-version=3.9 --abi=cp39 --only-binary=:all: --dest=${destination} ${package_version} # robocop: disable:line-too-long
# We could add --abi=cp311 as a parameter, but it does not appear to be needed as it will default to the cpython
# version compatible with the specific python version. If specified it will need to be updated to point to the
# correct cpython version (e.g. cp311 for python 3.11, cp312 for python 3.12 etc.)
Open New Notebook
${python_version}= Get XY Python Version From Jupyterlab
${result}= Run Process command=pip download --platform=manylinux2014_x86_64 --python-version=${python_version} --only-binary=:all: --dest=${destination} ${package_version} # robocop: disable:line-too-long
... shell=yes
Should Be Equal As Numbers ${result.rc} 0 ${result.stderr}

Expand Down

0 comments on commit eba9798

Please sign in to comment.