JIRA: BOTTLENECK-100
Modify all the code in the utils folder into PEP8 style.
Using more standard way to realize our function.
Change-Id: I965c507390adcb4404d33710f783b22241542890
Signed-off-by: liyin <liyin11@huawei.com>
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
\ No newline at end of file
+##############################################################################
##############################################################################
##############################################################################
-import subprocess as subp
import sys
from rubbos_collector import RubbosCollector
from uploader import Uploader
def printUsage():
import sys
from rubbos_collector import RubbosCollector
from uploader import Uploader
def printUsage():
- print "Usage: python process_data.py required_params(**) optional_params([])"
+ print ("Usage: python process_data.py required_params(**)"
+ " optional_params([])")
print " ** -i|--input input_data_dir"
print " ** -s|--suite suite_name"
print " ** -c|--conf conf_file"
print " ** -i|--input input_data_dir"
print " ** -s|--suite suite_name"
print " ** -c|--conf conf_file"
def get_onetime_data(dir_name):
def get_onetime_data(dir_name):
- cmd = "grep -in 'remote client nodes' %s/index.html|awk '{print $5}'|awk -F '<' '{print $1}'" % dir_name
+ cmd = ("grep -in 'remote client nodes' %s/index.html|awk "
+ "'{print $5}'|awk -F '<' '{print $1}'" % dir_name)
client_node_num = int(exec_shell(cmd))
client_node_num = int(exec_shell(cmd))
- cmd = "grep -n 'Number of clients' %s/index.html|awk '{print $5}'|awk -F '<' '{print $1}'" % dir_name
+ cmd = ("grep -n 'Number of clients' %s/index.html|awk "
+ "'{print $5}'|awk -F '<' '{print $1}'" % dir_name)
each_client_num = int(exec_shell(cmd))
total_client = (client_node_num + 1) * each_client_num
each_client_num = int(exec_shell(cmd))
total_client = (client_node_num + 1) * each_client_num
- cmd = 'grep -n "throughput" %s/stat_client*.html |awk -F "<B>" \'{if (FNR%%2==0 && FNR%%4!=0) {printf "%%s\\n", $3}}\'|awk \'BEGIN{sum=0;}{sum=sum+$1;}END{print sum}\'' % dir_name
+ cmd = ('grep -n "throughput" %s/stat_client*.html |awk -F "<B>"'
+ ' \'{if (FNR%%2==0 && FNR%%4!=0) {printf "%%s\\n", $3}}\'|awk \''
+ 'BEGIN{sum=0;}{sum=sum+$1;}END{print sum}\'' % dir_name)
throughput = int(exec_shell(cmd))
throughput = int(exec_shell(cmd))
- cmd = 'grep -n "Total" %s/stat_client*.html |awk -F "<B>" \'{if (FNR==4) {printf "%%s\\n", $4}}\'|awk -F "</B>" \'BEGIN{sum=0;}{sum=sum+$1;}END{print sum}\'' % dir_name
+ cmd = ('grep -n "Total" %s/stat_client*.html |awk -F "<B>"'
+ ' \'{if (FNR==4) {printf "%%s\\n", $4}}\'|awk -F "</B>"'
+ ' \'BEGIN{sum=0;}{sum=sum+$1;}END{print sum}\'' % dir_name)
request = int(exec_shell(cmd))
request = int(exec_shell(cmd))
- cmd = 'grep -n "Total" %s/stat_client*.html |awk -F "<B>" \'{if (FNR==4) {printf "%%s\\n", $5}}\'|awk -F "</B>" \'BEGIN{sum=0;}{sum=sum+$1;}END{print sum}\'' % dir_name
+ cmd = ('grep -n "Total" %s/stat_client*.html |awk -F "<B>"'
+ ' \'{if (FNR==4) {printf "%%s\\n", $5}}\'|awk -F "</B>"'
+ ' \'BEGIN{sum=0;}{sum=sum+$1;}END{print sum}\'' % dir_name)
error_request = int(exec_shell(cmd))
return total_client, throughput, request, error_request
error_request = int(exec_shell(cmd))
return total_client, throughput, request, error_request
cmd = 'ls -l %s |grep ^d|awk \'{print $9}\'' % data_home
result = []
for subdir in exec_shell(cmd).split('\n'):
cmd = 'ls -l %s |grep ^d|awk \'{print $9}\'' % data_home
result = []
for subdir in exec_shell(cmd).split('\n'):
- total_client, throughput, request, error_request = get_onetime_data(
- data_home + '/' + subdir)
+ total_client, throughput, request, error_request = \
+ get_onetime_data(data_home + '/' + subdir)
result.append({'client': total_client,
'throughput': throughput,
'request': request,
result.append({'client': total_client,
'throughput': throughput,
'request': request,
- #data = '{"details": [{"client": 200, "throughput": 20}, {"client": 300, "throughput": 20}], "case_name": "rubbos"}'
+ # data = '{"details": [{"client": 200, "throughput": 20},
+ # {"client": 300, "throughput": 20}], "case_name": "rubbos"}'
if len(sys.argv) < 2:
print ("no argumens input!!")
exit(1)
if len(sys.argv) < 2:
print ("no argumens input!!")
exit(1)
data = json.load(stream)
Uploader().upload_result(data)
data = json.load(stream)
Uploader().upload_result(data)
if __name__ == "__main__":
_test()
if __name__ == "__main__":
_test()
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
-##############################################################################
\ No newline at end of file
+##############################################################################
return api_version
return DEFAULT_HEAT_API_VERSION
return api_version
return DEFAULT_HEAT_API_VERSION
def get_nova_api_version():
api_version = os.getenv('OS_COMPUTE_API_VERSION')
if api_version is not None:
def get_nova_api_version():
api_version = os.getenv('OS_COMPUTE_API_VERSION')
if api_version is not None:
if api_version is not None:
log.info("GLANCE_API_VERSION is set in env as '%s'", api_version)
return api_version
if api_version is not None:
log.info("GLANCE_API_VERSION is set in env as '%s'", api_version)
return api_version
- return DEFAULT_GLANCE_API_VERSION
\ No newline at end of file
+ return DEFAULT_GLANCE_API_VERSION
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################
# ------------------------------------------------------
# Directories and file locations
# ------------------------------------------------------
# Directories and file locations
i += 1
if self.uuid is not None:
i += 1
if self.uuid is not None:
- sys.exit("delete stack failed!!!")
+ sys.exit("delete stack failed!!!")
- HeatStack.stacks.remove(self)
+ HeatStack.stacks.remove(self)
@staticmethod
def delete_all():
@staticmethod
def delete_all():