Code Monkey home page Code Monkey logo

jupyterhub-singleuser-profiles's People

Contributors

accorvin avatar anishasthana avatar daodaonocode avatar harshad16 avatar jeff-phillips-18 avatar lavlas avatar maroroman avatar rimolive avatar tsailiming avatar vaishnavihire avatar vpavlin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

jupyterhub-singleuser-profiles's Issues

503 in the UI if the jupyter hub is unable to start

If the JupyterHub pod is unable to be started, user is presented with a generic
image

This is really not helpful at all.

We figured that in this particular case it was caused by the PVC being full. We figured that our from the Pod's logs before it was killed. In this case restarting the pod doesn't help at all, because the PVC remains full.

Failed to write server-info to /opt/app-root/src/.local/share/jupyter/runtime/nbserver-144.json: [Errno 122] Disk quota exceeded

Would it be possible to show the pod's log in the UI or any indication to the problem's cause?

Drive the top profile menu by an arbitrary profile name instead of image

Currently, the main profile menu at the top of the spawner is driven by container images it finds out on the cluster. This works reasonably well but it has a couple disadvantages.

  1. it isn't intuitive for users to conceptualize the profiles by image
  2. in order to provide users with multiple options, I had to create several container images that were all identical except for the name, so that I could "hang" different spark size profiles (and env vars, etc) from them.

I believe a cleaner organization would be to simply declare the profiles in the configmap by a name (for example, "Jupyter with Large Spark Cluster"), and then the actual jupyter image is just another property of the profile, it isn't driving the menu choices per se. For example in this scheme, I would generate a single cusomized jupyter image, and it would be the same value under all the profiles. The profiles would differ only in terms of the configuration of spark cluster size (or other service configurations, etc).

Show GPU option only for specific users and images

Right now the GPU field is shown all the time. We should make this configurable in profiles - i.e. add a feature which would only show the GPU field for a list of users and/or images (so that a random user selecting minimal image does not block a GPU by mistake or intentionally)

Implement a "watcher" into JSP

This "watcher" should watch pods related to a particular user and record major events. These events could then be visualized in JH or ODH dashboard for status/error reporting.

  • Design the "watcher" process
  • Design where/how the events are stored (e.g. in a special section in user ConfigMap)
  • Propose how the events could be surfaced for the user (e.g. in JH - what is running for the user, what failed and why)

e.g.

  • notebook pod got OOM killed
  • pods deployed via services integration fail/are killed/are unschedullable
  • notebook pod and all the services are running successfully - show some green lights in JH/ODH dashboard

CC @mroman-redhat @erikerlandson

Deliver Missing Module

Hey, AICoE-CI!

Please deliver the package module for the following tag, as it missing on PyPI:

Tag: v0.1.1

Allow to store secrets via Spawner UI

Currently all env vars defined in the Spawner UI are in plain text and stored in ConfigMap.

We'd like to be able to switch the input type to password on demand and store such values in secret rather than CM.

  • Add a checkbox to env var form with label "Secret"
  • When the checkbox is checked make the value type password instead of text
  • Env vars with the checkbox checked need to be stored/loaded via secret rather than CM

PVC size per user/profile

We should provide an ability to set PVC size per user/profile similarly to what we do with memory and CPU resources.

config_map_name is not defined

@vpavlin Deployed JupyterHub as per the readme, using 'master' branch, on OpenShift Dedicated 3.11. Selected s2i-minimal-notebook:3.6, and clicked 'Spawn'. Get "Error: name 'config_map_name' is not defined". Logs from JupyterHub pod:

[D 2019-02-11 18:13:07.155 JupyterHub base:603] Initiating spawn for afeiszli

  | [D 2019-02-11 18:13:07.155 JupyterHub base:609] 0/100 concurrent spawns
  | [D 2019-02-11 18:13:07.155 JupyterHub base:612] 0 active servers
  | [E 2019-02-11 18:13:07.245 JupyterHub user:477] Unhandled error starting afeiszli's server: name 'config_map_name' is not defined
  | [D 2019-02-11 18:13:07.253 JupyterHub user:578] Deleting oauth client jupyterhub-user-afeiszli
  | [E 2019-02-11 18:13:07.264 JupyterHub pages:148] Failed to spawn single-user server with form
  | Traceback (most recent call last):
  | File "/opt/app-root/lib/python3.6/site-packages/jupyterhub/handlers/pages.py", line 146, in post
  | await self.spawn_single_user(user, options=options)
  | File "/opt/app-root/lib/python3.6/site-packages/jupyterhub/handlers/base.py", line 705, in spawn_single_user
  | timedelta(seconds=self.slow_spawn_timeout), finish_spawn_future
  | File "/opt/app-root/lib/python3.6/site-packages/jupyterhub/handlers/base.py", line 626, in finish_user_spawn
  | await spawn_future
  | File "/opt/app-root/lib/python3.6/site-packages/jupyterhub/user.py", line 489, in spawn
  | raise e
  | File "/opt/app-root/lib/python3.6/site-packages/jupyterhub/user.py", line 405, in spawn
  | await maybe_future(spawner.run_pre_spawn_hook())
  | File "/opt/app-root/lib/python3.6/site-packages/jupyterhub/spawner.py", line 716, in run_pre_spawn_hook
  | return self.pre_spawn_hook(self)
  | File "/opt/app-root/src/.jupyter/jupyterhub_config.py", line 244, in setup_environment
  | spawner.single_user_profiles.load_profiles(username=spawner.user.name)
  | File "/opt/app-root/lib/python3.6/site-packages/jupyterhub_singleuser_profiles/profiles.py", line 76, in load_profiles
  | print("Could not find config map %s" % config_map_name)
  | NameError: name 'config_map_name' is not defined

image

Allow not setting requests or limits for profiles and sizes

PR https://github.com/vpavlin/jupyterhub-singleuser-profiles/pull/22 allows us to use Kubernetes native format, but we should also allow "not setting" one of the requests/limits.

The actual issue seems to be our form dropdown for sizes - https://github.com/vpavlin/jupyterhub-singleuser-profiles/blob/master/jupyterhub_singleuser_profiles/sizes.py#L42-L46 - it would be good to use .get() to access the values in dict to make sure it does not crash if some value is not set - which is ok and a default value would be used.

Consider implementing volumes into profiles

I had a discussion with @guimou about potential feature for the profiles - adding a set of volumes mounted to the singleuser pod.

This would be useful for

  • a set of users want to have access to a shared volume (requires RWX PV(C)s)
  • a workshop requires some dataset/examples and instead of pulling it from S3, we want to have it mounted in the container
  • we want to provide additional storage to a set of users
  • specialized binaries/libraries mounted into the container

The above examples would require a JupyterHub admin to create the PVCs, add data and specify the references in profiles config

Another use case with slightly different implementation (kind of vice versa to above) might be to provide a feature to label a set of PVCs which would then be loaded and presented in the spawner UI (similarly to Images and Sizes at the moment) to make example datasets, workshop materials or generally shared storage available to users. e.g.:

jupyterhub.opendatahub.io/volume: public
jupyterhub.opendatahub.io/volume-access: ro / rw
jupyterhub.opendatahub.io/volume-group: opendatahub

The volume: public means it would be offered to all the users, volume-group: opendatahub means it would be offered to all the users in group opendatahub etc.

ETA: 3 weeks

Show more information about the images available to be spawned

Is your feature request related to a problem? Please describe.
Users don't understand the "meaning" of images, its content and which is the best to spawn for them

Describe the solution you'd like
A tooltip similar to the sizes selection

Describe alternatives you've considered
n/a

Additional context

@pacospace I think we can turn that into an RFE for JH spawner. It would be nice if you can see some (rich? markdown with links?) description to the images (possibly listing the components and so on) here:
image

Similarly to the size tooltip:
image

I know this would have to be OpenShift specific, because ImageStreams are OpenShift only. @pacospace @vpavlin do you know where would be the best place to file an RFE issue for it?

I love this idea @tumido. Let's do it!!

Originally posted by @pacospace in operate-first/support#143 (comment)

Change the implementation of how image list is gathered to use labels

cc @mroman-redhat

Do this after #15

Currently the list of images is generated by getting all ImageStreams from the namespaces and filtering by their name - looking for suffix -notebook.

To follow the best practices, we should use labels (metadata.labels) to find the ImageStreams which we want to list.

If the ImageStream has a label opendatahub.io/notebook-image: true, it should be added to the list, ignored otherwise

FYI @erikerlandson

Unify usage of Kubernetes and OpenShift API clients

There are multiple Api clients instances being used across the project. It would be good to unify the initialization and use a single instance of client - probably the OpenShift Dynamic Client since we work with both Kubernetes and OpenShift resources

Revisit how Services are deployed - do not rely on Template

Currently a service is deployed by processing a template (https://github.com/vpavlin/jupyterhub-singleuser-profiles/blob/master/jupyterhub_singleuser_profiles/service.py#L57). Since templates are going away we need to figure out a different way.

We could probably include the service resource directly in the singleuser configMap - for Spark that would mean:

Current:

          spark:
            template: 'jupyterhub-spark-operator-configmap'
            parameters:
              WORKER_NODES: '2'
              MASTER_NODES: '1'
              MASTER_MEMORY_LIMIT: '2Gi'
              MASTER_CPU_LIMIT: '1'
              MASTER_MEMORY_REQUEST: '2Gi'
              MASTER_CPU_REQUEST: '1'
              WORKER_MEMORY_LIMIT: '2Gi'
              WORKER_CPU_LIMIT: '1'
              WORKER_MEMORY_REQUEST: '2Gi'
              WORKER_CPU_REQUEST: '1'
              SPARK_IMAGE: 'quay.io/opendatahub/spark-cluster-image:spark22python36'
            return:
              SPARK_CLUSTER: 'metadata.name'

Future:

spark:
  resources:
  - apiVersion: v1
    kind: ConfigMap
    metadata:
      labels:
        radanalytics.io/kind: SparkCluster
      name: spark-cluster-${USERNAME}
    data:
      config: |-
        worker:
          instances: 2
          memoryLimit: 2Gi
          cpuLimit: 1
          memoryRequest: 2Gi
          cpuRequest: 1
        master:
          instances: 1
          memoryLimit: 2Gi
          cpuLimit: 1
          memoryRequest: 2Gi
          cpuRequest: 1
        customImage: 'quay.io/opendatahub/spark-cluster-image:spark22python36'
        env:
        - name: SPARK_METRICS_ON
          value: prometheus
  return:
    SPARK_CLUSTER: 'metadata.name'

We could also link a configMap/secret containing the resource

Thoughts, @LaVLaS @erikerlandson

Update resource definitions to follow kubernetes pod resources

Currently, we have resources limited to setting limit for memory and cpu. We'd like to be able to set requests and limits, so it would be best to standardize on the structure used by Kubernetes (https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/)

We would like to keep the current structure working for backwards compatibility

  • Change how resources are defined, processed and set in profiles.py
  • Change how resources used in sizes.py
  • Change README to show new structure of resources in sizes and profiles

CC @erikerlandson

Always set `nvidia/gpu` flag

We currently only set nvidia/gpu flag in resources of the Pod when GPU count is higher than 0. This might cause issues when a pod lands on GPU node by chance - IIUC if the nvidia/gpu: 0 is not specified, it will get access to all GPUs on the node.

The fix is simple - we just need to move the condition (https://github.com/opendatahub-io/jupyterhub-singleuser-profiles/blob/master/jupyterhub_singleuser_profiles/profiles.py#L284) from the top of the function to the mode check.

Create an API for the spawner UI

Before a dynamic UI can be made for the Spawner, an API needs to be created. Swagger API will be used for this.

A basic React UI will also be created for development purposes, which will be replaced by a proper UI later on

This will be divided into tasks and more will be added as necessary:

  • Get sizes

  • Get Images

  • Get user profile

  • Modify env vars

  • Modify selections

Project information:
https://docs.google.com/document/d/1BR9iVY9IkOEdgl4JA5Hg-C_9wSVGKEAZ1FMik6znQD8/edit?usp=sharing

Create a UI Configuration section to the main ConfigMap

To be able to configure the UI to provide only the neccessary information and in a correct manner, a configuration structure needs to be applied such as:

images:
  visible: False
gpu:
  limit: 4
  style: "input"
---------------- or
gpu:
  style: "dropdown"
  values:
    - 0
    - 2
    - 4
---------------- or
gpu:
  style: "checkbox"
envvars:
  style: "limited"/"unlimited"
  variables(if limited):
    - "example1"
    - "example2"

That is to say, the admin should be able to set whether a component is visible, what style it has (if applicable). Environment variables could be limited for example and only pre-written, GPU could be set by either a dropdown, checkbox or input. And any component could be set to not appear in the UI if neccessary.

Make all HTML IDs unique

IDs in HTML tags need to be unique. Review the UI react code generating the HTML to either use unique IDs everywhere, or switch some of those to class - e.g. droptxt

Implement support for defining additional volumes in profiles

Example profile:

- name: globals
    env:
    - name: THIS_IS_GLOBAL
      value: "This will appear in all singleuser pods"
    resources:
      requests:
        memory: "500Mi"
        cpu: "250m"
      limits:
        memory: "1Gi"
        cpu: "500m"
    volumes:
    - name: dataset
      persistentVolumeClaim:
        claimName: example-dataset-pvc
      mountPath(1): /opt/app-root/src/example-dataset
      mountPaht(2): ./example-dataset (add prefix)
      (3) no-mountPath: /opt/app-root/src/$(name)

References:

Implements first use case of #38

Use a production WSGI server

In the logs for v1.0.0 of ODH I've noticed that jsp's flask app is claiming to use the built-in WSGI server, which is not meant for production use. Can we swap this out for something like gunicorn or gevent?

Happy to work on a PR for this.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.