diff options
author | mbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4> | 2010-01-26 21:57:19 +0000 |
---|---|---|
committer | mbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4> | 2010-01-26 21:57:19 +0000 |
commit | 1c0e87519885238a884c7001c9b7a755fc914eaa (patch) | |
tree | 5e63c02b230821e3e36cf4721445b8124e4a557a /server | |
parent | 5b29938f7d66a537f33119c6dfca2b0d4a80b1c4 (diff) |
Extract the server-side profiler result collection code into a separate method and add a call to it from the failure log collection when a profiler fails. This will allow any incomplete (but possibly still useful) data collected before the profiler failed to still be available.
Signed-off-by: John Admanski <jadmanski@google.com>
git-svn-id: svn://test.kernel.org/autotest/trunk@4170 592f7852-d20e-0410-864c-8624ca9c26a4
Diffstat (limited to 'server')
-rw-r--r-- | server/profilers.py | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/server/profilers.py b/server/profilers.py index 5c0bff06..1d54bcff 100644 --- a/server/profilers.py +++ b/server/profilers.py @@ -139,6 +139,8 @@ class profilers(profiler_manager.profiler_manager): dir=self._get_local_profilers_dir(test, host.hostname)) os.close(fd) host.get_file(get_profiler_log_path(autodir), path) + # try to collect any partial profiler logs + self._get_profiler_logs(autodir, test, host) except (error.AutotestError, error.AutoservError): logging.exception('Profiler failure log collection failed') # swallow the exception so that we don't override an existing @@ -150,6 +152,21 @@ class profilers(profiler_manager.profiler_manager): self._get_failure_logs(autodir, test, host) + def _get_profiler_logs(self, autodir, test, host): + results_dir = get_profiler_results_dir(autodir) + local_dir = self._get_local_profilers_dir(test, host.hostname) + + self.job.remove_client_log(host.hostname, results_dir, local_dir) + + tempdir = tempfile.mkdtemp(dir=self.job.tmpdir) + try: + host.get_file(results_dir + '/', tempdir) + except error.AutoservRunError: + pass # no files to pull back, nothing we can do + utils.merge_trees(tempdir, local_dir) + shutil.rmtree(tempdir, ignore_errors=True) + + def _run_clients(self, test, hosts): """ We initialize the profilers just before start because only then we @@ -235,18 +252,7 @@ class profilers(profiler_manager.profiler_manager): # pull back all the results for host, at, autodir in hosts: - results_dir = get_profiler_results_dir(autodir) - local_dir = self._get_local_profilers_dir(test, host.hostname) - - self.job.remove_client_log(host.hostname, results_dir, local_dir) - - tempdir = tempfile.mkdtemp(dir=self.job.tmpdir) - try: - host.get_file(results_dir + '/', tempdir) - except error.AutoservRunError: - pass # no files to pull back, nothing we can do - utils.merge_trees(tempdir, local_dir) - shutil.rmtree(tempdir, ignore_errors=True) + self._get_profiler_logs(autodir, test, host) def handle_reboot(self, host): |