aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2019-08-01 14:18:15 +0200
committerTibor Frank <tifrank@cisco.com>2019-08-01 14:18:15 +0200
commitb5170a2bc3f84815834e40923095b63879a7e4fa (patch)
tree7ad3987de3a26ab85e31dc715d4fbbeccc236f2b /resources/tools
parentcee3ad0f9cc29ffc67d9c87c58920252671beb21 (diff)
Trending: remove multitasking
Change-Id: Id331fb5bb1d2e5a4da9665b330b991010e5a11e2 Signed-off-by: Tibor Frank <tifrank@cisco.com>
Diffstat (limited to 'resources/tools')
-rw-r--r--resources/tools/presentation/input_data_parser.py90
1 files changed, 22 insertions, 68 deletions
diff --git a/resources/tools/presentation/input_data_parser.py b/resources/tools/presentation/input_data_parser.py
index 9c0e38073c..69731be9f4 100644
--- a/resources/tools/presentation/input_data_parser.py
+++ b/resources/tools/presentation/input_data_parser.py
@@ -1188,13 +1188,10 @@ class InputData(object):
return checker.data
- def _download_and_parse_build(self, pid, data_queue, job, build, repeat):
+ def _download_and_parse_build(self, job, build, repeat, pid=10000):
"""Download and parse the input data file.
:param pid: PID of the process executing this method.
- :param data_queue: Shared memory between processes. Queue which keeps
- the result data. This data is then read by the main process and used
- in further processing.
:param job: Name of the Jenkins job which generated the processed input
file.
:param build: Information about the Jenkins build which generated the
@@ -1202,7 +1199,6 @@ class InputData(object):
:param repeat: Repeat the download specified number of times if not
successful.
:type pid: int
- :type data_queue: multiprocessing.Manager().Queue()
:type job: str
:type build: dict
:type repeat: int
@@ -1283,14 +1279,6 @@ class InputData(object):
format(full_name, repr(err))))
logs.append(("INFO", " Done."))
- result = {
- "data": data,
- "state": state,
- "job": job,
- "build": build
- }
- data_queue.put(result)
-
for level, line in logs:
if level == "INFO":
logging.info(line)
@@ -1303,8 +1291,7 @@ class InputData(object):
elif level == "WARNING":
logging.warning(line)
- logging.info("Memory allocation: {0:,d}MB".format(
- resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1000))
+ return {"data": data, "state": state, "job": job, "build": build}
def download_and_parse_data(self, repeat=1):
"""Download the input data files, parse input data from input files and
@@ -1317,67 +1304,34 @@ class InputData(object):
logging.info("Downloading and parsing input files ...")
- work_queue = multiprocessing.JoinableQueue()
- manager = multiprocessing.Manager()
- data_queue = manager.Queue()
- cpus = multiprocessing.cpu_count()
-
- workers = list()
- for cpu in range(cpus):
- worker = Worker(work_queue,
- data_queue,
- self._download_and_parse_build)
- worker.daemon = True
- worker.start()
- workers.append(worker)
- os.system("taskset -p -c {0} {1} > /dev/null 2>&1".
- format(cpu, worker.pid))
-
for job, builds in self._cfg.builds.items():
for build in builds:
- work_queue.put((job, build, repeat))
-
- work_queue.join()
-
- logging.info("Done.")
- logging.info("Collecting data:")
-
- while not data_queue.empty():
- result = data_queue.get()
-
- job = result["job"]
- build_nr = result["build"]["build"]
- logging.info(" {job}-{build}".format(job=job, build=build_nr))
-
- if result["data"]:
- data = result["data"]
- build_data = pd.Series({
- "metadata": pd.Series(
- data["metadata"].values(),
- index=data["metadata"].keys()),
- "suites": pd.Series(data["suites"].values(),
- index=data["suites"].keys()),
- "tests": pd.Series(data["tests"].values(),
- index=data["tests"].keys())})
- if self._input_data.get(job, None) is None:
- self._input_data[job] = pd.Series()
- self._input_data[job][str(build_nr)] = build_data
+ result = self._download_and_parse_build(job, build, repeat)
+ build_nr = result["build"]["build"]
- self._cfg.set_input_file_name(
- job, build_nr, result["build"]["file-name"])
+ if result["data"]:
+ data = result["data"]
+ build_data = pd.Series({
+ "metadata": pd.Series(
+ data["metadata"].values(),
+ index=data["metadata"].keys()),
+ "suites": pd.Series(data["suites"].values(),
+ index=data["suites"].keys()),
+ "tests": pd.Series(data["tests"].values(),
+ index=data["tests"].keys())})
- self._cfg.set_input_state(job, build_nr, result["state"])
+ if self._input_data.get(job, None) is None:
+ self._input_data[job] = pd.Series()
+ self._input_data[job][str(build_nr)] = build_data
- logging.info("Memory allocation: {0:,d}MB".format(
- resource.getrusage(resource.RUSAGE_SELF).ru_maxrss / 1000))
+ self._cfg.set_input_file_name(
+ job, build_nr, result["build"]["file-name"])
- del data_queue
+ self._cfg.set_input_state(job, build_nr, result["state"])
- # Terminate all workers
- for worker in workers:
- worker.terminate()
- worker.join()
+ logging.info("Memory allocation: {0}kB".format(
+ resource.getrusage(resource.RUSAGE_SELF).ru_maxrss))
logging.info("Done.")