Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom culling logic through hooks (like Spawner's pre_spawn_hook etc) #25

Open
consideRatio opened this issue Apr 17, 2021 · 6 comments
Labels

Comments

@consideRatio
Copy link
Member

consideRatio commented Apr 17, 2021

Proposed change

Just like the JupyterHub Spawner and JupyterHub Authenticator classes have various hooks that can be used to take various actions, I think it could make sense to expose some hooks to the JupyterHub idle culler.

I don't have a need for this personally, but reflecting on #24 adding --cull-admin-users I felt it could be relevant to allow for some custom logic to play a role in the decision to cull a user server or a JupyterHub user identity.

Who would use this feature?

Anyone that would want to make culling decisions based on user state, such as belonging to a certain group or similar.

(Optional): Suggest a solution

We add hooks that we can configure using traitlets that are given some information of relevance and where their return value could influence culling decisions. I'm not sure what hooks would make sense.

Action points

  1. Brainstorm hooks of relevance to address a various needs
  2. Suggest a reduced set of hooks that together can address most needs
  3. Make a decision if we should implement such set of hooks in this project
  4. Add a PR with hooks documented and with some tests

Related issues / PRs

@welcome

This comment has been minimized.

@Zhell1
Copy link

Zhell1 commented Dec 22, 2021

found this issue while looking for a similar solution to KubeSpawner's PreStop hook, actually needing this for the project I am working on right now.

@rccern
Copy link

rccern commented Mar 4, 2022

Hi, I have a similar use case:

In our Jupyterhub deployment we have the possibility of assigning users to nodes with GPU, which are a "scarce" resource. For this reason, we would like to have different timeouts depending on which resources the users have booked, e.g. letting sessions expire after 2h since last_activity for nodes with GPUs and 6h for nodes using only CPU.

I was thinking about customizing the should_cull https://github.com/jupyterhub/jupyterhub-idle-culler/blob/main/jupyterhub_idle_culler/__init__.py#L238 with a configurable callable which takes as inputs the user and the server objects and returns a boolean. Does it make any sense? I can work on a PR in case you find it useful

@danilopeixoto
Copy link

danilopeixoto commented May 25, 2022

Hi,

We would like to cull servers based on profile. That will be great!
For example, delete the server only if it is a minimal notebook profile.

@marty90
Copy link

marty90 commented Aug 5, 2022

I have the exact case of @rccern. We would like to cull pods for some JHub profiles faster. Is there any workaround for this?

@dasantonym
Copy link

+1 from me as well! Would be great to have this functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants