swan-cern / jupyterhub-extensions

Customized components of the Jupyterhub server in SWAN (handlers, spawners, templates).
GNU Affero General Public License v3.0
26 stars 14 forks source link

Temporary fix for storing spawner user_options in the database #78

Closed etejedor closed 1 year ago

etejedor commented 1 year ago

The state management methods added by this commit are a temporary fix to store the user_options attribute in the database, so that it is restored after a hub restart. This is intended to fix an error in the post_stop_hook that cleans the Spark services, since that hook checks user_options to see if the user selected a Spark cluster; if the hub has restarted, those user_options are lost and the hook can't do its job.

To be removed when updating to JupyterHub 2.1.0 or higher, which has a fix: https://github.com/jupyterhub/jupyterhub/pull/3773

The clear_state method is not defined here to clear user_options, since it is invoked when spawning a new user session and it would clear the options that the user specified in the form.