Skip to content

Commit

Permalink
Add specific metric as run attribute (G-Research#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
jescalada authored and vinayan3 committed Aug 28, 2024
1 parent 0861213 commit 43de881
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/src/utils/app/generateGroupValues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,25 @@ export function generateGroupValues(
const fieldName = fieldTypeAndName.slice(1).join('.');

// Flatten default run attributes and store them in a single object
const runAttributes = {
let runAttributes = {
...data[i].run.params,
...data[i].run.props,
hash: data[i].run.hash,
name: fieldType === 'metric' ? data[i].name : data[i].run.props.name,
name: data[i].run.props.name,
tags: data[i].run.params.tags,
experiment: data[i].run.props.experiment?.name,
context: data[i].context,
};

// Add or overwrite the metric-specific attributes
if (fieldType === 'metric') {
runAttributes = {
...runAttributes,
name: data[i].name,
[data[i].name]: data[i].lastValue,
};
}

// Get the relevant attribute's value
const attributeValue = getValue(runAttributes, fieldName);
groupValue[conditionString] = evaluateCondition(
Expand All @@ -70,6 +79,5 @@ export function generateGroupValues(
};
}
}

return groupValues;
}

0 comments on commit 43de881

Please sign in to comment.