我编写了以下脚本来将 yardstick 命令的输出存储到变量(输出)中并显示变量的值。
该脚本执行良好,结果显示在控制台中。执行脚本后,我想将以下详细信息存储到变量中。但以下日志详细信息未存储到输出变量中。请帮我解决这个问题?
注意:我能够将 unix 命令的输出放入输出变量中。谁,ls -ltr 等,操作系统:Ubuntu 编程语言:Python Yardstick 命令执行 opnfv 测试用例。代码:
from time import sleep
import sys
import os
import subprocess
import pexpect
import time
script_exec_cmd="yardstick -d task start /home/test_cases/opnfv_yardstick_tc002.yaml"
output = subprocess.check_output(script_exec_cmd, shell=True)
sleep(100)
print '********************************'
print "output === >>" + output
print '****************************'
下面提到了来自控制台的信息
2020-03-16 12:22:11,895 [DEBUG] yardstick.benchmark.runners.duration duration.py:124 queue.qsize() = 1
2020-03-16 12:22:11,895 [DEBUG] yardstick.benchmark.runners.duration duration.py:125 output_queue.qsize() = 0
2020-03-16 12:22:11,919 [DEBUG] yardstick.benchmark.runners.base base.py:282 result_queue size 1
2020-03-16 12:22:11,919 [INFO] yardstick.benchmark.core.task task.py:285 Runner ended
2020-03-16 12:22:11,920 [INFO] yardstick.benchmark.core.task task.py:129 Testcase: "opnfv_yardstick_tc002" SUCCESS!!!
2020-03-16 12:22:11,920 [INFO] yardstick.benchmark.contexts.heat heat.py:472 Undeploying context 'demo-b1a42587' START
2020-03-16 12:22:53,560 [INFO] yardstick.benchmark.contexts.heat heat.py:475 Undeploying context 'demo-b1a42587' DONE
2020-03-16 12:22:53,560 [INFO] yardstick.benchmark.core.task task.py:148 Task /home/ test_cases/opnfv_yardstick_tc002.yaml finished in 242 secs
2020-03-16 12:22:53,565 [INFO] yardstick.benchmark.core.task task.py:169 Report can be found in '/tmp/report.html'
2020-03-16 12:22:53,566 [INFO] yardstick.benchmark.core.task task.py:157 Total finished in 242 secs
2020-03-16 12:22:53,566 [INFO] yardstick.benchmark.core.task task.py:160 To generate report, execute command "yardstick report generate b1a42587-2285-4bb4-9805-e1e6bcebcc11 <YAML_NAME>"
2020-03-16 12:22:53,566 [INFO] yardstick.benchmark.core.task task.py:161 Task ALL DONE, exiting
2020-03-16 12:22:53,566 [INFO] yardstick.cmd.commands.task task.py:61 Task SUCCESS
2020-03-16 12:22:53,567 [DEBUG] yardstick.benchmark.runners.base base.py:147 Terminating all runners
********************************
output === >> Writing /home/yardstick/resources/files/yardstick_key-demo-b1a42587 ...
****************************