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: |
|
3 | # Copyright (c) IPython Development Team. | |
4 |
|
4 | # Distributed under the terms of the Modified BSD License. | ||
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 | #----------------------------------------------------------------------------- |
|
|||
18 |
|
5 | |||
19 | from tornado import web |
|
6 | from tornado import web | |
20 | from zmq.eventloop import ioloop |
|
7 | from zmq.eventloop import ioloop | |
@@ -27,13 +14,6 b' from IPython.utils import py3compat' | |||||
27 | from IPython.utils.path import get_ipython_dir |
|
14 | from IPython.utils.path import get_ipython_dir | |
28 |
|
15 | |||
29 |
|
16 | |||
30 | #----------------------------------------------------------------------------- |
|
|||
31 | # Classes |
|
|||
32 | #----------------------------------------------------------------------------- |
|
|||
33 |
|
||||
34 |
|
||||
35 |
|
||||
36 |
|
||||
37 | class ClusterManager(LoggingConfigurable): |
|
17 | class ClusterManager(LoggingConfigurable): | |
38 |
|
18 | |||
39 | profiles = Dict() |
|
19 | profiles = Dict() | |
@@ -75,16 +55,24 b' class ClusterManager(LoggingConfigurable):' | |||||
75 | def update_profiles(self): |
|
55 | def update_profiles(self): | |
76 | """List all profiles in the ipython_dir and cwd. |
|
56 | """List all profiles in the ipython_dir and cwd. | |
77 | """ |
|
57 | """ | |
|
58 | ||||
|
59 | stale = set(self.profiles) | |||
78 | for path in [get_ipython_dir(), py3compat.getcwd()]: |
|
60 | for path in [get_ipython_dir(), py3compat.getcwd()]: | |
79 | for profile in list_profiles_in(path): |
|
61 | for profile in list_profiles_in(path): | |
|
62 | if profile in stale: | |||
|
63 | stale.remove(profile) | |||
80 | pd = self.get_profile_dir(profile, path) |
|
64 | pd = self.get_profile_dir(profile, path) | |
81 | if profile not in self.profiles: |
|
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 | self.profiles[profile] = { |
|
67 | self.profiles[profile] = { | |
84 | 'profile': profile, |
|
68 | 'profile': profile, | |
85 | 'profile_dir': pd, |
|
69 | 'profile_dir': pd, | |
86 | 'status': 'stopped' |
|
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 | def list_profiles(self): |
|
77 | def list_profiles(self): | |
90 | self.update_profiles() |
|
78 | self.update_profiles() |
General Comments 0
You need to be logged in to leave comments.
Login now