ideonate / cdsdashboards

JupyterHub extension for ContainDS Dashboards
https://cdsdashboards.readthedocs.io/
Other
200 stars 38 forks source link

Allow setting a Voila file whitelist to the spawner #16

Closed onepan closed 4 years ago

onepan commented 4 years ago

Is your feature request related to a problem? Please describe. Serving a directory with the voila presentation type only serves .ipynb files, not any other static content. One use case I have is serving data as a file alongside the notebook, for both performance reasons and limiting user access.

Describe the solution you'd like Allow specifying a file whitelist, either when creating a dashboard or in the configuration files. I'm open to better solutions though

Describe alternatives you've considered There's a super hacky solution by subclassing VariableKubeSpawner, e.g.:

class ExtendedVariableKubeSpawner(VariableKubeSpawner):
    def get_args(self):
        args = super().get_args()
        if self._get_presentation_type() == 'voila':
            args.append("{--}VoilaConfiguration.file_whitelist=['.*']")
        return args

Also, data files could just be stored elsewhere (e.g., S3) and downloaded on spawn. I haven't explored this option much and don't know if users have a temporary directory that is cleaned up when the server shuts down.

Background context Most of the dashboards at my company are aimed at presenting large amounts of data in different slices or visualizations. One way we've done this is send aggregated or highlight reports. We'd want dashboards we make to support showing small, short-lived datasets even when generating that dataset is expensive.

onepan commented 4 years ago

Nevermind, it seems I was mistaken. For now, my needs are met without any whitelist

danlester commented 4 years ago

Thank you for the ideas anyway. By the way, it might make more sense to configure Voila through custom launchers in general, although at this stage it depends a bit on what you want to achieve! You can also change the built-in launchers this way.