Skip to content

Commit

Permalink
Merge branch 'main' into mapping-feature
Browse files Browse the repository at this point in the history
  • Loading branch information
manushak committed Jul 29, 2024
2 parents 6904da5 + 9c2b9c2 commit a63af71
Show file tree
Hide file tree
Showing 30 changed files with 407 additions and 47 deletions.
75 changes: 72 additions & 3 deletions manifests/examples/pipelines/pipeline-with-mocks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,36 @@ initialize:
method: MockObservations
path: "builtin"
global-config:
timestamp-from: 2023-07-06T00:00
timestamp-to: 2023-07-06T00:10
timestamp-from: 2023-12-12T00:00
timestamp-to: 2023-12-12T00:10
duration: 60
components:
- cloud/instance-type: A1
generators:
common:
cloud/region: uk-west
common-key: common-val
randint:
cpu/utilization:
min: 1
max: 99
parameter-metadata:
inputs:
timestamp:
description: refers to the time of occurrence of the input
unit: RFC3339
aggregation-method: none
duration:
description: refers to the duration of the input
unit: seconds
aggregation-method: sum
cloud/instance-type:
description: type of Cloud Instance name used in the cloud provider APIs
unit: none
aggregation-method: none
cloud/region:
description: region cloud instance
unit: none
aggregation-method: none
"interpolate":
method: Interpolation
path: "builtin"
Expand All @@ -35,12 +52,34 @@ initialize:
y: [0.12, 0.32, 0.75, 1.02]
input-parameter: "cpu/utilization"
output-parameter: "cpu-factor"
parameter-metadata:
inputs:
cpu/utilization:
description: refers to CPU utilization.
unit: percentage
aggregation-method: avg
outputs:
cpu-factor:
description: result of interpolate
unit: kWh
aggregation-method: avg
"cpu-factor-to-wattage":
method: Multiply
path: builtin
global-config:
input-parameters: ["cpu-factor", "cpu/thermal-design-power"]
output-parameter: "cpu-wattage"
parameter-metadata:
inputs:
cpu/thermal-design-power:
description: thermal design power for a processor
unit: kwh
aggregation-method: avg
outputs:
cpu-wattage:
description: the energy used by the CPU
unit: kwh
aggregation-method: sum
"wattage-times-duration":
method: Multiply
path: builtin
Expand All @@ -61,6 +100,16 @@ initialize:
numerator: vcpus-total
denominator: vcpus-allocated
output: vcpu-ratio
parameter-metadata:
inputs:
vcpus-total:
description: total number of vcpus available on a particular resource
unit: count
aggregation-method: none
vcpus-allocated:
description: number of vcpus allocated to particular resource
unit: count
aggregation-method: none
"correct-cpu-energy-for-vcpu-ratio":
method: Divide
path: "builtin"
Expand All @@ -77,6 +126,12 @@ initialize:
global-config:
input-parameters: ["cpu-energy-kwh", "grid/carbon-intensity"]
output-parameter: "carbon-operational"
parameter-metadata:
inputs:
grid/carbon-intensity:
description: Carbon intensity for the grid
unit: gCO2eq/kWh
aggregation-method: avg
"sum-carbon":
path: "builtin"
method: Sum
Expand All @@ -90,6 +145,12 @@ initialize:
method: Sci
global-config:
functional-unit: "requests"
parameter-metadata:
inputs:
requests:
description: expressed the final SCI value
unit: none
aggregation-method: sum
"time-sync":
method: TimeSync
path: "builtin"
Expand All @@ -98,13 +159,20 @@ initialize:
end-time: "2023-12-12T00:01:00.000Z"
interval: 5
allow-padding: true
parameter-metadata:
inputs:
time-reserved:
description: time reserved for a component
unit: seconds
aggregation-method: avg
"group-by":
path: builtin
method: GroupBy
tree:
children:
child-1:
pipeline:
- mock-observations
- interpolate
- cpu-factor-to-wattage
- wattage-times-duration
Expand Down Expand Up @@ -156,6 +224,7 @@ tree:
requests: 50
child-2:
pipeline:
- mock-observations
- interpolate
- cpu-factor-to-wattage
- wattage-times-duration
Expand Down
47 changes: 43 additions & 4 deletions manifests/outputs/pipelines/mock-obs-time-sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,36 @@ initialize:
path: builtin
method: MockObservations
global-config:
timestamp-from: 2023-07-06T00:00
timestamp-to: 2023-07-06T00:10
timestamp-from: 2023-12-12T00:00
timestamp-to: 2023-12-12T00:10
duration: 60
components:
- cloud/instance-type: A1
generators:
common:
cloud/region: uk-west
common-key: common-val
randint:
cpu/utilization:
min: 1
max: 99
parameter-metadata:
inputs:
timestamp:
description: refers to the time of occurrence of the input
unit: RFC3339
aggregation-method: none
duration:
description: refers to the duration of the input
unit: seconds
aggregation-method: sum
cloud/instance-type:
description: type of Cloud Instance name used in the cloud provider APIs
unit: none
aggregation-method: none
cloud/region:
description: region cloud instance
unit: none
aggregation-method: none
interpolate:
path: builtin
method: Interpolation
Expand All @@ -37,6 +54,12 @@ initialize:
- 1.02
input-parameter: cpu/utilization
output-parameter: cpu-factor
parameter-metadata:
inputs:
cpu/utilization:
description: refers to CPU utilization.
unit: percentage
aggregation-method: avg
cpu-factor-to-wattage:
path: builtin
method: Multiply
Expand All @@ -45,6 +68,12 @@ initialize:
- cpu-factor
- cpu/thermal-design-power
output-parameter: cpu-wattage
parameter-metadata:
inputs:
cpu/thermal-design-power:
description: thermal design power for a processor
unit: kwh
aggregation-method: avg
wattage-times-duration:
path: builtin
method: Multiply
Expand All @@ -67,6 +96,16 @@ initialize:
numerator: vcpus-total
denominator: vcpus-allocated
output: vcpu-ratio
parameter-metadata:
inputs:
vcpus-total:
description: total number of vcpus available on a particular resource
unit: count
aggregation-method: none
vcpus-allocated:
description: number of vcpus allocated to particular resource
unit: count
aggregation-method: none
correct-cpu-energy-for-vcpu-ratio:
path: builtin
method: Divide
Expand Down Expand Up @@ -100,7 +139,6 @@ execution:
- "@commitlint/[email protected]"
- "@commitlint/[email protected]"
- "@grnsft/[email protected]"

- "@jest/[email protected]"
- "@types/[email protected]"
- "@types/[email protected]"
Expand Down Expand Up @@ -131,6 +169,7 @@ tree:
children:
child-1:
pipeline:
- mock-observations
- interpolate
- cpu-factor-to-wattage
- wattage-times-duration
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/if-run/builtins/time-sync.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {Settings, DateTime} from 'luxon';

import {AggregationParams} from '../../../common/types/manifest';

import {storeAggregateMetrics} from '../../../if-run/lib/aggregate';
import {storeAggregationMetrics} from '../../../if-run/lib/aggregate';
import {TimeSync} from '../../../if-run/builtins/time-sync';

import {STRINGS} from '../../../if-run/config';
Expand Down Expand Up @@ -65,7 +65,7 @@ describe('builtins/time-sync:', () => {
type: 'horizontal',
};

storeAggregateMetrics(metricStorage);
storeAggregationMetrics(metricStorage);
});

describe('time-sync: ', () => {
Expand Down
7 changes: 5 additions & 2 deletions src/__tests__/if-run/lib/aggregate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

import {AggregationParams} from '../../../common/types/manifest';

import {aggregate, storeAggregateMetrics} from '../../../if-run/lib/aggregate';
import {
aggregate,
storeAggregationMetrics,
} from '../../../if-run/lib/aggregate';

describe('lib/aggregate: ', () => {
beforeAll(() => {
Expand All @@ -13,7 +16,7 @@ describe('lib/aggregate: ', () => {
type: 'horizontal',
};

storeAggregateMetrics(metricStorage);
storeAggregationMetrics(metricStorage);
});

describe('aggregate(): ', () => {
Expand Down
1 change: 1 addition & 0 deletions src/__tests__/if-run/lib/explain.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
import {explain, addExplainData} from '../../../if-run/lib/explain';

describe('lib/explain: ', () => {
Expand Down
6 changes: 3 additions & 3 deletions src/__tests__/if-run/util/aggregation-helper.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {AggregationParams} from '../../../common/types/manifest';

import {aggregateInputsIntoOne} from '../../../if-run/util/aggregation-helper';
import {AggregationMetric} from '../../../if-run/types/aggregation';
import {storeAggregateMetrics} from '../../../if-run/lib/aggregate';
import {storeAggregationMetrics} from '../../../if-run/lib/aggregate';

import {STRINGS} from '../../../if-run/config';

Expand All @@ -23,7 +23,7 @@ describe('util/aggregation-helper: ', () => {
type: 'horizontal',
};

storeAggregateMetrics(metricStorage);
storeAggregationMetrics(metricStorage);
});

describe('aggregateInputsIntoOne(): ', () => {
Expand Down Expand Up @@ -105,7 +105,7 @@ describe('util/aggregation-helper: ', () => {
type: 'horizontal',
};

storeAggregateMetrics(metricStorage);
storeAggregationMetrics(metricStorage);
const inputs: PluginParams[] = [
{timestamp: '', duration: 10, 'cpu/utilization': 10},
{timestamp: '', duration: 10, 'cpu/utilization': 90},
Expand Down
Loading

0 comments on commit a63af71

Please sign in to comment.