From 83e2fb154a4e89901b57cfca1931167898a2833f Mon Sep 17 00:00:00 2001 From: mbeierl Date: Mon, 30 Jan 2017 12:14:02 -0500 Subject: Make it easier to see what's happening in Jenkins Change-Id: I3ac727faa98c1e87dcd9522c0063ca6b251c62b4 Signed-off-by: mbeierl --- ci/daily.sh | 10 ++++++---- ci/start_job.sh | 2 +- rest_server.py | 2 +- storperf/test_executor.py | 29 ++++++++++++++++++++++++----- 4 files changed, 32 insertions(+), 11 deletions(-) diff --git a/ci/daily.sh b/ci/daily.sh index 11af7f4..b31f8e6 100755 --- a/ci/daily.sh +++ b/ci/daily.sh @@ -81,12 +81,13 @@ export WORKLOAD=_warm_up WARM_UP=`$WORKSPACE/ci/start_job.sh | awk '/job_id/ {print $2}' | sed 's/"//g'` WARM_UP_STATUS=`curl -s -X GET "http://127.0.0.1:5000/api/v1.0/jobs?id=$WARM_UP&type=status" \ - | awk '/Status/ {print $2}' | sed 's/"//g'` + | awk '/Status/ {print $2}' | cut -d\" -f2` while [ "$WARM_UP_STATUS" != "Completed" ] do sleep 60 + curl -s -X GET "http://127.0.0.1:5000/api/v1.0/jobs?id=$WARM_UP&type=status" WARM_UP_STATUS=`curl -s -X GET "http://127.0.0.1:5000/api/v1.0/jobs?id=$WARM_UP&type=status" \ - | awk '/Status/ {print $2}' | sed 's/"//g'` + | awk '/Status/ {print $2}' | cut -d\" -f2` done @@ -102,12 +103,13 @@ export TEST_CASE=snia_steady_state JOB=`$WORKSPACE/ci/start_job.sh \ | awk '/job_id/ {print $2}' | sed 's/"//g'` JOB_STATUS=`curl -s -X GET "http://127.0.0.1:5000/api/v1.0/jobs?id=$JOB&type=status" \ - | awk '/Status/ {print $2}' | sed 's/"//g'` + | awk '/Status/ {print $2}' | cut -d\" -f2` while [ "$JOB_STATUS" != "Completed" ] do sleep 60 + curl -s -X GET "http://127.0.0.1:5000/api/v1.0/jobs?id=$JOB&type=status" JOB_STATUS=`curl -s -X GET "http://127.0.0.1:5000/api/v1.0/jobs?id=$JOB&type=status" \ - | awk '/Status/ {print $2}' | sed 's/"//g'` + | awk '/Status/ {print $2}' | cut -d\" -f2` done echo "Deleting stack for cleanup" diff --git a/ci/start_job.sh b/ci/start_job.sh index 86b8fc8..1a71735 100755 --- a/ci/start_job.sh +++ b/ci/start_job.sh @@ -28,7 +28,7 @@ cat << EOF > body.json } EOF -cat body.json +cat body.json 1>&2 curl -s -X POST --header 'Content-Type: application/json' \ --header 'Accept: application/json' \ diff --git a/rest_server.py b/rest_server.py index 40b9b77..5c84fdb 100644 --- a/rest_server.py +++ b/rest_server.py @@ -288,7 +288,7 @@ class Job(Resource): return jsonify(storperf.fetch_metadata(workload_id)) if type == "status": - return jsonify({"Status": storperf.fetch_job_status(workload_id)}) + return jsonify(storperf.fetch_job_status(workload_id)) @swagger.operation( parameters=[ diff --git a/storperf/test_executor.py b/storperf/test_executor.py index cda6c78..e6f0784 100644 --- a/storperf/test_executor.py +++ b/storperf/test_executor.py @@ -42,6 +42,7 @@ class TestExecutor(object): self.start_time = None self.end_time = None self.current_workload = None + self.workload_status = {} self._queue_depths = [1, 4, 8] self._block_sizes = [512, 4096, 16384] self.event_listeners = set() @@ -188,13 +189,17 @@ class TestExecutor(object): return terminated_hosts def execution_status(self, job_id): - if self.job_db.job_id != job_id: - return "Completed" - if (self._terminated is False): - return "Running" + result = {} + status = "Completed" - return "Completed" + if self.job_db.job_id == job_id and self._terminated is False: + status = "Running" + + result['Status'] = status + result['Workloads'] = self.workload_status + + return result def execute_workloads(self): self._terminated = False @@ -205,6 +210,18 @@ class TestExecutor(object): self.start_time = time.time() + self.workload_status = {} + # Prepare stats list + for workload_module in self.workload_modules: + workload_name = getattr(workload_module, "__name__") + blocksizes = self._block_sizes + iodepths = self._queue_depths + for blocksize in blocksizes: + for iodepth in iodepths: + name = '%s.%s.queue-depth.%s.block-size.%s' % \ + (self.job_db.job_id, workload_name, iodepth, blocksize) + self.workload_status[name] = "Pending" + for workload_module in self.workload_modules: workload_name = getattr(workload_module, "__name__") self.logger.info("Starting workload %s" % (workload_name)) @@ -238,6 +255,7 @@ class TestExecutor(object): blocksize)) self.logger.info("Starting run %s" % self.current_workload) + self.workload_status[self.current_workload] = "Running" scheduler = sched.scheduler(time.time, time.sleep) if self.deadline is not None \ @@ -278,6 +296,7 @@ class TestExecutor(object): self.logger.info("Completed run %s" % self.current_workload) + self.workload_status[self.current_workload] = "Completed" self._workload_executors = [] self.current_workload = None -- cgit 1.2.3-korg