Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce support for the Jupyter/Elyra 4. #1859

Merged
merged 1 commit into from
Sep 27, 2024

Conversation

jstourac
Copy link
Member

@jstourac jstourac commented Sep 25, 2024

These changes are required to support the Jupyter/Elyra 4.x IDE version
bump which is expected in the OOTB Workbench images 2024.2+. All changes
are done so that the backward compatibility with the current
Jupyter/Elyra 3.x version is preserved.

Note: since the 'default' version of the workbench images still points
to 2024a with Jupyter 3, the line with the global env variable update to
work with Jupyter 4 is commented out now with a TODO comment.

Also, the reason why we are adding some code from the JupyterLibrary is
that we're trying to use SeleniumLibrary for the browser opening. This
doesn't match with some part of the code of the JupyterLibrary where it
is expected that some keywords that are present in both (SeleniumLibrary
and JupyterLibrary) are used from the JupyterLibrary. Since to narrow
down this discrepancy (using JupyterLibrary explicitly and completely
for the JupyterHub testing) would require more changes, I did it via
this ughly hack now having part of the source from the JupyterLibrary
directly in our codebase.
Truth is that JupyterLibrary project seems to be abandonded so we may
also think about fork it and handle it by ourselves in case we'll need
more changes there.


Tested locally so far, Jenkins env is WIP but feel free to overview if you are interested.

CI:

  1. /job/devops/job/rhoai-test-flow/501 - run against 2024a - only 1 failed test due to the expected Jupyter 4 - but the image isn't there yet, updated and that one test re-run in 502 ✅ other failed tests are probably unrelated to changes in this PR
  2. Sanity on the older image - /job/devops/job/rhoai-test-flow/503/ ✅ no regression by these changes seem to be introduced

@jstourac jstourac added needs testing Needs to be tested in Jenkins enhancements Bugfixes, enhancements, refactoring, ... in tests or libraries (PR will be listed in release-notes) labels Sep 25, 2024
@jstourac jstourac self-assigned this Sep 25, 2024
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Robocop found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

Copy link
Contributor

github-actions bot commented Sep 25, 2024

Robot Results

✅ Passed ❌ Failed ⏭️ Skipped Total Pass %
545 0 0 545 100

${sel} = Set Variable If ${version[0].__eq__('1')}
... ${JLAB1 XP ICONS['${icon}']}
... ${JLAB2 XP ICONS['${icon}']}
[Return] ${sel}

Check warning

Code scanning / Robocop

'{{ statement_name }}' is deprecated since Robot Framework version {{ version }}, use '{{ alternative }}' instead Warning test

'[Return]' is deprecated since Robot Framework version 5.*, use 'RETURN' instead
# ${version} = Get JupyterLab Page Info appVersion clear=${clear}
${version} = Get JupyterLab Page Info Custom appVersion clear=${clear} # Edited
${version_info} = Set Variable ${version.split(".")}
[Return] ${version_info}

Check warning

Code scanning / Robocop

'{{ statement_name }}' is deprecated since Robot Framework version {{ version }}, use '{{ alternative }}' instead Warning test

'[Return]' is deprecated since Robot Framework version 5.*, use 'RETURN' instead
${sel} = Set Variable If ${version[0].__eq__('1')}
... ${JLAB1 CSS ICONS['${icon}']}
... ${JLAB2 CSS ICONS['${icon}']}
[Return] ${sel}

Check warning

Code scanning / Robocop

'{{ statement_name }}' is deprecated since Robot Framework version {{ version }}, use '{{ alternative }}' instead Warning test

'[Return]' is deprecated since Robot Framework version 5.*, use 'RETURN' instead
Add And Run JupyterLab Code Cell 5 In Active Notebook @{code} n=${n}
END

Add And Run JupyterLab Code Cell 5 In Active Notebook

Check warning

Code scanning / Robocop

Keyword '{{ keyword_name }}' has too many keywords inside ({{ keyword_count }}/{{ max_allowed_count }}) Warning test

Keyword 'Add And Run JupyterLab Code Cell 5 In Active Notebook' has too many keywords inside (11/10)
${nb} = Get WebElement xpath://div${JLAB XP NB FRAG}\[${n}]
# ${run btn} = Get WebElement Relative To ${nb} xpath:div${JLAB XP NB TOOLBAR FRAG}//${run icon}
${run btn} = Get WebElement Relative To ${nb}
... xpath://*[@aria-label="notebook actions"]//*[contains(@class, "jp-CommandToolbarButton") and .//${run icon}] # Edited

Check warning

Code scanning / Robocop

Line is too long ({{ line_length }}/{{ allowed_length }}) Warning test

Line is too long (129/120)
Run Keyword If ${clear} or not ${pageInfo.__len__()} Update JupyterLab PageInfo Cache Custom # Edited
${pageInfo} = Set Variable ${JLAB PAGEINFO CACHE}
${result} = Set Variable If ${key.__len__()} ${pageInfo.get("${key}")} ${pageInfo}
[Return] ${result}

Check warning

Code scanning / Robocop

'{{ statement_name }}' is deprecated since Robot Framework version {{ version }}, use '{{ alternative }}' instead Warning test

'[Return]' is deprecated since Robot Framework version 5.*, use 'RETURN' instead
# ${txt} = JupyterLibrary.Get Element Attribute ${sel} innerHTML
${txt} = Get Element Attribute ${sel} innerHTML # Edited - our fix
${pageInfo} = JSON.Loads ${txt}
Set Suite Variable ${JLAB PAGEINFO CACHE} ${pageInfo} children=${True}

Check notice

Code scanning / Robocop

{{ set_variable_keyword }} can be replaced with VAR Note test

Set Suite Variable can be replaced with VAR
@jstourac jstourac force-pushed the jupyter4 branch 2 times, most recently from 6a34bed to 47daa9b Compare September 26, 2024 08:37
@jstourac jstourac added verified This PR has been tested with Jenkins and removed needs testing Needs to be tested in Jenkins labels Sep 26, 2024
@jstourac jstourac marked this pull request as ready for review September 26, 2024 08:38
These changes are required to support the Jupyter/Elyra 4.x IDE version
bump which is expected in the OOTB Workbench images 2024.2+. All changes
are done so that the backward compatibility with the current
Jupyter/Elyra 3.x version is preserved.

Note: since the 'default' version of the workbench images still points
to 2024a with Jupyter 3, the line with the global env variable update to
work with Jupyter 4 is commented out now with a TODO comment.

Also, the reason why we are adding some code from the JupyterLibrary is
that we're trying to use SeleniumLibrary for the browser opening. This
doesn't match with some part of the code of the JupyterLibrary where it
is expected that some keywords that are present in both (SeleniumLibrary
and JupyterLibrary) are used from the JupyterLibrary. Since to narrow
down this discrepancy (using JupyterLibrary explicitly and completely
for the JupyterHub testing) would require more changes, I did it via
this ughly hack now having part of the source from the JupyterLibrary
directly in our codebase.
Truth is that JupyterLibrary project seems to be abandonded so we may
also think about fork it and handle it by ourselves in case we'll need
more changes there.
Copy link

@jstourac jstourac enabled auto-merge (rebase) September 27, 2024 09:06
# For Jupyter 4, we need to update global default variable values (images 2024b and newer)
# This calls method from JupyterLibrary Version.resource module
# TODO - shall be uncommented once the 2024b images will land into the product
# IF "${version}"=="default" Update Globals For JupyterLab 4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the workbench pod is already running and you want to know the jupyterlab version you could use keyword Run Command In Container and run this command oc exec -n ${namespace} ${pod_name} -- jupyter --version | grep jupyterlab | awk '{print $3}'

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you Jorge. That is correct. I was a bit lazy to do it that way. I presume that having the check for default value should be sufficient for now and eventually won't be needed once we move further with another upgrade in 6 months. 🙂

@jstourac jstourac merged commit 7d509b8 into red-hat-data-services:master Sep 27, 2024
8 checks passed
@jstourac jstourac deleted the jupyter4 branch September 27, 2024 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancements Bugfixes, enhancements, refactoring, ... in tests or libraries (PR will be listed in release-notes) verified This PR has been tested with Jenkins
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants