NotebookApp not being culled

Hi all,
I just tried setting

c.NotebookApp.shutdown_no_activity_timeout = 60 * 60

in my JupyterHub configuration.

However, after spawning a notebook yesterday evening it was still running today morning.
Do you see any mistake?

Hi!
Could you show us your full jupyterhub configuration, and also tell us what Jupyter applications you were running in addition to notebook? Have you enabled the idle culler GitHub - jupyterhub/jupyterhub-idle-culler: JupyterHub service to cull idle servers and users ?

If you’re relatively new to JupyterHub you may find it’s easier to install JupyterHub using The Littlest JupyterHub — The Littlest JupyterHub v0.1 documentation

Thanks for your answer @manics, here is my (stripped down) jupyterhub config:

c.JupyterHub.allow_named_servers = True
c.PAMAuthenticator.open_sessions = False
from jupyterhub.auth import PAMAuthenticator
import pamela
from tornado import gen
class KerberosPAMAuthenticator(PAMAuthenticator):
    @gen.coroutine
    def authenticate(self, handler, data):
        """Authenticate with PAM, and return the username if login is successful.
        Return None otherwise.
        Establish credentials when authenticating instead of reinitializing them
        so that a Kerberos cred cache has the proper UID in it.
        """
        username = data['username']
        try:
            pamela.authenticate(username, data['password'], service=self.service, resetcred=pamela.PAM_ESTABLISH_CRED)
        except pamela.PAMError as e:
            if handler is not None:
                self.log.warning("PAM Authentication failed (%s@%s): %s", username, handler.request.remote_ip, e)
            else:
                self.log.warning("PAM Authentication failed: %s", e)
        else:
            return username
c.JupyterHub.authenticator_class = KerberosPAMAuthenticator
c.JupyterHub.bind_url = 'http://:8686/jupyter/'
c.JupyterHub.default_url = 'home'
c.JupyterHub.named_server_limit_per_user = 5
c.Spawner.default_url = '/lab'

import batchspawner
c.JupyterHub.tornado_settings = {
    'slow_spawn_timeout': 30,
}
c.Spawner.http_timeout = 120
c.Spawner.start_timeout = 60
c.JupyterHub.spawner_class = 'wrapspawner.ProfilesSpawner'
c.BatchSpawnerBase.req_nprocs = '2'
c.BatchSpawnerBase.req_runtime = '48:00:00'
c.BatchSpawnerBase.req_memory = '12gb'
c.BatchSpawnerBase.req_prologue = '''...'''

c.NotebookApp.shutdown_no_activity_timeout = 60 * 60

I was only running a number of python kernels in idle-mode on the worker.

Have you tried adding the idle-culler as suggested in my previous post?

I tried the idle-culler now with '--timeout=3600 and it works great, thanks :slight_smile:

Does this mean that c.NotebookApp.shutdown_no_activity_timeout has no effect?

It’s a bit complicated :smiley:

See this post

and the follow-ups, especially about turning on debug logging and ServerApp vs NotebookApp.

1 Like

I see, so as I understand the NotebookApp.shutdown_no_activity_timeout culler only culls, when there are no active kernels.
So I would have to enable kernel culling as well if I wanted that setting to work, right?

I’m not sure, most of what I know is from the linked thread!