Show More
@@ -1,20 +1,7 b'' | |||
|
1 | """Manage IPython.parallel clusters in the notebook. | |
|
1 | """Manage IPython.parallel clusters in the notebook.""" | |
|
2 | 2 | |
|
3 | Authors: | |
|
4 | ||
|
5 | * Brian Granger | |
|
6 | """ | |
|
7 | ||
|
8 | #----------------------------------------------------------------------------- | |
|
9 | # Copyright (C) 2008-2011 The IPython Development Team | |
|
10 | # | |
|
11 | # Distributed under the terms of the BSD License. The full license is in | |
|
12 | # the file COPYING, distributed as part of this software. | |
|
13 | #----------------------------------------------------------------------------- | |
|
14 | ||
|
15 | #----------------------------------------------------------------------------- | |
|
16 | # Imports | |
|
17 | #----------------------------------------------------------------------------- | |
|
3 | # Copyright (c) IPython Development Team. | |
|
4 | # Distributed under the terms of the Modified BSD License. | |
|
18 | 5 | |
|
19 | 6 | from tornado import web |
|
20 | 7 | |
@@ -26,13 +13,6 b' from IPython.utils import py3compat' | |||
|
26 | 13 | from IPython.utils.path import get_ipython_dir |
|
27 | 14 | |
|
28 | 15 | |
|
29 | #----------------------------------------------------------------------------- | |
|
30 | # Classes | |
|
31 | #----------------------------------------------------------------------------- | |
|
32 | ||
|
33 | ||
|
34 | ||
|
35 | ||
|
36 | 16 | class ClusterManager(LoggingConfigurable): |
|
37 | 17 | |
|
38 | 18 | profiles = Dict() |
@@ -74,16 +54,24 b' class ClusterManager(LoggingConfigurable):' | |||
|
74 | 54 | def update_profiles(self): |
|
75 | 55 | """List all profiles in the ipython_dir and cwd. |
|
76 | 56 | """ |
|
57 | ||
|
58 | stale = set(self.profiles) | |
|
77 | 59 | for path in [get_ipython_dir(), py3compat.getcwd()]: |
|
78 | 60 | for profile in list_profiles_in(path): |
|
61 | if profile in stale: | |
|
62 | stale.remove(profile) | |
|
79 | 63 | pd = self.get_profile_dir(profile, path) |
|
80 | 64 | if profile not in self.profiles: |
|
81 |
self.log.debug("Adding cluster profile '%s'" |
|
|
65 | self.log.debug("Adding cluster profile '%s'", profile) | |
|
82 | 66 | self.profiles[profile] = { |
|
83 | 67 | 'profile': profile, |
|
84 | 68 | 'profile_dir': pd, |
|
85 | 69 | 'status': 'stopped' |
|
86 | 70 | } |
|
71 | for profile in stale: | |
|
72 | # remove profiles that no longer exist | |
|
73 | self.log.debug("Profile '%s' no longer exists", profile) | |
|
74 | self.profiles.pop(stale) | |
|
87 | 75 | |
|
88 | 76 | def list_profiles(self): |
|
89 | 77 | self.update_profiles() |
General Comments 0
You need to be logged in to leave comments.
Login now