Add benchmark format function support
Allows choosing different list and info functions based on the benchmark version found. Currently only implements "legacy" version 0 with more to be added.
This commit is contained in:
		@@ -1453,6 +1453,17 @@ def ceph_benchmark_list(config, job):
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def format_list_benchmark(config, benchmark_information):
 | 
			
		||||
    # This matrix is a list of the possible format functions for a benchmark result
 | 
			
		||||
    # It is extensable in the future should newer formats be required.
 | 
			
		||||
    benchmark_matrix = {
 | 
			
		||||
        0: format_list_benchmark_legacy,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    benchmark_version = benchmark_information['test_format']
 | 
			
		||||
    return benchmark_matrix.get(benchmark_version, lambda: 'Invalid format function')(config, benchmark_information)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def format_list_benchmark_legacy(config, benchmark_information):
 | 
			
		||||
    benchmark_list_output = []
 | 
			
		||||
 | 
			
		||||
    benchmark_job_length = 20
 | 
			
		||||
@@ -1591,6 +1602,17 @@ def format_list_benchmark(config, benchmark_information):
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def format_info_benchmark(config, benchmark_information):
 | 
			
		||||
    # This matrix is a list of the possible format functions for a benchmark result
 | 
			
		||||
    # It is extensable in the future should newer formats be required.
 | 
			
		||||
    benchmark_matrix = {
 | 
			
		||||
        0: format_info_benchmark_legacy,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    benchmark_version = benchmark_information['test_format']
 | 
			
		||||
    return benchmark_matrix.get(benchmark_version, lambda: 'Invalid format function')(config, benchmark_information)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def format_info_benchmark_legacy(config, benchmark_information):
 | 
			
		||||
    if benchmark_information[0]['benchmark_result'] == "Running":
 | 
			
		||||
        return "Benchmark test is still running."
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user