remove deleted profiles from cluster list

MinRK 12 years ago
parent ed43a196b4
commit 1f231f7b5a

@ -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
from zmq.eventloop import ioloop
@ -27,13 +14,6 @@ from IPython.utils import py3compat
from IPython.utils.path import get_ipython_dir
#-----------------------------------------------------------------------------
# Classes
#-----------------------------------------------------------------------------
class ClusterManager(LoggingConfigurable):
profiles = Dict()
@ -75,16 +55,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()

Loading…
Cancel
Save