def performance(registry, xml_parent, data):
 perf = XML.SubElement(xml_parent, 'hudson.plugins.performance.PerformancePublisher')
 perf.set('plugin', 'performance')
 types = ['ART', 'MRT', 'PRT']
 mappings = [('failed-threshold', 'errorFailedThreshold', 0), ('unstable-threshold', 'errorUnstableThreshold', 0), ('unstable-response-time-threshold', 'errorUnstableResponseTimeThreshold', ''), ('failed-threshold-positive', 'relativeFailedThresholdPositive', '0.0'), ('failed-threshold-negative', 'relativeFailedThresholdNegative', '0.0'), ('unstable-threshold-positive', 'relativeUnstableThresholdPositive', '0.0'), ('unstable-threshold-negative', 'relativeUnstableThresholdNegative', '0.0'), ('nth-build-number', 'nthBuildNumber', 0), ('mode-relative-thresholds', 'modeRelativeThresholds', False), ('config-type', 'configType', 'ART', types), ('mode-of-threshold', 'modeOfThreshold', False), ('fail-build', 'failBuildIfNoResultFile', False), ('compare-build-previous', 'compareBuildPrevious', False), ('mode-performance-per-test-case', 'modePerformancePerTestCase', True), ('mode-thoughput', 'modeThroughput', False)]
 helpers.convert_mapping_to_xml(perf, data, mappings, fail_required=True)
 parsers = XML.SubElement(perf, 'parsers')
 if ('report' in data):
  for item in data['report']:
   if isinstance(item, dict):
    item_name = next(iter(item.keys()))
    item_values = item.get(item_name, None)
    if (item_name == 'jmeter'):
     jmhold = XML.SubElement(parsers, 'hudson.plugins.performance.JMeterParser')
     XML.SubElement(jmhold, 'glob').text = str(item_values)
    elif (item_name == 'junit'):
     juhold = XML.SubElement(parsers, 'hudson.plugins.performance.JUnitParser')
     XML.SubElement(juhold, 'glob').text = str(item_values)
    else:
     raise JenkinsJobsException('You have not specified jmeter or junit, or you have incorrectly assigned the key value.')
   elif isinstance(item, str):
    if (item == 'jmeter'):
     jmhold = XML.SubElement(parsers, 'hudson.plugins.performance.JMeterParser')
     XML.SubElement(jmhold, 'glob').text = '**/*.jtl'
    elif (item == 'junit'):
     juhold = XML.SubElement(parsers, 'hudson.plugins.performance.JUnitParser')
     XML.SubElement(juhold, 'glob').text = '**/TEST-*.xml'
    else:
     raise JenkinsJobsException('You have not specified jmeter or junit, or you have incorrectly assigned the key value.')

def performance ( registry , xml_parent , data ) : perf = XML . SubElement ( xml_parent , 'hudson.plugins.performance.PerformancePublisher' ) perf . set ( 'plugin' , 'performance' ) types = [ 'ART' , 'MRT' , 'PRT' ] mappings = [ ( 'failed-threshold' , 'errorFailedThreshold' , 0 ) , ( 'unstable-threshold' , 'errorUnstableThreshold' , 0 ) , ( 'unstable-response-time-threshold' , 'errorUnstableResponseTimeThreshold' , '' ) , ( 'failed-threshold-positive' , 'relativeFailedThresholdPositive' , '0.0' ) , ( 'failed-threshold-negative' , 'relativeFailedThresholdNegative' , '0.0' ) , ( 'unstable-threshold-positive' , 'relativeUnstableThresholdPositive' , '0.0' ) , ( 'unstable-threshold-negative' , 'relativeUnstableThresholdNegative' , '0.0' ) , ( 'nth-build-number' , 'nthBuildNumber' , 0 ) , ( 'mode-relative-thresholds' , 'modeRelativeThresholds' , False ) , ( 'config-type' , 'configType' , 'ART' , types ) , ( 'mode-of-threshold' , 'modeOfThreshold' , False ) , ( 'fail-build' , 'failBuildIfNoResultFile' , False ) , ( 'compare-build-previous' , 'compareBuildPrevious' , False ) , ( 'mode-performance-per-test-case' , 'modePerformancePerTestCase' , True ) , ( 'mode-thoughput' , 'modeThroughput' , False ) ] helpers . convert_mapping_to_xml ( perf , data , mappings , fail_required = True ) parsers = XML . SubElement ( perf , 'parsers' ) if ( 'report' in data ) : for item in data [ 'report' ] : if isinstance ( item , dict ) : item_name = next ( iter ( item . keys ( ) ) ) item_values = item . get ( item_name , None ) if ( item_name == 'jmeter' ) : jmhold = XML . SubElement ( parsers , 'hudson.plugins.performance.JMeterParser' ) XML . SubElement ( jmhold , 'glob' ) . text = str ( item_values ) elif ( item_name == 'junit' ) : juhold = XML . SubElement ( parsers , 'hudson.plugins.performance.JUnitParser' ) XML . SubElement ( juhold , 'glob' ) . text = str ( item_values ) else : raise JenkinsJobsException ( 'You have not specified jmeter or junit, or you have incorrectly assigned the key value.' ) elif isinstance ( item , str ) : if ( item == 'jmeter' ) : jmhold = XML . SubElement ( parsers , 'hudson.plugins.performance.JMeterParser' ) XML . SubElement ( jmhold , 'glob' ) . text = '**/*.jtl' elif ( item == 'junit' ) : juhold = XML . SubElement ( parsers , 'hudson.plugins.performance.JUnitParser' ) XML . SubElement ( juhold , 'glob' ) . text = '**/TEST-*.xml' else : raise JenkinsJobsException ( 'You have not specified jmeter or junit, or you have incorrectly assigned the key value.' )
returns the performance of a partition .