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 | from zmq.eventloop import ioloop |
@@ -27,13 +14,6 b' from IPython.utils import py3compat' | |||
|
27 | 14 | from IPython.utils.path import get_ipython_dir |
|
28 | 15 | |
|
29 | 16 | |
|
30 | #----------------------------------------------------------------------------- | |
|
31 | # Classes | |
|
32 | #----------------------------------------------------------------------------- | |
|
33 | ||
|
34 | ||
|
35 | ||
|
36 | ||
|
37 | 17 | class ClusterManager(LoggingConfigurable): |
|
38 | 18 | |
|
39 | 19 | profiles = Dict() |
@@ -75,16 +55,24 b' class ClusterManager(LoggingConfigurable):' | |||
|
75 | 55 | def update_profiles(self): |
|
76 | 56 | """List all profiles in the ipython_dir and cwd. |
|
77 | 57 | """ |
|
58 | ||
|
59 | stale = set(self.profiles) | |
|
78 | 60 | for path in [get_ipython_dir(), py3compat.getcwd()]: |
|
79 | 61 | for profile in list_profiles_in(path): |
|
62 | if profile in stale: | |
|
63 | stale.remove(profile) | |
|
80 | 64 | pd = self.get_profile_dir(profile, path) |
|
81 | 65 | if profile not in self.profiles: |
|
82 |
self.log.debug("Adding cluster profile '%s'" |
|
|
66 | self.log.debug("Adding cluster profile '%s'", profile) | |
|
83 | 67 | self.profiles[profile] = { |
|
84 | 68 | 'profile': profile, |
|
85 | 69 | 'profile_dir': pd, |
|
86 | 70 | 'status': 'stopped' |
|
87 | 71 | } |
|
72 | for profile in stale: | |
|
73 | # remove profiles that no longer exist | |
|
74 | self.log.debug("Profile '%s' no longer exists", profile) | |
|
75 | self.profiles.pop(stale) | |
|
88 | 76 | |
|
89 | 77 | def list_profiles(self): |
|
90 | 78 | self.update_profiles() |
General Comments 0
You need to be logged in to leave comments.
Login now