Jupyter Extensions
JupyterLab is the new web frontend for the Jupyter project. It can be extended using a mime renderer extension, this has been used to serve two purposes: displaying interactive visualizations of molecules in the output of a notebook cell, and monitoring computational jobs being executed through the platform. The decision was taken at an early point in the project to support JupyterLab extensions exclusively, although it would certainly be possible to add support for the older Jupyter web frontend if there was a big call for it.
The visualization of the molecular structure (see Fig. \ref{674871} and \ref{607756}) is accomplished by using the <oc-molecule/>
component described earlier. The widget is displayed when the user opens a cjson
file in JupyterLab, or when selecting the result of a calculation as the output of a notebook cell. Thanks to some utility functions in the openchemistry
Python package, the molecular visualization can be used for arbitrary Avogadro molecule objects. So, no matter the provenance of the molecular structure, if the user is able to convert it into an Avogadro molecule they will be able to take advantage of this JupyterLab extension to get interactive 3D visualizations in the notebook.
A JupyterLab notebook is the preferred environment to dispatch and analyze calculations performed through the platform. For this reason part of the extension offers a widget to monitor running jobs. The monitor widget (see Fig. \ref{580444}) displays a table with a row per job, and information such as the Docker image running the job, the version, and the current status. If a job is selected, it is possible to see log messages and error messages in real-time. The job monitoring widget will also instruct the user to execute the cell again to see the result once the job has completed, or it will display a failure condition if things did not go as planned.
In addition to the JupyterLab web extensions described an openchemistry Python package was developed to extend the Jupyter kernel running on the server. It uses the same RESTful API endpoints that were described in the previous section to query the data server, initiate new calculations, and monitor progress. The module also has the utility functions described so that it can work independently using local data, or take environment variables to run the notebook kernel locally and communicate with a remote data server. This results in a flexible deployment strategy where a fully integrated server can invoke a notebook with all the right environment variables set up, a local (or centralized) notebook server can be invoked with the right environment variables set, or a static notebook/local notebook can avoid using the data server and refer to local data files.