mamba-org / gator

Conda environment and package management extension from within Jupyter
Other
260 stars 30 forks source link

Option to disable background loading. Performance improvement on JupyterLab startup. #188

Closed danilopeixoto closed 2 years ago

danilopeixoto commented 2 years ago

Description

Can Gator provide an option to disable background loading? Mamba Gator is slowing down the JupyterLab at startup.

Reproduce

mamba install -y mamba_gator

  1. Go to JupyterLab after startup.

Expected behavior

Limitating resource usage or option to disable background loading. A better performance.

Context

Environment: K8s CPUs: 2 Memory: 8G

fcollonval commented 2 years ago

Thanks for the suggestion @danilopeixoto

Introducing a new user setting will be best to address this. I can provide pointers if you want to push a PR.

danilopeixoto commented 2 years ago

Hi @fcollonval,

First, thank you for the Mamba Gator development.

Is this the line to add a condition?

https://github.com/mamba-org/gator/pull/42/files#diff-4cb47daf968330dba84ee8069d23ca03354e3e77068181e77f055b61f3719cceR41

Adding a condition here, will prevent the Gator from loading packages in background? Next loading events will happen just when using the Mamba Gator UI?

fcollonval commented 2 years ago

Is this the line to add a condition?

https://github.com/mamba-org/gator/pull/42/files#diff-4cb47daf968330dba84ee8069d23ca03354e3e77068181e77f055b61f3719cceR41

Indeed this is the one.

Adding a condition here, will prevent the Gator from loading packages in background? Next loading events will happen just when using the Mamba Gator UI?

Yes


To add a user parameter, you will need to edit the settings json schema (something like fromHistory):

https://github.com/mamba-org/gator/blob/90be2e149ce5034172400831059300224cd2ba0a/packages/labextension/schema/plugin.json#L18

Then you can modify the line:

https://github.com/mamba-org/gator/blob/90be2e149ce5034172400831059300224cd2ba0a/packages/labextension/src/index.ts#L48

like that:

-   Private.loadPackages(model);
+   if (settings?.get('<param name>') ?? true) {
+     Private.loadPackages(model);
+   }
danilopeixoto commented 2 years ago

Thanks @fcollonval. Created #190.

fcollonval commented 2 years ago

Closing as resolved.