$WORKDIR and extra_jupyter_args

We’ve ended up with an extra_jupyter_args in our form.yml from the documentation for deploying a Jupyter Notebook app.

It doesn’t render as anything in the form from what we see.

We would like for researchers to be able to launch in their $WORKDIR of choice, and was hoping to use this field to grab some context, then (I presume) change line 13 in template/before.sh.erb to something like

export NOTEBOOK_ROOT=<%= context.extra_jupyter_args %>

Have I missed something? This is my first time around with Ruby, am still figuring things out, trying very hard not to map python/django concepts wholesale.

Its a problem with the way the app works. The form.yml only displays a field to the user if in the attributes section you actually specify a yaml map (i.e. hash) with the input type and other possible attributes. If instead of a map its set to a value, the form element is never presented to a user and the value is used instead. In that tutorial’s case we have extra_jupyter_args: "" so that is hidden. You could just delete extra_jupyter_args: "" in the form.yml and it would appear as a text box - since it is listed in the form: array it would use the default element which is a text box.

You could also do what we have here https://github.com/OSC/bc_osc_codeserver/blob/9519ced8ec8f044d3155305296bb0964a1a045b9/form.yml#L8-L13. In order to do that you would add this file picker component to the app https://github.com/OSC/bc_js_filepicker/releases/tag/v0.4.6. There is a built asset at the bottom of that release called “form.js” which you can just drop in the root of the app alongside the form.yml. (Whatever is in the form.js file gets placed below the web form in an anonymous function, so you can put whatever javascript you want there.) For convenience, here is a link to the latest asset to curl or wget: https://github.com/OSC/bc_js_filepicker/releases/download/v0.4.6/form.js

1 Like

Got both working, decided to use the second option - thanks.