summaryrefslogtreecommitdiff
path: root/server/profiler.py
diff options
context:
space:
mode:
authorjadmanski <jadmanski@592f7852-d20e-0410-864c-8624ca9c26a4>2009-05-21 22:21:04 +0000
committerjadmanski <jadmanski@592f7852-d20e-0410-864c-8624ca9c26a4>2009-05-21 22:21:04 +0000
commite753f6f4bcfce672c1789b3ccb7184b390368ac2 (patch)
tree7f0378c0b70427df89f5fb0faf15694565ee6a31 /server/profiler.py
parentf18851b80802ac21c9844b5da0a3943c0d33faae (diff)
Change the server-side profilers to use their own host objects, instead
of trying to re-use existing ones. Using existing ones was making them unreliable since we avoided using Host objects with "normal" autotest installs associated with them to avoid conflicts, so sometimes your hosts would get used, sometimes not, and it's non-obvious from a user point of view. So instead we change the profilers to look and what hostnames are in use and then create their own Host objects. However, this led to another problem, namely that the host classes themselves have a dependency on the profiler module and so now we have a circular dependency. To get around this I extracted the crashinfo and crashdump collection into a separate module, server.crashcollect. Risk: High Visibility: Make server-side profilers run much more reliably. Signed-off-by: John Admanski <jadmanski@google.com> git-svn-id: svn://test.kernel.org/autotest/trunk@3165 592f7852-d20e-0410-864c-8624ca9c26a4
Diffstat (limited to 'server/profiler.py')
-rw-r--r--server/profiler.py24
1 files changed, 16 insertions, 8 deletions
diff --git a/server/profiler.py b/server/profiler.py
index 75084983..c7279e1b 100644
--- a/server/profiler.py
+++ b/server/profiler.py
@@ -2,7 +2,7 @@ import os, itertools, shutil, tempfile
import common
from autotest_lib.client.common_lib import utils, error
-from autotest_lib.server import autotest
+from autotest_lib.server import autotest, hosts
PROFILER_TMPDIR = "/tmp/profilers"
@@ -82,18 +82,26 @@ class profiler_proxy(object):
def _install(self):
""" Install autotest on any current job hosts. """
- current_job_hosts = set(host for host in self.job.hosts
- if not host.get_autodir() or
- host.get_autodir().startswith(PROFILER_TMPDIR))
- current_profiler_hosts = set(self.installed_hosts.keys())
- # install autotest on any new hosts in job.hosts
- for host in current_job_hosts - current_profiler_hosts:
+ in_use_hosts = set(host.hostname for host in self.job.hosts
+ if not
+ (host.get_autodir() and
+ host.get_autodir().startswith(PROFILER_TMPDIR)))
+ profiler_hosts = set(self.installed_hosts.keys())
+
+ # install autotest on any new hosts in use
+ for hostname in in_use_hosts - profiler_hosts:
+ host = hosts.create_host(hostname, auto_monitor=False)
tmp_dir = host.get_tmp_dir(parent=PROFILER_TMPDIR)
at = autotest.Autotest(host)
at.install(autodir=tmp_dir)
self.installed_hosts[host] = (at, tmp_dir)
+
# drop any installs from hosts no longer in job.hosts
- for host in current_profiler_hosts - current_job_hosts:
+ hostnames_to_drop = profiler_hosts - in_use_hosts
+ hosts_to_drop = [host for host in self.installed_hosts.iterkeys()
+ if host.hostname in hostnames_to_drop]
+ for host in hosts_to_drop:
+ host.close()
del self.installed_hosts[host]