Skip to content

Commit

Permalink
Enhancements for Tabular View & Benchmark Parser
Browse files Browse the repository at this point in the history
Related to adoptium#136 adoptium/aqa-tests#1144 adoptium#37

Tabular View Changes
	- Enabled the setting of JDK date (i.e. benchmarkProduct) to be dynamic instead of expecting the launch agents such as PerfNext or TestKitGen to set it.
		○ JDK date is used on Tabular View to show the data of latest baseline and test builds before that JDK date.
	- Updated the Tabular View query for fetching unique build names, sdk resource and build servers, options that are displayed for choosing desired baseline or test builds for comparison
		○ Query didn't have the correct SDK resource location.
	- Resolved the issue of Tabular View incorrectly setting states for dropdown options
	- Fixed the Tabular View query for getting the filtered data by updating the SDK resource location

Benchmark Parser Changes
	- Enable the parsing of some benchmarks such Liberty under Adopt openjdk-tests repo to be parsed by TRSS. This design to be extended further in future PRs to allow parsing of other benchmarks as well.
	- Simplied perf parser regexes to get various benchmark info such as benchmark name, variant and JDK info
		○ Removed some constraints so that all info can be parsed without being affected by Jenkins timestamps
	- Updated the Java version regex for capture all kinds of JDK builds (IBM J9, Open J9, HotSpot, OpenJDK)
	- Moved `javaVersion` to higher common level in data structure
	- Updated Perf graph widgets to use `jdkDate` instead of `jdkBuildDateUnixTime`
	- Removed  `jdkBuildDateUnixTime` since it's redundant now as we're storing the jdk
	- Renamed `benchmarkProduct` to `jdkDate` to reflect the correct data that it's storing and updated the code in Data Manager, Perf Compare and Tabular View
	- Enabled parsing for ODM 300 Ruleset

Signed-off-by: Piyush Gupta <piyush286@gmail.com>
  • Loading branch information
piyush286 committed Sep 19, 2019
1 parent 1b1c295 commit 4cbdb89
Show file tree
Hide file tree
Showing 13 changed files with 80 additions and 88 deletions.
3 changes: 2 additions & 1 deletion TestResultSummaryService/parsers/BenchmarkMetricRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const BenchmarkMetricRouter = {
"17dev-4way-0-256-qs": "LibertyStartup"
},
"ILOG_WODM": {
"881-4way-Seg5FastpathRVEJB": "ILOG_WODM"
"881-4way-Seg5FastpathRVEJB": "ILOG_WODM",
"881-4way-Seg300RulesFastpathRVEJB": "ILOG_WODM"
},
"SPECjbb2015": {
"multi_2grp_gencon": "SPECjbb2015"
Expand Down
50 changes: 21 additions & 29 deletions TestResultSummaryService/parsers/BenchmarkParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ const Parser = require( './Parser' );
const BenchmarkMetricRouter = require( './BenchmarkMetricRouter' );
const BenchmarkMetric = require( './BenchmarkMetric' );

const benchmarkDelimiterRegex = /[\r\n]\*\*\*\*\*\*\*\*\*\* START OF NEW TESTCI BENCHMARK JOB \*\*\*\*\*\*\*\*\*\*[\r\n]/;
const benchmarkNameRegex = /[\r\n]Benchmark Name: (.*) Benchmark Variant: .*[\r\n]/;
const benchmarkVariantRegex = /[\r\n]Benchmark Name: .* Benchmark Variant: (.*)[\r\n]/;
const benchmarkProductRegex = /[\r\n]Benchmark Product: (.*)[\r\n]/;
const productResourceRegex = /[\r\n]Product Resource: (.*)[\r\n]/;
const javaVersionRegex = /(java version[\s\S]*JCL.*\n)/;
const javaBuildDateRegex = /-(20[0-9][0-9][0-9][0-9][0-9][0-9])_/;
const benchmarkDelimiterRegex = /\*\*\*\*\*\*\*\*\*\* START OF NEW TESTCI BENCHMARK JOB \*\*\*\*\*\*\*\*\*\*[\r\n]/;
const benchmarkNameRegex = /Benchmark Name: (.*) Benchmark Variant: .*[\r\n]/;
const benchmarkVariantRegex = /Benchmark Name: .* Benchmark Variant: (.*)[\r\n]/;
const productResourceRegex = /Product Resource: (.*)[\r\n]/;
//TODO: Remove Jenkins timestamps from being collected
const javaVersionRegex = /((openjdk|java) version[\s\S]*JCL.*\n|(openjdk|java) version[\s\S]*Server VM.*\n)/;
const javaBuildDateRegex = /-(20[0-9][0-9][0-9][0-9][0-9][0-9])/;

class BenchmarkParser extends Parser {

Expand Down Expand Up @@ -48,13 +48,12 @@ class BenchmarkParser extends Parser {

let curBenchmarkName = null;
let curBenchmarkVariant = null;
let curBenchmarkProduct = null;
let curBenchVariant = null;
let curMetric = null;
let curSearchString = null;
let curRegexResult = null;
let curMetricValue = null;
let curJavaBuildDate = null;
let curJdkDate = null;
let curJavaVersion = null;
let curProductResource = null;
let isValid = true;
Expand Down Expand Up @@ -85,9 +84,13 @@ class BenchmarkParser extends Parser {
isValid = false;
}

// Parse benchmark product
if ( ( curRegexResult = benchmarkProductRegex.exec( curItr.value ) ) !== null ) {
curBenchmarkProduct = curRegexResult[1];
// Parse Java version
if ( ( curRegexResult = javaVersionRegex.exec( curItr.value ) ) !== null ) {
curJavaVersion = curRegexResult[1];
}

if ( ( curRegexResult = javaBuildDateRegex.exec( curJavaVersion ) ) !== null ) {
curJdkDate = curRegexResult[1];
}

if ( ( curRegexResult = productResourceRegex.exec( curItr.value ) ) !== null ) {
Expand All @@ -99,12 +102,12 @@ class BenchmarkParser extends Parser {
curBenchVariant = BenchmarkMetric[BenchmarkMetricRouter[curBenchmarkName][curBenchmarkVariant]];
curSearchString = curItr.value;

// if outerregex is undefined, all runs should be measured. Parse metrics in every run
// if outerregex is defined, any runs before outerregex will be ignored. Parse metrics in warm runs only
// if outerRegex is undefined, all runs should be measured. Parse metrics in every run
// if outerRegex is defined, any runs before outerRegex will be ignored. Parse metrics in warm runs only
if (curBenchVariant.outerRegex !== undefined) {
if ( ( curRegexResult = curBenchVariant.outerRegex.exec( curSearchString ) ) !== null ) {
// index 0 contains entire text (curItr.value)
// index 1 contains text after the outer regex
// index 1 contains text after the outerRegex
curSearchString = curRegexResult[1];
}
}
Expand All @@ -126,18 +129,6 @@ class BenchmarkParser extends Parser {
curMetricValue = curRegexResult.filter ( (value,index) => (index %2 == 1) ? parseFloat(value):null);
curTestData["metrics"].push({name: curMetric.name, value: curMetricValue});
}
// Parse Java version
if ( ( curRegexResult = javaVersionRegex.exec( curItr.value ) ) !== null ) {
curJavaVersion = curRegexResult[1];
} else {
curJavaVersion = "benchmarkProduct: " + curBenchmarkProduct;
}
curTestData["javaVersion"] = curJavaVersion;

if ( ( curRegexResult = javaBuildDateRegex.exec( curJavaVersion ) ) !== null ) {
curJavaBuildDate = curRegexResult[1];
}
curTestData["jdkBuildDateUnixTime"] = this.convertBuildDateToUnixTime( curJavaBuildDate );
}

tests.push( {
Expand All @@ -146,9 +137,10 @@ class BenchmarkParser extends Parser {
testIndex: testIndex++,
benchmarkName: curBenchmarkName,
benchmarkVariant: curBenchmarkVariant,
benchmarkProduct: curBenchmarkProduct,
testData: curTestData,
jdkDate: curJdkDate,
sdkResource: curProductResource,
javaVersion: curJavaVersion,
testData: curTestData,
} );

curItr = benchmarkIterator.next();
Expand Down
12 changes: 6 additions & 6 deletions TestResultSummaryService/perf/DataManagerAggregate.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ const ObjectID = require( 'mongodb' ).ObjectID;
class DataManagerAggregate {
static aggDataCollect(childBuild) {
const benchmarkMetricsCollection = {};
let name, variant, product;
let name, variant, jdkBuildDate;
if (Array.isArray(childBuild.tests) && childBuild.tests.length > 0 ) {
name = childBuild.tests[0].benchmarkName;
variant = childBuild.tests[0].benchmarkVariant;
product = childBuild.tests[0].benchmarkProduct;
jdkBuildDate = childBuild.tests[0].jdkDate;
for ( let {testData} of childBuild.tests){
if ( Array.isArray(testData.metrics) ) {
for ( let {name, value} of testData.metrics ){
Expand All @@ -22,12 +22,12 @@ class DataManagerAggregate {
}
}
}
return {name, variant, product, benchmarkMetricsCollection};
return {name, variant, jdkBuildDate, benchmarkMetricsCollection};
}

static async updateBuildWithAggregateInfo(id, testResultsDB, name, variant, product, metricsCollection) {
static async updateBuildWithAggregateInfo(id, testResultsDB, name, variant, jdkBuildDate, metricsCollection) {
// calculate the aggregate data
if (name != null && variant != null && product != null && metricsCollection != null) {
if (name != null && variant != null && jdkBuildDate != null && metricsCollection != null) {
const aggData = [];
const aggregateInfo = [];
Object.keys( metricsCollection ).forEach( function(key) {
Expand All @@ -51,7 +51,7 @@ class DataManagerAggregate {
aggregateInfo.push({
benchmarkName: name,
benchmarkVariant: variant,
benchmarkProduct: product,
jdkDate: jdkBuildDate,
metrics: aggData
});
const criteria = { _id: new ObjectID( id ) };
Expand Down
20 changes: 10 additions & 10 deletions TestResultSummaryService/plugins/DataManagerPerf.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module.exports.onBuildDone = async (task, { testResultsDB, logger }) => {
logger.debug("onBuildDone", task.buildName);
if ( task.type === "Perf" ) {
if ( !task.aggregateInfo ) {
let benchmarkName, benchmarkVariant, benchmarkProduct;
let benchmarkName, benchmarkVariant, jdkDate;
const metricsCollection = {};
if ( task.hasChildren ) {
// parent node.
Expand All @@ -13,20 +13,20 @@ module.exports.onBuildDone = async (task, { testResultsDB, logger }) => {
//loop into the child build list
for ( let childBuild of childBuildList ) {
//loop into each child's tests info.
const {name, variant, product, benchmarkMetricsCollection} = DataManagerAggregate.aggDataCollect(childBuild)
if (name === null || product === null || product === null || benchmarkMetricsCollection === null ) {
const {name, variant, jdkBuildDate, benchmarkMetricsCollection} = DataManagerAggregate.aggDataCollect(childBuild)
if (name === null || variant === null || jdkBuildDate === null || benchmarkMetricsCollection === null ) {
// failed child build, continue with other children
continue;
} else {
if (benchmarkName === undefined && benchmarkVariant === undefined && benchmarkProduct === undefined) {
if (benchmarkName === undefined && benchmarkVariant === undefined && jdkDate === undefined) {
benchmarkName = name;
benchmarkVariant = variant;
benchmarkProduct = product;
} else if ( name != benchmarkName || variant != benchmarkVariant || product != benchmarkProduct ){
jdkDate = jdkBuildDate;
} else if ( name != benchmarkName || variant != benchmarkVariant || jdkBuildDate != jdkDate ){
//children's builds information are not the same
benchmarkName = null;
benchmarkVariant = null;
benchmarkProduct = null;
jdkDate = null;
metricsCollection = null;
break;
}
Expand All @@ -43,11 +43,11 @@ module.exports.onBuildDone = async (task, { testResultsDB, logger }) => {
}
}
// update aggregateInfo in the database.
await DataManagerAggregate.updateBuildWithAggregateInfo(task._id, testResultsDB, benchmarkName, benchmarkVariant, benchmarkProduct, metricsCollection);
await DataManagerAggregate.updateBuildWithAggregateInfo(task._id, testResultsDB, benchmarkName, benchmarkVariant, jdkDate, metricsCollection);
} else {
// not a parent node.
const {name, variant, product, benchmarkMetricsCollection} = DataManagerAggregate.aggDataCollect(task)
await DataManagerAggregate.updateBuildWithAggregateInfo(task._id, testResultsDB, name, variant, product, benchmarkMetricsCollection);
const {name, variant, jdkBuildDate, benchmarkMetricsCollection} = DataManagerAggregate.aggDataCollect(task)
await DataManagerAggregate.updateBuildWithAggregateInfo(task._id, testResultsDB, name, variant, jdkBuildDate, benchmarkMetricsCollection);
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions TestResultSummaryService/routes/getTabularData.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { TestResultsDB, ObjectID } = require( '../Database' );

function exceedDate(jdkDate) {
return function(element) {
return parseInt(element.aggregateInfo[0].benchmarkProduct.slice(-8)) <= parseInt(jdkDate);
return parseInt(element.aggregateInfo[0].jdkDate) <= parseInt(jdkDate);
}
}

Expand Down Expand Up @@ -48,16 +48,16 @@ module.exports = async ( req, res ) => {
let benchmarkQuery;
// Return all entries that match the current benchmark and platform
for (item in platforms) {
benchmarkQuery = {$and: [{ buildName: { $regex : platforms[item] }, sdkResource: sdkResourceQuery}, { aggregateInfo: { $elemMatch: { benchmarkName: benchmarks[benchmarkIndex] }}}
benchmarkQuery = {$and: [{ buildName: { $regex : platforms[item] }}, { tests: { $elemMatch: { sdkResource: sdkResourceQuery }}}, { aggregateInfo: { $elemMatch: { benchmarkName: benchmarks[benchmarkIndex] }}}
] };
const result = await db.getData(benchmarkQuery).toArray();

// Remove all entries whose build date exceeds the chosen date
const exceedFilter = result.filter(exceedDate(req.query.jdkDate));
// Setting the latest build date from the available dates
const latestDate = Math.max.apply(Math, exceedFilter.map(function(o) { return parseInt(o.aggregateInfo[0].benchmarkProduct.slice(-8)); }));
const latestDate = Math.max.apply(Math, exceedFilter.map(function(o) { return parseInt(o.aggregateInfo[0].jdkDate); }));
// Remove all runs that are not the latest
const dateFilter = exceedFilter.filter(entry => parseInt(entry.aggregateInfo[0].benchmarkProduct.slice(-8)) === latestDate);
const dateFilter = exceedFilter.filter(entry => parseInt(entry.aggregateInfo[0].jdkDate) === latestDate);
const latest = Math.max.apply(Math, dateFilter.map(function(o) { return o.timestamp; }));
// Keep the latest build with the latest timestamp
const latestRun = dateFilter.find(function(o){ return o.timestamp == latest; })
Expand Down
5 changes: 3 additions & 2 deletions TestResultSummaryService/routes/getTabularDropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ module.exports = async ( req, res ) => {
{
$match: query
},
{$unwind: "$tests"},
{$group :
{
{
_id:0,
buildNames: {$addToSet: '$buildName'},
sdkResource: {$addToSet: '$sdkResource'},
sdkResource: {$addToSet: '$tests.sdkResource'},
buildServer: {$addToSet: '$url'},
}}
] );
Expand Down
14 changes: 7 additions & 7 deletions test-result-summary-client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -83,20 +83,20 @@ export default class DayTrader3 extends Component {
if ( t.buildResult !== "SUCCESS" ) return;
// TODO: current code only considers one interation. This needs to be updated
if ( t.tests[0].testData && t.tests[0].testData.metrics && t.tests[0].testData.metrics.length > 0 ) {
const JDKBuildTimeConvert = t.tests[0].testData.jdkBuildDateUnixTime;
const jdkDate = t.tests[0].jdkDate;
if ( !t.tests[0].testData.metrics[0].value
|| t.tests[0].testData.metrics[0].value.length === 0
|| t.tests[0].testData.metrics[0].name !== "Throughput" ) {
return;
}
resultsByJDKBuild[JDKBuildTimeConvert] = resultsByJDKBuild[JDKBuildTimeConvert] || [];
resultsByJDKBuild[JDKBuildTimeConvert].push( {
resultsByJDKBuild[jdkDate] = resultsByJDKBuild[jdkDate] || [];
resultsByJDKBuild[jdkDate].push( {
globalThroughput: t.tests[0].testData.metrics[0].value[0],
additionalData: {
testId: t.tests[0]._id,
buildName: t.buildName,
buildNum: t.buildNum,
javaVersion: t.tests[0].testData.javaVersion,
javaVersion: t.tests[0].javaVersion,
},
} );
}
Expand Down
10 changes: 5 additions & 5 deletions test-result-summary-client/src/Dashboard/Widgets/Graph/ODM.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export default class ODM extends Component {

// TODO: current code only considers one interation. This needs to be updated
if ( t.tests[0].testData && t.tests[0].testData.metrics && t.tests[0].testData.metrics.length > 0 ) {
const JDKBuildTimeConvert = t.tests[0].testData.jdkBuildDateUnixTime;
const jdkDate = t.tests[0].jdkDate;
if ( !t.tests[0].testData.metrics[0].value
|| t.tests[0].testData.metrics[0].value.length === 0
|| t.tests[0].testData.metrics[0].name !== "Global Throughput" ) {
Expand All @@ -93,15 +93,15 @@ export default class ODM extends Component {
if(!resultsByJDKBuild[t.buildName]) {
resultsByJDKBuild[t.buildName] = {};
}
if(JDKBuildTimeConvert) {
resultsByJDKBuild[t.buildName][JDKBuildTimeConvert] = resultsByJDKBuild[JDKBuildTimeConvert] || [];
resultsByJDKBuild[t.buildName][JDKBuildTimeConvert].push( {
if(jdkDate) {
resultsByJDKBuild[t.buildName][jdkDate] = resultsByJDKBuild[jdkDate] || [];
resultsByJDKBuild[t.buildName][jdkDate].push( {
globalThroughput: t.tests[0].testData.metrics[0].value[0],
additionalData: {
testId: t.tests[0]._id,
buildName: t.buildName,
buildNum: t.buildNum,
javaVersion: t.tests[0].testData.javaVersion,
javaVersion: t.tests[0].javaVersion,
},
} );
}
Expand Down
Loading

0 comments on commit 4cbdb89

Please sign in to comment.