Commit dc6f9571 authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

pep8: re-enable E302 (2 blank lines between functions)



This isn't a significant effort to fix, so let's just enable it to move
closer to the official Python PEP 8 guidelines.

Fix up the existing instances where we didn't already have two lines
between functions, and re-enable the pep8 warning.

Change-Id: I9cf5e7e32b9c6dfedbd1b0f9bc92951cbb2c8a0d
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Reviewed-on: https://review.gerrithub.io/399949


Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 20fbd09a
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ import os
import glob
import re


def generateCoverageReport(output_dir, repo_dir):
    with open(os.path.join(output_dir, 'coverage.log'), 'w+') as log_file:
        coveragePath = os.path.join(output_dir, '**', 'cov_total.info')
+0 −1
Original line number Diff line number Diff line
@@ -103,7 +103,6 @@ rm -f scripts/posix.log
if hash pep8; then
	echo -n "Checking Python style..."

	PEP8_ARGS+=" --ignore=E302" # ignore 'E302 expected 2 blank lines, found 1'
	PEP8_ARGS+=" --max-line-length=140"

	error=0
+7 −0
Original line number Diff line number Diff line
@@ -34,11 +34,13 @@ filename=%(device)s

"""


def interrupt_handler(signum, frame):
    fio.terminate()
    print "FIO terminated"
    sys.exit(0)


def main():

    global fio
@@ -77,10 +79,12 @@ def main():
    sys.stdout.flush()
    sys.exit(rc)


def get_target_devices():
    output = check_output('iscsiadm -m session -P 3', shell=True)
    return re.findall("Attached scsi disk (sd[a-z]+)", output)


def create_fio_config(size, q_depth, devices, test, run_time, verify):
    if not verify:
        verifyfio = ""
@@ -92,6 +96,7 @@ def create_fio_config(size, q_depth, devices, test, run_time, verify):
        fiofile += fio_job_template % {"jobnumber": i, "device": dev}
    return fiofile


def set_device_parameter(devices, filename_template, value):
    for dev in devices:
        filename = filename_template % dev
@@ -99,6 +104,7 @@ def set_device_parameter(devices, filename_template, value):
        f.write(value)
        f.close()


def configure_devices(devices):
    set_device_parameter(devices, "/sys/block/%s/queue/nomerges", "2")
    set_device_parameter(devices, "/sys/block/%s/queue/nr_requests", "128")
@@ -116,5 +122,6 @@ def configure_devices(devices):
        print "Requested queue_depth {} but only {} is supported.".format(str(requested_qd), str(qd))
    set_device_parameter(devices, "/sys/block/%s/queue/scheduler", "noop")


if __name__ == "__main__":
    main()
+6 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ run_time = ['60']
# set iter_num = ['1', '2', '3'] to repeat each test 3 times
iter_num = ['1']


def run_fio(io_size_bytes, qd, rw_mix, cpu_mask, run_num, workload, run_time_sec):
    print "Running Test: IO Size=", io_size_bytes, " QD=", qd, " Mix=", rw_mix, "CPU Mask=", cpu_mask
    string = "s_" + str(io_size_bytes) + "_q_" + str(qd) + "_m_" + str(rw_mix) + "_c_" + str(cpu_mask) + "_run_" + str(run_num)
@@ -51,6 +52,7 @@ def run_fio(io_size_bytes, qd, rw_mix, cpu_mask, run_num, workload, run_time_sec
    print "Finished Test: IO Size=", io_size_bytes, " QD=", qd, " Mix=", rw_mix, " CPU Mask=", cpu_mask
    return


def parse_results(io_size_bytes, qd, rw_mix, cpu_mask, run_num, workload, run_time_sec):
    results_array = []

@@ -107,20 +109,24 @@ def parse_results(io_size_bytes, qd, rw_mix, cpu_mask, run_num, workload, run_ti
        results_array = []
    return


def get_nvme_devices_count():
    output = check_output('lspci | grep -i Non | wc -l', shell=True)
    return int(output)


def get_nvme_devices_bdf():
    output = check_output('lspci | grep -i Non | awk \'{print $1}\'', shell=True)
    output = output.split()
    return output


def add_filename_to_conf(conf_file_name, bdf):
    filestring = "filename=trtype=PCIe traddr=0000." + bdf.replace(":", ".") + " ns=1"
    with open(conf_file_name, "a") as conf_file:
        conf_file.write(filestring + "\n")


if len(sys.argv) != 4:
    print "usage: python ", sys.argv[0], " path_to_fio_conf path_to_ioengine num_ssds"
    sys.exit()
+1 −0
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ def kill_instance(args):
    params = {'sig_name': args.sig_name}
    args.client.call('kill_instance', params)


def context_switch_monitor(args):
    params = {}
    if args.enable:
Loading