From 934d7a0764a2ba2ab50f77b48cf195426530dc19 Mon Sep 17 00:00:00 2001 From: bharnden Date: Mon, 15 Oct 2018 08:33:06 -0700 Subject: [PATCH] couple changes for cleanup in perflogserver.py and daemon/setup.py --- daemon/setup.py | 8 ++++---- scripts/perf/perflogserver.py | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/daemon/setup.py b/daemon/setup.py index 7011ae70..af94a735 100644 --- a/daemon/setup.py +++ b/daemon/setup.py @@ -14,14 +14,14 @@ _EXAMPLES_DIR = "share/core" def recursive_files(data_path, files_path): - data_files = [] - for path, directories, filenames in os.walk(files_path): + all_files = [] + for path, _directories, filenames in os.walk(files_path): directory = os.path.join(data_path, path) files = [] for filename in filenames: files.append(os.path.join(path, filename)) - data_files.append((directory, files)) - return data_files + all_files.append((directory, files)) + return all_files def glob_files(glob_path): diff --git a/scripts/perf/perflogserver.py b/scripts/perf/perflogserver.py index 40d68891..a4c2c469 100755 --- a/scripts/perf/perflogserver.py +++ b/scripts/perf/perflogserver.py @@ -12,7 +12,6 @@ node metrics: throughput, mem, cpu total, usr, sys, wait import commands import optparse import os -import pdb import signal import sys import time @@ -116,8 +115,8 @@ def checkserverthreshold(metricval): for key in serverthresholds.getkeys(): if key == "processorusedcputime": pcpus = metricval.getvalue(key) - for ind in range(0, len(pcpus)): - if pcpus[ind] > serverthresholds.getvalue(key): + for ind, pcpu in enumerate(pcpus): + if pcpu > serverthresholds.getvalue(key): alarm = ["server", os.uname()[1], str(ind) + key, "%.2f" % pcpus[ind], ">", serverthresholds.getvalue(key)] if options.timestamp: