SwissDataScienceCenter / renku-notebooks

An API service to provide jupyter notebooks for the Renku platform.
https://renkulab.io
Apache License 2.0
6 stars 7 forks source link

Update server_options API response #683

Open lorenzo-cavazzi opened 3 years ago

lorenzo-cavazzi commented 3 years ago

The proposed changes for the server options endpoint GET server_options are:

olevski commented 3 years ago

@lorenzo-cavazzi I would like to add a few things to this:

So if we add the hidden option then the value of the server_options would be something like this:

"mem_request": {
  "default": "1G",
  "displayName": "Amount of Memory",
  "options": [
    {"label": "1 GB", "value": 1},
    {"label": "2 GB", "value": 2},
  ],
  "order": 3,
  "type": "enum",
  "hidden": false
}

And this hidden field will be mandatory in the values.yaml file.

Also when I say "all server options" I am referring to the list below.

lorenzo-cavazzi commented 3 years ago

This is more of a question - do you want the default field to use the label or value? I don't really have a preference either way - just thought I would bring it up.

The value, so /lab would work.

I would like to add the option to set some fields to be "hidden" so that their defaults are enforced but the selection options are not shown.

Ok fine, so the UI will ignore all the hidden objects

Can we use labels for memory that are compatible with k8s? I.e. Gi or G because it would be nice to show the same units when I return information about the session and what its limit/request in k8s is. If we use GB then I have to convert the value in k8s from G or Gi to GB. K8s does not recognize GB. Or do you think that G/Gi are too confusing for users?

My idea of labels is a user-friendly name, nothing that would be sent back to a renku-notebooks API. In this case, I would send back the value (i.e. the number of GBs) and the renku-notebooks API could add any required suffix.

Can we agree on what the notebooks should expect from the UI when someone is launching a session? Am I going to always get all server options in the request and if anything is missing then I do not launch a session?

I think all options are currently expected or it fails, right? I would keep it unchanged, so we prevent accidentally starting sessions with unexpected parameters due to a UI error. Do you prefer getting back also the hidden options?

olevski commented 3 years ago

@lorenzo-cavazzi in the latest release of renku-notebooks server options are not expected. You can definitely start a notebook with no options specified or even only with just some of them specified.

The logic is as follows:

What I would really like to do is remove the hardcoded defaults in the notebook service. The unreleased version of the notebook service achieves this by adding a section called serverDefaults to the values.yaml file where defaults for all server options have to be passed. Then it uses this as the ultimate default rather than the hardcoded values. The part of the values.yaml that specifies the server options that are passed to the ui in the server_options endpoint does not require all server options to be included - that is why this new serverDefaults section was added.

What we can do going forward is:

olevski commented 3 years ago

And I am in agreement with all other points you made in the last post above.

lorenzo-cavazzi commented 3 years ago

Ok for me it's fine if the API doesn't fail when an option is missing, as long as the default value passed to the UI for every option is also the fallback value applied by the notebook service (this will be the case from your description).

The UI already allows users to choose only values accepted by the server_options. I should double-check if invalid properties (e.g. set manually or through the command line) are already discarded.