diff --git a/test-result-summary-client/src/Dashboard/Widgets/Graph/Renaissance.jsx b/test-result-summary-client/src/Dashboard/Widgets/Graph/Renaissance.jsx index 8ffe23a1..0a44c6b9 100644 --- a/test-result-summary-client/src/Dashboard/Widgets/Graph/Renaissance.jsx +++ b/test-result-summary-client/src/Dashboard/Widgets/Graph/Renaissance.jsx @@ -11,9 +11,9 @@ import { Tooltip, } from 'react-jsx-highstock'; import DateRangePickers from '../DateRangePickers'; -import { Radio, message } from 'antd'; +import { Radio } from 'antd'; import BenchmarkMath from '../../../PerfCompare/lib/BenchmarkMath'; -import { sort, std, mean, median, size } from 'mathjs'; +import { sort, std, mean, size, median } from 'mathjs'; import { parseSha, getEpochTime } from './utils'; import { fetchData } from '../../../utils/Utils'; @@ -21,7 +21,7 @@ const map = { 'renaissance-jdk11': 'Test_openjdk11_j9_sanity.perf_x86-64_linux', 'renaissance-jdk8': 'Test_openjdk8_j9_sanity.perf_x86-64_linux', 'renaissance-jdk17': 'Test_openjdk17_hs_sanity.perf_arm_linux', - 'renaissance-jdk21': 'Test_openjdk21_hs_sanity.perf_x86-64_linux', + 'renaissance-jdk21': 'Test_openjdk21_hs_sanity.perf_x86-64_linux' }; let servers = ['AdoptOpenJDK', 'CustomizedJenkins']; @@ -44,22 +44,26 @@ export class RenaissanceSetting extends Component { value={serverSelected} defaultValue={'AdoptOpenJDK'} > - {servers.map((server) => ( - - {server} - - ))} + {servers.map((server) => { + return ( + + {server} + + ); + })} - {Object.keys(map).map((key) => ( - - {map[key]} - - ))} + {Object.keys(map).map((key) => { + return ( + + {map[key]} + + ); + })} ); @@ -95,34 +99,11 @@ export default class Renaissance extends Component { async updateData() { const { buildSelected, serverSelected } = this.props; const buildName = encodeURIComponent(map[buildSelected]); - let results; - let buildInfoMap; - - try { - results = await fetchData( - `/api/getBuildHistory?type=Perf&buildName=${buildName}&status=Done&limit=100&asc` - ); - if (!Array.isArray(results)) { - throw new Error('Invalid response format'); - } - console.log('Fetched results:', results); - } catch (error) { - console.error('Error fetching build history:', error); - message.error('Failed to fetch build history'); - return; - } + let results = await fetchData( + `/api/getBuildHistory?type=Perf&buildName=${buildName}&status=Done&limit=100&asc` + ); - try { - buildInfoMap = await fetchData(`/api/getDashboardBuildInfo`); - if (typeof buildInfoMap !== 'object') { - throw new Error('Invalid response format'); - } - console.log('Fetched build info map:', buildInfoMap); - } catch (error) { - console.error('Error fetching dashboard build info:', error); - message.error('Failed to fetch dashboard build info'); - return; - } + const buildInfoMap = await fetchData(`/api/getDashboardBuildInfo`); if (serverSelected) { if (serverSelected === 'AdoptOpenJDK') { @@ -172,7 +153,7 @@ export default class Renaissance extends Component { // combine results having the same JDK build date results.forEach((t) => { - const jdkDate = t.jdkDate.trim(); // Trim the date to remove leading/trailing spaces + const jdkDate = t.jdkDate.trim(); if (t.buildResult !== 'SUCCESS' || !jdkDate) return; resultsByJDKBuild[jdkDate] = resultsByJDKBuild[jdkDate] || []; t.tests.forEach((test) => { @@ -190,27 +171,37 @@ export default class Renaissance extends Component { return; test.testData.metrics.forEach((metric) => { - if (metric.name === 'akka-uct' && metric.value.length > 0) { - akkaUct = mean(metric.value); + if (metric.name === 'akka-uct') { + if (metric.value.length > 0) { + akkaUct = mean(metric.value); + } } - if (metric.name === 'fj-kmeans' && metric.value.length > 0) { - fj = mean(metric.value); + if (metric.name === 'fj-kmeans') { + if (metric.value.length > 0) { + fj = mean(metric.value); + } } - if (metric.name === 'future-genetic' && metric.value.length > 0) { - futureGenetic = mean(metric.value); + if (metric.name === 'future-genetic') { + if (metric.value.length > 0) { + futureGenetic = mean(metric.value); + } } - if (metric.name === 'naive-bayes' && metric.value.length > 0) { - bayes = mean(metric.value); + if (metric.name === 'naive-bayes') { + if (metric.value.length > 0) { + bayes = mean(metric.value); + } } - if (metric.name === 'scala-kmeans' && metric.value.length > 0) { - scala = mean(metric.value); + if (metric.name === 'scala-kmeans') { + if (metric.value.length > 0) { + scala = mean(metric.value); + } } }); if (!akkaUct && !fj && !futureGenetic && !bayes && !scala) { return; } - + // TODO: current code only considers one interation. This needs to be updated resultsByJDKBuild[jdkDate].push({ akkaUct, fj, @@ -236,7 +227,9 @@ export default class Renaissance extends Component { const date = new Date(k).getTime(); let akkaUctGroup = resultsByJDKBuild[k] .map((x) => x['akkaUct']) - .filter((el) => el != null); + .filter(function (el) { + return el != null; + }); if (akkaUctGroup.length > 0) { akkaUctGtValues.push(mean(akkaUctGroup)); let myCi = 'N/A'; @@ -256,7 +249,9 @@ export default class Renaissance extends Component { let fjGroup = resultsByJDKBuild[k] .map((x) => x['fj']) - .filter((el) => el != null); + .filter(function (el) { + return el != null; + }); if (fjGroup.length > 0) { fjGtValues.push(mean(fjGroup)); let myCi = 'N/A'; @@ -276,12 +271,15 @@ export default class Renaissance extends Component { let futureGeneticGroup = resultsByJDKBuild[k] .map((x) => x['futureGenetic']) - .filter((el) => el != null); + .filter(function (el) { + return el != null; + }); if (futureGeneticGroup.length > 0) { futureGeneticGtValues.push(mean(futureGeneticGroup)); let myCi = 'N/A'; if (futureGeneticGroup.length > 1) { - myCi = BenchmarkMath.confidence_interval(futureGeneticGroup); + myCi = + BenchmarkMath.confidence_interval(futureGeneticGroup); } futureGeneticData.push([ date, @@ -296,7 +294,9 @@ export default class Renaissance extends Component { let bayesGroup = resultsByJDKBuild[k] .map((x) => x['bayes']) - .filter((el) => el != null); + .filter(function (el) { + return el != null; + }); if (bayesGroup.length > 0) { bayesGtValues.push(mean(bayesGroup)); let myCi = 'N/A'; @@ -316,12 +316,15 @@ export default class Renaissance extends Component { let scalaGroup = resultsByJDKBuild[k] .map((x) => x['scala']) - .filter((el) => el != null); + .filter(function (el) { + return el != null; + }); if (scalaGroup.length > 0) { scalaGtValues.push(mean(scalaGroup)); let myCi = 'N/A'; if (scalaGroup.length > 1) { - myCi = BenchmarkMath.confidence_interval(scalaGroup); + myCi = + BenchmarkMath.confidence_interval(futureGeneticGroup); } scalaData.push([ date, @@ -357,21 +360,15 @@ export default class Renaissance extends Component { scalaMean, scalaMedian, }; - const displaySeries = []; for (let key in series) { - const sortedData = series[key].sort((a, b) => a[0] - b[0]); displaySeries.push({ visible: key === 'fjData', name: key, - data: sortedData, + data: series[key].sort((a, b) => a[0] - b[0]), keys: ['x', 'y', 'additionalData', 'CI'], - events: { - click: (event) => handlePointClick(event), - }, }); } - this.setState({ displaySeries }); } @@ -385,7 +382,9 @@ export default class Renaissance extends Component { let prevPoint = i === 0 ? null : this.series.data[i - 1]; this.point.additionalData.forEach((xy) => { const { testId, buildName, buildNum } = xy; - buildLinks += ` ${buildName} #${buildNum}`; + buildLinks = + buildLinks + + ` ${buildName} #${buildNum}`; }); let lengthThis = this.point.additionalData.length; @@ -416,8 +415,6 @@ export default class Renaissance extends Component { render() { const { displaySeries } = this.state; - console.log('Rendering displaySeries:', displaySeries); - return ( @@ -466,15 +463,13 @@ export default class Renaissance extends Component { - {displaySeries.map((s) => ( - - ))} + {displaySeries.map((s) => { + return ( + + ); + })} ); } } - -function handlePointClick(event) { - console.log('Point clicked:', event.point); -}