From eba9798119052ad35a2b53e0840f6d772abf4afc Mon Sep 17 00:00:00 2001 From: lugi0 Date: Tue, 8 Oct 2024 13:58:48 +0200 Subject: [PATCH] fetch python version at runtime Signed-off-by: lugi0 --- .../CLI/ModelRegistry/MRMS_TEST_RUNNER.ipynb | 2 +- .../ODH/JupyterHub/JupyterLabLauncher.robot | 27 ++++++++++--------- .../1301_model_registry_model_serving.robot | 11 +++++--- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/ods_ci/tests/Resources/CLI/ModelRegistry/MRMS_TEST_RUNNER.ipynb b/ods_ci/tests/Resources/CLI/ModelRegistry/MRMS_TEST_RUNNER.ipynb index 07b06e2d3..6e3a20137 100644 --- a/ods_ci/tests/Resources/CLI/ModelRegistry/MRMS_TEST_RUNNER.ipynb +++ b/ods_ci/tests/Resources/CLI/ModelRegistry/MRMS_TEST_RUNNER.ipynb @@ -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" ] }, { diff --git a/ods_ci/tests/Resources/Page/ODH/JupyterHub/JupyterLabLauncher.robot b/ods_ci/tests/Resources/Page/ODH/JupyterHub/JupyterLabLauncher.robot index 666f8a613..2fa6b1ac6 100644 --- a/ods_ci/tests/Resources/Page/ODH/JupyterHub/JupyterLabLauncher.robot +++ b/ods_ci/tests/Resources/Page/ODH/JupyterHub/JupyterLabLauncher.robot @@ -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 diff --git a/ods_ci/tests/Tests/1300__model_registry/1301_model_registry_model_serving.robot b/ods_ci/tests/Tests/1300__model_registry/1301_model_registry_model_serving.robot index a23154dcf..3be698322 100644 --- a/ods_ci/tests/Tests/1300__model_registry/1301_model_registry_model_serving.robot +++ b/ods_ci/tests/Tests/1300__model_registry/1301_model_registry_model_serving.robot @@ -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} @@ -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}