Skip to content

Commit

Permalink
chore(src): fetch changes fro main
Browse files Browse the repository at this point in the history
  • Loading branch information
MariamKhalatova committed Jul 30, 2024
2 parents ed6bb38 + 9c2b9c2 commit 25c5f12
Show file tree
Hide file tree
Showing 62 changed files with 1,242 additions and 244 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
16 changes: 9 additions & 7 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"dependencies": {
"@commitlint/cli": "^18.6.0",
"@commitlint/config-conventional": "^18.6.0",
"@grnsft/if-core": "^0.0.10",
"@grnsft/if-core": "^0.0.16",
"axios": "^1.7.2",
"csv-parse": "^5.5.6",
"csv-stringify": "^6.4.6",
Expand Down
12 changes: 8 additions & 4 deletions src/__tests__/if-run/builtins/coefficient.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ describe('builtins/coefficient: ', () => {
coefficient: 3,
'output-parameter': 'carbon-product',
};
const coefficient = Coefficient(globalConfig);
const parametersMetadata = {
inputs: {},
outputs: {},
};
const coefficient = Coefficient(globalConfig, parametersMetadata);

describe('init: ', () => {
it('successfully initalized.', () => {
Expand Down Expand Up @@ -51,7 +55,7 @@ describe('builtins/coefficient: ', () => {

it('throws an error when global config is not provided.', () => {
const config = undefined;
const coefficient = Coefficient(config!);
const coefficient = Coefficient(config!, parametersMetadata);

expect.assertions(1);

Expand All @@ -76,7 +80,7 @@ describe('builtins/coefficient: ', () => {
coefficient: 3,
'output-parameter': 'carbon-product',
};
const coefficient = Coefficient(invalidConfig);
const coefficient = Coefficient(invalidConfig, parametersMetadata);
const expectedMessage =
'"input-parameter" parameter is string must contain at least 1 character(s). Error code: too_small.';

Expand All @@ -103,7 +107,7 @@ describe('builtins/coefficient: ', () => {
coefficient: 10,
'output-parameter': '',
};
const coefficient = Coefficient(invalidConfig);
const coefficient = Coefficient(invalidConfig, parametersMetadata);
const expectedMessage =
'"output-parameter" parameter is string must contain at least 1 character(s). Error code: too_small.';

Expand Down
12 changes: 8 additions & 4 deletions src/__tests__/if-run/builtins/copy-param.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ describe('builtins/copy: ', () => {
from: 'original',
to: 'copy',
};
const copy = Copy(globalConfig);
const parametersMetadata = {
inputs: {},
outputs: {},
};
const copy = Copy(globalConfig, parametersMetadata);

describe('init: ', () => {
it('successfully initalized.', () => {
Expand Down Expand Up @@ -49,7 +53,7 @@ describe('builtins/copy: ', () => {

it('throws an error when global config is not provided.', () => {
const config = undefined;
const copy = Copy(config!);
const copy = Copy(config!, parametersMetadata);

expect.assertions(1);

Expand All @@ -74,7 +78,7 @@ describe('builtins/copy: ', () => {
from: 'original',
to: 'copy',
};
const copy = Copy(globalConfig);
const copy = Copy(globalConfig, parametersMetadata);
expect.assertions(1);

try {
Expand All @@ -99,7 +103,7 @@ describe('builtins/copy: ', () => {
from: 'original',
to: 'copy',
};
const copy = Copy(globalConfig);
const copy = Copy(globalConfig, parametersMetadata);

const expectedResult = [
{
Expand Down
Loading

0 comments on commit 25c5f12

Please sign in to comment.