Merge pull request #6607 from minrk/cluster-load-remove

remove deleted profiles from cluster list
This commit is contained in:
Matthias Bussonnier 2014-10-05 11:45:58 +02:00
commit e808d23594

View File

@ -1,20 +1,7 @@
"""Manage IPython.parallel clusters in the notebook.
"""Manage IPython.parallel clusters in the notebook."""
Authors:
* Brian Granger
"""
#-----------------------------------------------------------------------------
# Copyright (C) 2008-2011 The IPython Development Team
#
# Distributed under the terms of the BSD License. The full license is in
# the file COPYING, distributed as part of this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
# Copyright (c) IPython Development Team.
# Distributed under the terms of the Modified BSD License.
from tornado import web
@ -26,13 +13,6 @@ from IPython.utils import py3compat
from IPython.utils.path import get_ipython_dir
#-----------------------------------------------------------------------------
# Classes
#-----------------------------------------------------------------------------
class ClusterManager(LoggingConfigurable):
profiles = Dict()
@ -74,16 +54,24 @@ class ClusterManager(LoggingConfigurable):
def update_profiles(self):
"""List all profiles in the ipython_dir and cwd.
"""
stale = set(self.profiles)
for path in [get_ipython_dir(), py3compat.getcwd()]:
for profile in list_profiles_in(path):
if profile in stale:
stale.remove(profile)
pd = self.get_profile_dir(profile, path)
if profile not in self.profiles:
self.log.debug("Adding cluster profile '%s'" % profile)
self.log.debug("Adding cluster profile '%s'", profile)
self.profiles[profile] = {
'profile': profile,
'profile_dir': pd,
'status': 'stopped'
}
for profile in stale:
# remove profiles that no longer exist
self.log.debug("Profile '%s' no longer exists", profile)
self.profiles.pop(stale)
def list_profiles(self):
self.update_profiles()