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

feat(python-jupyter): Setting up venv in a dedicated volume #958

Merged
merged 1 commit into from
May 25, 2021

Conversation

sunix
Copy link
Contributor

@sunix sunix commented May 17, 2021

Signed-off-by: Sun Seng David TAN sutan@redhat.com

What does this PR do?

Sidecar part, using the same venv folder for:

  • jupyter notebook from the python plugin
  • projects with dependencies in requirements.txt

Screenshot/screencast of this PR

https://youtu.be/FPZa5jc8sYE

What issues does this PR fix or reference?

eclipse-che/che#16818

How to test this PR?

will come with the plugin part (in a second PR once this is merged) but could be tested with:

apiVersion: 1.0.0
metadata:
  generateName: python-jupyter-
projects:
  - name: jupyter-hello-world1
    source:
      startPoint: master
      location: 'https://github.com/chasbecker/TextAnalysis.git'
      type: git
components:
  - id: ms-python/python/latest
    registryUrl: 'https://sunix-che-plugin-registry-dev-i1viq.surge.sh/v3'
    type: chePlugin
  - mountSources: true
    memoryLimit: 512Mi
    type: dockerimage
    volumes:
      - name: venv
        containerPath: /home/user/.venv
    image: 'quay.io/eclipse/che-python-3.8:7.29.0'
    alias: python
commands:
  - name: set up venv with requirements
    actions:
      - workdir: /home/user
        type: exec
        command: python -m venv .venv && . .venv/bin/activate && python -m pip install -r /projects/jupyter-hello-world1/requirements.txt
        component: python

and the flow:

  1. open AzureTextAnalyticsRestAPI.ipynb
  2. wait for the jupyter notebook to be loaded
  3. try to run the first lines with imports
  4. it should fail with errors that could not find the module requests
  5. run the task set up venv with requirements
  6. try to run again the first lines with imports
  7. it should now fail: cannot find pandas
  8. add to the file requirements.txt
    pandas==1.2.4
    
  9. run the task set up venv with requirements
  10. try to run again the first lines with imports
  11. it should now works, even the next part of the notebook

PR Checklist

As the author of this Pull Request I made sure that:

Reviewers

Reviewers, please comment how you tested the PR when approving it.

sidecars/python/etc/entrypoint.sh Outdated Show resolved Hide resolved
sidecars/python/etc/entrypoint.sh Outdated Show resolved Hide resolved
@sunix sunix force-pushed the python-jupyter-sidecar branch 7 times, most recently from 5fdab27 to 90dd3ad Compare May 21, 2021 19:38
Copy link
Contributor

@benoitf benoitf left a comment

Choose a reason for hiding this comment

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

Screenshot 2021-05-25 at 11 41 28

If you could merge the RUN instructions to reduce the number of layers

One RUN instead of 3

@openshift-ci
Copy link

openshift-ci bot commented May 25, 2021

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: benoitf, sunix

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot removed the lgtm label May 25, 2021
@openshift-ci
Copy link

openshift-ci bot commented May 25, 2021

New changes are detected. LGTM label has been removed.

@sunix sunix force-pushed the python-jupyter-sidecar branch from ae06ad5 to 90dd3ad Compare May 25, 2021 14:27
Signed-off-by: Sun Seng David TAN <sutan@redhat.com>
@sunix sunix force-pushed the python-jupyter-sidecar branch from 90dd3ad to ade1202 Compare May 25, 2021 15:00
@sunix
Copy link
Contributor Author

sunix commented May 25, 2021

@benoitf ... for some reasons when i tried to merge, the gh actions are broken ... it works well locally with podman but it is hard for me to fix it as i cannot reproduce. OK to merge like that ?

@openshift-ci
Copy link

openshift-ci bot commented May 25, 2021

@sunix: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/prow/v7-plugins-test-pr-check ade1202 link /test v7-plugins-test-pr-check

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants