jupyterhub / batchspawner

Custom Spawner for Jupyterhub to start servers in batch scheduled systems
BSD 3-Clause "New" or "Revised" License
190 stars 134 forks source link

oauth_client_id error #117

Open davidedelvento opened 6 years ago

davidedelvento commented 6 years ago

I'm using batchspawner as described by @zonca but I am having troubles making it to work. The first issue is with the JUPYTERHUB_API_TOKEN environmental variable which is not set. I solved it in the same way @zonca did in https://github.com/zonca/batchspawner/commit/a7449e388e06ae6c0b487d7fef29e53c0eefb305 (as described in https://github.com/jupyterhub/jupyterhub/issues/1081)

However it is now failing with

Traceback (most recent call last):
  File "/glade/work/ddvento/miniconda3/lib/python3.6/site-packages/traitlets/traitlets.py", line 528, in get
    value = obj._trait_values[self.name]
KeyError: 'oauth_client_id'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/glade/work/ddvento/miniconda3/bin/jupyterhub-singleuser", line 6, in <module>
    main()
  File "/glade/work/ddvento/miniconda3/lib/python3.6/site-packages/jupyterhub/singleuser.py", line 495, in main
    return SingleUserNotebookApp.launch_instance(argv)
  File "/glade/work/ddvento/miniconda3/lib/python3.6/site-packages/jupyter_core/application.py", line 266, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/glade/work/ddvento/miniconda3/lib/python3.6/site-packages/traitlets/config/application.py", line 657, in launch_instance
    app.initialize(argv)
  File "/glade/work/ddvento/miniconda3/lib/python3.6/site-packages/jupyterhub/singleuser.py", line 402, in initialize
    return super().initialize(argv)
  File "<decorator-gen-7>", line 2, in initialize
  File "/glade/work/ddvento/miniconda3/lib/python3.6/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/glade/work/ddvento/miniconda3/lib/python3.6/site-packages/notebook/notebookapp.py", line 1602, in initialize
    self.init_webapp()
  File "/glade/work/ddvento/miniconda3/lib/python3.6/site-packages/jupyterhub/singleuser.py", line 433, in init_webapp
    self.init_hub_auth()
  File "/glade/work/ddvento/miniconda3/lib/python3.6/site-packages/jupyterhub/singleuser.py", line 428, in init_hub_auth
    if not self.hub_auth.oauth_client_id:
  File "/glade/work/ddvento/miniconda3/lib/python3.6/site-packages/traitlets/traitlets.py", line 556, in __get__
    return self.get(obj, cls)
  File "/glade/work/ddvento/miniconda3/lib/python3.6/site-packages/traitlets/traitlets.py", line 535, in get
    value = self._validate(obj, dynamic_default())
  File "/glade/work/ddvento/miniconda3/lib/python3.6/site-packages/traitlets/traitlets.py", line 593, in _validate
    value = self._cross_validate(obj, value)
  File "/glade/work/ddvento/miniconda3/lib/python3.6/site-packages/traitlets/traitlets.py", line 599, in _cross_validate
    value = obj._trait_validators[self.name](obj, proposal)
  File "/glade/work/ddvento/miniconda3/lib/python3.6/site-packages/traitlets/traitlets.py", line 907, in __call__
    return self.func(*args, **kwargs)
  File "/glade/work/ddvento/miniconda3/lib/python3.6/site-packages/jupyterhub/services/auth.py", line 484, in _ensure_not_empty
    raise ValueError("%s cannot be empty." % proposal.trait.name)
ValueError: oauth_client_id cannot be empty.

All google knows about that error is either:

Any ideas on what may be wrong here?

davidedelvento commented 6 years ago

A naive workaround of setting environmental variable export JUPYTERHUB_CLIENT_ID=abc123 apparently solved this issue. I say "apparently" because I encountered other issues, and my setting is not working, so I am not sure this is the correct way to proceed, or instead it is just kicking the can down the road (causing the issues I am experiencing now).

rkdarst commented 6 years ago

Are you by any chance setting req_keepvars ?

rkdarst commented 6 years ago

If one uses req_keepvars, it removes all previous variables that JH says should be kept. In #99 I added a new variable req_keepvars_extra which adds to, instead of removing, any previous variables.

Come to think of it, #99 was not ambitious enough. req_keepvars implies it is the main point to use, and shouldn't go overriding things by default. I will roughly switch the meaning of them for the next release (if accepted). If comments, please comment in #99 or the new PR I will do soon.

davidedelvento commented 6 years ago

It is not clear to my how one should use req_keepvars or req_keepvars_extra, but I don't have either in my jupyterhub_config.py. Are you suggesting that I should use req_keepvars_extra?

rkdarst commented 6 years ago

I'm sorry for the confusion - this is all new and not very well documented.

I would just recommend using req_keepvars_extra only in most cases. Soon, I hope that the meaning of these switch so that req_keepvars is the only thing to modify. I will notify in this issue when things change in master.

rkdarst commented 5 years ago

Was this solved enough to be closed now?

Perhaps in future the keepvars stuff will be improved so that it is more usable...

davidedelvento commented 5 years ago

Not sure if it is solved, because we put this on hiatus. @vanderwb and I will need to work on it in the coming weeks, so we could provide feedback at that time. Up to you if you prefer to close it for now and we'll reopen if we find troubles, or if you prefer to leave it open (stalled) and we will close it when confirmed. We are fine with either approach.