@grnsft/if 0.1.8 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.commitlintrc.js +45 -0
- package/.husky/commit-msg +4 -0
- package/.husky/pre-commit +6 -0
- package/CONTRIBUTING.md +81 -98
- package/README.md +16 -12
- package/build/config/config.d.ts +4 -5
- package/build/config/config.js +16 -12
- package/build/config/index.d.ts +1 -0
- package/build/config/index.js +4 -2
- package/build/config/params.d.ts +2 -0
- package/build/config/params.js +146 -0
- package/build/config/strings.d.ts +14 -8
- package/build/config/strings.js +18 -12
- package/build/index.js +18 -38
- package/build/lib/aggregate.d.ts +6 -0
- package/build/lib/aggregate.js +72 -0
- package/build/lib/compute.d.ts +5 -0
- package/build/lib/compute.js +84 -0
- package/build/lib/exhaust.d.ts +6 -0
- package/build/lib/exhaust.js +47 -0
- package/build/lib/initialize.d.ts +6 -0
- package/build/lib/initialize.js +98 -0
- package/build/lib/load.d.ts +6 -0
- package/build/lib/load.js +24 -0
- package/build/lib/parameterize.d.ts +5 -0
- package/build/lib/parameterize.js +49 -0
- package/build/models/export-csv.d.ts +2 -0
- package/build/models/export-csv.js +129 -0
- package/build/models/export-log.d.ts +4 -0
- package/build/models/export-log.js +18 -0
- package/build/models/export-yaml.d.ts +4 -0
- package/build/models/export-yaml.js +24 -0
- package/build/models/group-by.d.ts +11 -0
- package/build/models/group-by.js +56 -0
- package/build/models/index.d.ts +2 -1
- package/build/models/index.js +5 -3
- package/build/models/time-sync.d.ts +2 -54
- package/build/models/time-sync.js +216 -147
- package/build/types/aggregation.d.ts +3 -0
- package/build/types/aggregation.js +5 -0
- package/build/types/compute.d.ts +25 -0
- package/build/types/compute.js +3 -0
- package/build/types/exhaust-plugin-interface.d.ts +7 -0
- package/build/types/exhaust-plugin-interface.js +3 -0
- package/build/types/group-by.d.ts +3 -0
- package/build/types/group-by.js +3 -0
- package/build/types/initialize.d.ts +4 -0
- package/build/types/initialize.js +3 -0
- package/build/types/interface.d.ts +8 -0
- package/build/types/interface.js +3 -0
- package/build/types/load.d.ts +7 -0
- package/build/types/load.js +3 -0
- package/build/types/manifest.d.ts +40 -0
- package/build/types/manifest.js +3 -0
- package/build/types/parameters.d.ts +15 -0
- package/build/types/parameters.js +5 -0
- package/build/types/process-args.d.ts +4 -5
- package/build/types/process-args.js +1 -1
- package/build/types/time-sync.d.ts +10 -2
- package/build/types/time-sync.js +1 -1
- package/build/util/aggregation-helper.d.ts +6 -0
- package/build/util/aggregation-helper.js +56 -0
- package/build/util/args.d.ts +7 -3
- package/build/util/args.js +46 -18
- package/build/util/errors.d.ts +1 -1
- package/build/util/errors.js +8 -4
- package/build/util/helpers.d.ts +4 -0
- package/build/util/helpers.js +23 -4
- package/build/util/json.d.ts +4 -0
- package/build/util/json.js +16 -0
- package/build/util/logger.d.ts +5 -0
- package/build/util/logger.js +40 -0
- package/build/util/validations.d.ts +30 -21
- package/build/util/validations.js +54 -55
- package/build/util/yaml.js +27 -4
- package/examples/manifests/azure-importer.yml +24 -0
- package/examples/manifests/basic-demo.yml +75 -0
- package/examples/manifests/basic.yml +27 -0
- package/examples/manifests/boavizta-pipeline.yml +85 -0
- package/examples/{impls/case-studies → manifests}/boavizta.yml +14 -14
- package/examples/{impls/test → manifests}/ccf.yml +9 -10
- package/examples/manifests/cim.yml +20 -0
- package/examples/manifests/cloud-metadata.yml +41 -0
- package/examples/manifests/co2js.yml +30 -0
- package/examples/manifests/coefficient.yml +23 -0
- package/examples/manifests/csv-export.yml +34 -0
- package/examples/manifests/e-mem.yml +21 -0
- package/examples/{impls/test → manifests}/e-net.yml +9 -8
- package/examples/manifests/generics.yml +71 -0
- package/examples/manifests/group-by.yml +48 -0
- package/examples/manifests/mock-observation.yml +33 -0
- package/examples/manifests/multiply.yml +23 -0
- package/examples/manifests/nesting-demo.yml +89 -0
- package/examples/manifests/nesting.yml +215 -0
- package/examples/manifests/pipeline-demo-1.yml +85 -0
- package/examples/manifests/pipeline-demo-2.yml +149 -0
- package/examples/manifests/pipeline-demo.yml +128 -0
- package/examples/manifests/pipeline-teads-sci.yml +82 -0
- package/examples/manifests/pipeline-with-generics.yml +147 -0
- package/examples/manifests/pipeline-with-mocks.yml +146 -0
- package/examples/{impls/test → manifests}/sci-e.yml +6 -8
- package/examples/manifests/sci-m.yml +23 -0
- package/examples/{impls/test → manifests}/sci-o.yml +10 -10
- package/examples/{impls/test → manifests}/sci.yml +10 -9
- package/examples/manifests/shell.yml +20 -0
- package/examples/manifests/sum.yml +23 -0
- package/examples/{impls/test → manifests}/tdp-finder.yml +6 -7
- package/examples/manifests/teads-aws.yml +22 -0
- package/examples/manifests/teads-curve.yml +20 -0
- package/examples/manifests/time-sync.yml +32 -0
- package/examples/manifests/watt-time.yml +42 -0
- package/jest.config.js +6 -1
- package/package.json +13 -8
- package/src/__tests__/integration/templates/integration.yaml +16 -0
- package/src/models/README.md +9 -7
- package/tsconfig.test.json +1 -1
- package/Makefile +0 -16
- package/build/config/units.yaml +0 -112
- package/build/lib/models-universe.d.ts +0 -36
- package/build/lib/models-universe.js +0 -113
- package/build/lib/observatory.d.ts +0 -20
- package/build/lib/observatory.js +0 -31
- package/build/lib/planet-aggregator.d.ts +0 -6
- package/build/lib/planet-aggregator.js +0 -35
- package/build/lib/supercomputer.d.ts +0 -37
- package/build/lib/supercomputer.js +0 -148
- package/build/types/helpers.d.ts +0 -1
- package/build/types/helpers.js +0 -3
- package/build/types/impl.d.ts +0 -45
- package/build/types/impl.js +0 -5
- package/build/types/model-interface.d.ts +0 -14
- package/build/types/model-interface.js +0 -3
- package/build/types/models-universe.d.ts +0 -23
- package/build/types/models-universe.js +0 -3
- package/build/types/planet-aggregator.d.ts +0 -6
- package/build/types/planet-aggregator.js +0 -3
- package/build/types/supercomputer.d.ts +0 -4
- package/build/types/supercomputer.js +0 -3
- package/build/types/units-dealer.d.ts +0 -3
- package/build/types/units-dealer.js +0 -3
- package/build/types/units.d.ts +0 -11
- package/build/types/units.js +0 -37
- package/build/util/units-dealer.d.ts +0 -10
- package/build/util/units-dealer.js +0 -32
- package/coverage/clover.xml +0 -379
- package/coverage/coverage-final.json +0 -14
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/config/config.ts.html +0 -250
- package/coverage/lcov-report/config/index.html +0 -146
- package/coverage/lcov-report/config/index.ts.html +0 -91
- package/coverage/lcov-report/config/strings.ts.html +0 -208
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -161
- package/coverage/lcov-report/lib/index.html +0 -161
- package/coverage/lcov-report/lib/models-universe.ts.html +0 -517
- package/coverage/lcov-report/lib/observatory.ts.html +0 -187
- package/coverage/lcov-report/lib/planet-aggregator.ts.html +0 -274
- package/coverage/lcov-report/lib/supercomputer.ts.html +0 -472
- package/coverage/lcov-report/models/index.html +0 -131
- package/coverage/lcov-report/models/index.ts.html +0 -88
- package/coverage/lcov-report/models/planet-aggregator.ts.html +0 -271
- package/coverage/lcov-report/models/time-sync.ts.html +0 -1165
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov-report/util/args.ts.html +0 -289
- package/coverage/lcov-report/util/errors.ts.html +0 -166
- package/coverage/lcov-report/util/index.html +0 -161
- package/coverage/lcov-report/util/units-dealer.ts.html +0 -199
- package/coverage/lcov-report/util/yaml.ts.html +0 -193
- package/coverage/lcov.info +0 -637
- package/examples/impls/case-studies/accenture.yml +0 -155
- package/examples/impls/case-studies/aggregation.yml +0 -97
- package/examples/impls/case-studies/aveva.yaml +0 -48
- package/examples/impls/case-studies/azure-yassine.yaml +0 -67
- package/examples/impls/case-studies/dow_msft.yml +0 -173
- package/examples/impls/case-studies/farm-insights.yaml +0 -35
- package/examples/impls/case-studies/gsf-website.yaml +0 -93
- package/examples/impls/case-studies/msft-eshoppen.yaml +0 -162
- package/examples/impls/case-studies/msft-green-ai.yaml +0 -58
- package/examples/impls/case-studies/ntt-data-on-premise.yaml +0 -201
- package/examples/impls/test/aggregation-test.yml +0 -109
- package/examples/impls/test/azure.yml +0 -26
- package/examples/impls/test/if-demo.yml +0 -61
- package/examples/impls/test/large-impl.yml +0 -257303
- package/examples/impls/test/metadata.yml +0 -21
- package/examples/impls/test/nesting.yml +0 -113
- package/examples/impls/test/sci-m.yml +0 -24
- package/examples/impls/test/shell.yml +0 -19
- package/examples/impls/test/time-sync.yml +0 -75
- package/examples/ompls/aggregation-test.yml +0 -340
- package/examples/ompls/azure.yml +0 -145
- package/examples/ompls/ccf.yml +0 -29
- package/examples/ompls/complex-pipeline.yml +0 -105
- package/examples/ompls/full-sci.yml +0 -64
- package/examples/ompls/if-demo.yml +0 -517
- package/examples/ompls/metadata.yml +0 -29
- package/examples/ompls/nesting.yml +0 -113
- package/examples/ompls/sci-e.yml +0 -23
- package/examples/ompls/sci-m.yml +0 -33
- package/examples/ompls/sci-o.yml +0 -29
- package/examples/ompls/sci.yml +0 -37
- package/examples/ompls/shell.yml +0 -23
- package/examples/ompls/time-sync.yml +0 -212
- package/src/config/units.yaml +0 -112
- package/tsconfig.build.tsbuildinfo +0 -1
|
@@ -2,16 +2,16 @@ name: sci-o-demo
|
|
|
2
2
|
description:
|
|
3
3
|
tags:
|
|
4
4
|
initialize:
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
plugins:
|
|
6
|
+
sci-e:
|
|
7
7
|
kind: plugin
|
|
8
|
-
|
|
9
|
-
path: "@grnsft/if-
|
|
10
|
-
|
|
8
|
+
method: SciE
|
|
9
|
+
path: "@grnsft/if-plugins"
|
|
10
|
+
sci-o:
|
|
11
11
|
verbose: false
|
|
12
|
-
|
|
13
|
-
path: "@grnsft/if-
|
|
14
|
-
|
|
12
|
+
method: SciO
|
|
13
|
+
path: "@grnsft/if-plugins"
|
|
14
|
+
tree:
|
|
15
15
|
children:
|
|
16
16
|
child:
|
|
17
17
|
pipeline:
|
|
@@ -22,5 +22,5 @@ graph:
|
|
|
22
22
|
inputs:
|
|
23
23
|
- timestamp: 2023-08-06T00:00
|
|
24
24
|
duration: 3600
|
|
25
|
-
energy
|
|
26
|
-
grid
|
|
25
|
+
cpu/energy: 0.001
|
|
26
|
+
grid/carbon-intensity: 800
|
|
@@ -2,25 +2,26 @@ name: sci-demo
|
|
|
2
2
|
description: example invoking sci model
|
|
3
3
|
tags:
|
|
4
4
|
initialize:
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
plugins:
|
|
6
|
+
sci:
|
|
7
7
|
kind: plugin
|
|
8
|
-
|
|
9
|
-
path: "@grnsft/if-
|
|
10
|
-
|
|
8
|
+
method: Sci
|
|
9
|
+
path: "@grnsft/if-plugins"
|
|
10
|
+
# global-config:
|
|
11
|
+
# functional-unit-time: 1 minute
|
|
12
|
+
tree:
|
|
11
13
|
children:
|
|
12
14
|
child:
|
|
13
15
|
pipeline:
|
|
14
16
|
- sci
|
|
15
17
|
config:
|
|
16
18
|
sci:
|
|
17
|
-
functional-unit-
|
|
18
|
-
functional-unit-time: "1 minute"
|
|
19
|
+
functional-unit-time: 1 sec
|
|
19
20
|
functional-unit: requests # factor to convert per time to per f.unit
|
|
20
21
|
inputs:
|
|
21
22
|
- timestamp: 2023-07-06T00:00
|
|
22
23
|
duration: 3600
|
|
23
24
|
energy: 5
|
|
24
|
-
operational
|
|
25
|
-
embodied
|
|
25
|
+
carbon-operational: 5
|
|
26
|
+
carbon-embodied: 0.02
|
|
26
27
|
requests: 100
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
name: shell-demo
|
|
2
|
+
description: example impl invoking shell model
|
|
3
|
+
tags:
|
|
4
|
+
initialize:
|
|
5
|
+
plugins:
|
|
6
|
+
shell:
|
|
7
|
+
method: Shell
|
|
8
|
+
path: "@grnsft/if-plugins"
|
|
9
|
+
global-config:
|
|
10
|
+
command: python3 /usr/local/bin/sampler
|
|
11
|
+
tree:
|
|
12
|
+
children:
|
|
13
|
+
child:
|
|
14
|
+
pipeline:
|
|
15
|
+
- shell
|
|
16
|
+
inputs:
|
|
17
|
+
- timestamp: "2023-11-02T10:35:31.820Z"
|
|
18
|
+
duration: 3600
|
|
19
|
+
cpu/energy: 0.002
|
|
20
|
+
memory/energy: 0.000005
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name: sci-e-demo
|
|
2
|
+
description:
|
|
3
|
+
tags:
|
|
4
|
+
initialize:
|
|
5
|
+
plugins:
|
|
6
|
+
sum:
|
|
7
|
+
method: Sum
|
|
8
|
+
path: "@grnsft/if-plugins"
|
|
9
|
+
global-config:
|
|
10
|
+
input-parameters: ["cpu/energy", "network/energy"]
|
|
11
|
+
output-parameter: "energy"
|
|
12
|
+
tree:
|
|
13
|
+
children:
|
|
14
|
+
child:
|
|
15
|
+
pipeline:
|
|
16
|
+
- sum
|
|
17
|
+
config:
|
|
18
|
+
sum:
|
|
19
|
+
inputs:
|
|
20
|
+
- timestamp: 2023-08-06T00:00
|
|
21
|
+
duration: 3600
|
|
22
|
+
cpu/energy: 0.001
|
|
23
|
+
network/energy: 0.001
|
|
@@ -2,18 +2,17 @@ name: tdp-finder
|
|
|
2
2
|
description: demo
|
|
3
3
|
tags:
|
|
4
4
|
initialize:
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
path: "@grnsft/if-
|
|
9
|
-
|
|
5
|
+
plugins:
|
|
6
|
+
tdp-finder: # a model that returns an embodied value given the sci embodied attribution equation.
|
|
7
|
+
method: TdpFinder
|
|
8
|
+
path: "@grnsft/if-plugins"
|
|
9
|
+
tree:
|
|
10
10
|
children:
|
|
11
11
|
child:
|
|
12
|
-
pipeline:
|
|
12
|
+
pipeline:
|
|
13
13
|
- tdp-finder
|
|
14
14
|
config:
|
|
15
15
|
inputs:
|
|
16
16
|
- timestamp: 2023-07-06T00:00
|
|
17
17
|
duration: 300
|
|
18
18
|
physical-processor: AMD 3020e
|
|
19
|
-
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: teads-aws
|
|
2
|
+
description: simple demo invoking TeadsAWS model
|
|
3
|
+
tags:
|
|
4
|
+
initialize:
|
|
5
|
+
plugins:
|
|
6
|
+
teads-aws:
|
|
7
|
+
method: TeadsAWS
|
|
8
|
+
path: "@grnsft/if-unofficial-plugins"
|
|
9
|
+
global-config:
|
|
10
|
+
interpolation: linear
|
|
11
|
+
tree:
|
|
12
|
+
children:
|
|
13
|
+
child:
|
|
14
|
+
pipeline:
|
|
15
|
+
- teads-aws # duration & config -> embodied
|
|
16
|
+
defaults:
|
|
17
|
+
cloud/instance-type: m5n.large
|
|
18
|
+
cpu/expected-lifespan: 252288000
|
|
19
|
+
inputs:
|
|
20
|
+
- timestamp: 2023-07-06T00:00
|
|
21
|
+
duration: 3600
|
|
22
|
+
cpu/utilization: 10
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
name: teads-curve
|
|
2
|
+
description: simple demo invoking teads-curve
|
|
3
|
+
tags:
|
|
4
|
+
initialize:
|
|
5
|
+
plugins:
|
|
6
|
+
teads-curve:
|
|
7
|
+
method: TeadsCurve
|
|
8
|
+
path: "@grnsft/if-unofficial-plugins"
|
|
9
|
+
global-config:
|
|
10
|
+
interpolation: spline
|
|
11
|
+
tree:
|
|
12
|
+
children:
|
|
13
|
+
child:
|
|
14
|
+
pipeline:
|
|
15
|
+
- teads-curve
|
|
16
|
+
inputs:
|
|
17
|
+
- timestamp: 2023-07-06T00:00
|
|
18
|
+
duration: 3600
|
|
19
|
+
cpu/utilization: 50
|
|
20
|
+
cpu/thermal-design-power: 100
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
name: time-sync-demo
|
|
2
|
+
description:
|
|
3
|
+
tags:
|
|
4
|
+
initialize:
|
|
5
|
+
plugins:
|
|
6
|
+
'time-sync':
|
|
7
|
+
method: TimeSync
|
|
8
|
+
path: "builtin"
|
|
9
|
+
global-config:
|
|
10
|
+
start-time: '2023-12-12T00:00:00.000Z'
|
|
11
|
+
end-time: '2023-12-12T00:01:00.000Z'
|
|
12
|
+
interval: 5
|
|
13
|
+
allow-padding: true
|
|
14
|
+
tree:
|
|
15
|
+
children:
|
|
16
|
+
child:
|
|
17
|
+
pipeline:
|
|
18
|
+
- time-sync
|
|
19
|
+
config:
|
|
20
|
+
inputs:
|
|
21
|
+
- timestamp: '2023-12-12T00:00:00.000Z'
|
|
22
|
+
duration: 1
|
|
23
|
+
energy-cpu: 0.001
|
|
24
|
+
- timestamp: '2023-12-12T00:00:01.000Z'
|
|
25
|
+
duration: 5
|
|
26
|
+
energy-cpu: 0.001
|
|
27
|
+
- timestamp: '2023-12-12T00:00:06.000Z'
|
|
28
|
+
duration: 7
|
|
29
|
+
energy-cpu: 0.001
|
|
30
|
+
- timestamp: '2023-12-12T00:00:13.000Z'
|
|
31
|
+
duration: 30
|
|
32
|
+
energy-cpu: 0.001
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
name: watt-time-demo
|
|
2
|
+
description: null
|
|
3
|
+
tags: null
|
|
4
|
+
initialize:
|
|
5
|
+
plugins:
|
|
6
|
+
mock-observations:
|
|
7
|
+
path: "@grnsft/if-plugins"
|
|
8
|
+
method: MockObservations
|
|
9
|
+
global-config:
|
|
10
|
+
timestamp-from: 2024-02-26T00:00
|
|
11
|
+
timestamp-to: 2024-02-26T00:10
|
|
12
|
+
duration: 60
|
|
13
|
+
components:
|
|
14
|
+
- cloud/instance-type: Standard_A1_v2
|
|
15
|
+
- cloud/instance-type: Standard_A2_v2
|
|
16
|
+
generators:
|
|
17
|
+
common:
|
|
18
|
+
cloud/vendor: azure
|
|
19
|
+
cloud/region: uk-west
|
|
20
|
+
geolocation: 37.7749,-122.4194
|
|
21
|
+
randint:
|
|
22
|
+
cpu/utilization:
|
|
23
|
+
min: 1
|
|
24
|
+
max: 99
|
|
25
|
+
watttime:
|
|
26
|
+
path: "@grnsft/if-unofficial-plugins"
|
|
27
|
+
method: WattTimeGridEmissions
|
|
28
|
+
tree:
|
|
29
|
+
children:
|
|
30
|
+
application:
|
|
31
|
+
pipeline:
|
|
32
|
+
- mock-observations
|
|
33
|
+
- watttime
|
|
34
|
+
config:
|
|
35
|
+
inputs:
|
|
36
|
+
- timestamp: "2024-02-26 00:00:00"
|
|
37
|
+
duration: 60
|
|
38
|
+
cloud/instance-type: Standard_A1_v2
|
|
39
|
+
cloud/vendor: azure
|
|
40
|
+
cloud/region: uk-west
|
|
41
|
+
geolocation: 37.7749,-122.4194
|
|
42
|
+
cpu/utilization: 15
|
package/jest.config.js
CHANGED
|
@@ -10,5 +10,10 @@ module.exports = {
|
|
|
10
10
|
},
|
|
11
11
|
],
|
|
12
12
|
},
|
|
13
|
-
modulePathIgnorePatterns: [
|
|
13
|
+
modulePathIgnorePatterns: [
|
|
14
|
+
'./build',
|
|
15
|
+
'./src/__tests__/unit/lib/manifest',
|
|
16
|
+
'./src/__tests__/integration/helpers',
|
|
17
|
+
'./src/__tests__/integration/test-data',
|
|
18
|
+
],
|
|
14
19
|
};
|
package/package.json
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grnsft/if",
|
|
3
3
|
"description": "Impact Framework",
|
|
4
|
-
"version": "v0.
|
|
4
|
+
"version": "v0.2.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Green Software Foundation",
|
|
7
7
|
"email": "info@gsf.com"
|
|
8
8
|
},
|
|
9
9
|
"bin": {
|
|
10
|
-
"
|
|
10
|
+
"if": "./build/index.js"
|
|
11
11
|
},
|
|
12
12
|
"bugs": {
|
|
13
13
|
"url": "https://github.com/Green-Software-Foundation/if/issues/new?assignees=&labels=feedback&projects=&template=feedback.md&title=Feedback+-+"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"
|
|
16
|
+
"@commitlint/cli": "^18.6.0",
|
|
17
|
+
"@commitlint/config-conventional": "^18.6.0",
|
|
17
18
|
"js-yaml": "^4.1.0",
|
|
18
|
-
"
|
|
19
|
-
"moment-range": "^4.0.2",
|
|
19
|
+
"luxon": "^3.4.4",
|
|
20
20
|
"ts-command-line-args": "^2.5.1",
|
|
21
21
|
"typescript": "^5.1.6",
|
|
22
|
+
"winston": "^3.11.0",
|
|
22
23
|
"zod": "^3.22.4"
|
|
23
24
|
},
|
|
24
25
|
"devDependencies": {
|
|
@@ -27,9 +28,11 @@
|
|
|
27
28
|
"@jest/globals": "^29.6.1",
|
|
28
29
|
"@types/jest": "^29.5.7",
|
|
29
30
|
"@types/js-yaml": "^4.0.5",
|
|
31
|
+
"@types/luxon": "^3.4.2",
|
|
30
32
|
"@types/node": "^20.8.9",
|
|
31
33
|
"fixpack": "^4.0.0",
|
|
32
34
|
"gts": "^5.0.0",
|
|
35
|
+
"husky": "^8.0.0",
|
|
33
36
|
"jest": "^29.6.1",
|
|
34
37
|
"ts-jest": "^29.1.1"
|
|
35
38
|
},
|
|
@@ -55,14 +58,16 @@
|
|
|
55
58
|
"url": "https://github.com/Green-Software-Foundation/if"
|
|
56
59
|
},
|
|
57
60
|
"scripts": {
|
|
58
|
-
"build": "rm -rf build && tsc --project tsconfig.build.json
|
|
61
|
+
"build": "rm -rf build && tsc --project tsconfig.build.json",
|
|
59
62
|
"coverage": "jest --verbose --coverage",
|
|
60
63
|
"fix": "gts fix",
|
|
61
64
|
"fix:package": "fixpack",
|
|
62
|
-
"
|
|
65
|
+
"if": "npx ts-node src/index.ts",
|
|
63
66
|
"lint": "gts lint",
|
|
67
|
+
"prepare": "husky install",
|
|
64
68
|
"prepublish": "npm run build",
|
|
65
|
-
"test": "jest --verbose"
|
|
69
|
+
"test": "jest --verbose --testPathPattern=src/__tests__/unit",
|
|
70
|
+
"test:integration": "jest --verbose --testPathPattern=src/__tests__/integration"
|
|
66
71
|
},
|
|
67
72
|
"stability": "stable",
|
|
68
73
|
"types": "src/index.d.ts"
|
package/src/models/README.md
CHANGED
|
@@ -10,6 +10,7 @@ The following should be defined in the model initialization:
|
|
|
10
10
|
- `start-time`: global start time as ISO 8061 string
|
|
11
11
|
- `stop`: global end time as ISO 8061 string
|
|
12
12
|
- `interval`: temporal resolution in seconds
|
|
13
|
+
- `error-on-padding`: avoid zero/'zeroish' padding (if needed) and error out instead. `False` by defult.
|
|
13
14
|
|
|
14
15
|
### Inputs:
|
|
15
16
|
|
|
@@ -114,6 +115,7 @@ The end result of this gap-filling is that we have continuous 1 second resolutio
|
|
|
114
115
|
{timestamp: 2023-12-12T00:00:09.000Z, duration: 1, cpu-util: 12, carbon: 2.5, energy: 5, grid-carbon-intensity: 471}
|
|
115
116
|
]
|
|
116
117
|
```
|
|
118
|
+
Note that when `error-on-padding` is `true` no gap-filling is performed and the model will error out instead.
|
|
117
119
|
|
|
118
120
|
#### Trimming and padding
|
|
119
121
|
|
|
@@ -149,7 +151,7 @@ For example, for `startTime = 2023-12-12T00:00:00.000Z` and `endTime = 2023-12-1
|
|
|
149
151
|
|
|
150
152
|
]
|
|
151
153
|
```
|
|
152
|
-
|
|
154
|
+
Note that when `error-on-padding` is `true` no padding is performed and the model will error out instead.
|
|
153
155
|
|
|
154
156
|
#### Resampling rules
|
|
155
157
|
|
|
@@ -199,8 +201,8 @@ const results = timeSyncModel.execute([
|
|
|
199
201
|
|
|
200
202
|
IEF users will typically call the model as part of a pipeline defined in an `impl`
|
|
201
203
|
file. In this case, instantiating and configuring the model is handled by
|
|
202
|
-
`
|
|
203
|
-
The following is an example `
|
|
204
|
+
`if` and does not have to be done explicitly by the user.
|
|
205
|
+
The following is an example `manifest` that calls `time-sync`:
|
|
204
206
|
|
|
205
207
|
```yaml
|
|
206
208
|
name: time-sync-demo
|
|
@@ -210,16 +212,16 @@ initialize:
|
|
|
210
212
|
models:
|
|
211
213
|
- name: teads-curve
|
|
212
214
|
model: TeadsCurveModel
|
|
213
|
-
path: "@grnsft/if-unofficial-
|
|
215
|
+
path: "@grnsft/if-unofficial-plugins"
|
|
214
216
|
- name: sci-e
|
|
215
217
|
model: SciEModel
|
|
216
|
-
path: "@grnsft/if-
|
|
218
|
+
path: "@grnsft/if-plugins"
|
|
217
219
|
- name: sci-m
|
|
218
|
-
path: "@grnsft/if-
|
|
220
|
+
path: "@grnsft/if-plugins"
|
|
219
221
|
model: SciMModel
|
|
220
222
|
- name: sci-o
|
|
221
223
|
model: SciOModel
|
|
222
|
-
path: "@grnsft/if-
|
|
224
|
+
path: "@grnsft/if-plugins"
|
|
223
225
|
- name: time-synchronization
|
|
224
226
|
model: TimeSyncModel
|
|
225
227
|
path: builtin
|
package/tsconfig.test.json
CHANGED
package/Makefile
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
#Converts the CSV files from CCF Coefficients Database to JSON.
|
|
4
|
-
ccf-data:
|
|
5
|
-
cat third-party/ccf-coefficients/data/aws-instances.csv | python -c 'import csv, json, sys; print(json.dumps([dict(r) for r in csv.DictReader(sys.stdin)]))' > lib/ccf/aws-instances.json
|
|
6
|
-
cat third-party/ccf-coefficients/output/coefficients-aws-use.csv | python -c 'import csv, json, sys; print(json.dumps([dict(r) for r in csv.DictReader(sys.stdin)]))' > lib/ccf/aws-use.json
|
|
7
|
-
cat third-party/ccf-coefficients/output/coefficients-aws-embodied.csv | python -c 'import csv, json, sys; print(json.dumps([dict(r) for r in csv.DictReader(sys.stdin)]))' > lib/ccf/aws-embodied.json
|
|
8
|
-
cat third-party/ccf-coefficients/data/gcp-instances.csv | python -c 'import csv, json, sys; print(json.dumps([dict(r) for r in csv.DictReader(sys.stdin)]))' > lib/ccf/gcp-instances.json
|
|
9
|
-
cat third-party/ccf-coefficients/output/coefficients-gcp-use.csv | python -c 'import csv, json, sys; print(json.dumps([dict(r) for r in csv.DictReader(sys.stdin)]))' > lib/ccf/gcp-use.json
|
|
10
|
-
cat third-party/ccf-coefficients/output/coefficients-gcp-embodied.csv | python -c 'import csv, json, sys; print(json.dumps([dict(r) for r in csv.DictReader(sys.stdin)]))' > lib/ccf/gcp-embodied.json
|
|
11
|
-
cat third-party/ccf-coefficients/data/azure-instances.csv | python -c 'import csv, json, sys; print(json.dumps([dict(r) for r in csv.DictReader(sys.stdin)]))' > lib/ccf/azure-instances.json
|
|
12
|
-
cat third-party/ccf-coefficients/output/coefficients-azure-use.csv | python -c 'import csv, json, sys; print(json.dumps([dict(r) for r in csv.DictReader(sys.stdin)]))' > lib/ccf/azure-use.json
|
|
13
|
-
cat third-party/ccf-coefficients/output/coefficients-azure-embodied.csv | python -c 'import csv, json, sys; print(json.dumps([dict(r) for r in csv.DictReader(sys.stdin)]))' > lib/ccf/azure-embodied.json
|
|
14
|
-
|
|
15
|
-
install-shell-imp:
|
|
16
|
-
cp src/lib/shell-imp/sampler /usr/local/bin/sampler
|
package/build/config/units.yaml
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
carbon:
|
|
2
|
-
description: an amount of carbon emitted into the atmosphere
|
|
3
|
-
unit: gCO2e
|
|
4
|
-
aggregation: sum
|
|
5
|
-
core-units:
|
|
6
|
-
description: number of cores available
|
|
7
|
-
unit: cores
|
|
8
|
-
aggregation: none
|
|
9
|
-
cpu-util:
|
|
10
|
-
description: refers to CPU utilization.
|
|
11
|
-
unit: percentage
|
|
12
|
-
aggregation: avg
|
|
13
|
-
disk-io:
|
|
14
|
-
description: refers to GB of data written/read from disk
|
|
15
|
-
unit: GB
|
|
16
|
-
aggregation: sum
|
|
17
|
-
duration:
|
|
18
|
-
description: refers to the duration of the input
|
|
19
|
-
unit: seconds
|
|
20
|
-
aggregation: sum
|
|
21
|
-
energy:
|
|
22
|
-
description: amount of energy utilised by the component
|
|
23
|
-
unit: kWh
|
|
24
|
-
aggregation: sum
|
|
25
|
-
energy-cpu:
|
|
26
|
-
description: Energy consumed by the CPU of the component
|
|
27
|
-
unit: kWh
|
|
28
|
-
aggregation: sum
|
|
29
|
-
expected-lifespan:
|
|
30
|
-
description: Total Expected Lifespan of the Component in Seconds
|
|
31
|
-
unit: seconds
|
|
32
|
-
aggregation: sum
|
|
33
|
-
energy-memory:
|
|
34
|
-
description: Energy consumed by the Memory of the component
|
|
35
|
-
unit: kWh
|
|
36
|
-
aggregation: sum
|
|
37
|
-
embodied-carbon:
|
|
38
|
-
description: Embodied Emissions of the component
|
|
39
|
-
unit: gCO2e
|
|
40
|
-
aggregation: sum
|
|
41
|
-
energy-network:
|
|
42
|
-
description: Energy consumed by the Network of the component
|
|
43
|
-
unit: kWh
|
|
44
|
-
aggregation: sum
|
|
45
|
-
functional-unit:
|
|
46
|
-
description: the name of the functional unit in which the final SCI value should be expressed, e.g. requests, users
|
|
47
|
-
unit: none
|
|
48
|
-
aggregation: sum
|
|
49
|
-
functional-unit-time:
|
|
50
|
-
description: string describing the unit of time in which the final SCI calculation should be expressed, e.g. "1-min"
|
|
51
|
-
unit: none
|
|
52
|
-
aggregation: none
|
|
53
|
-
gpu-util:
|
|
54
|
-
description: refers to CPU utilization.
|
|
55
|
-
unit: percentage
|
|
56
|
-
aggregation: avg
|
|
57
|
-
grid-carbon-intensity:
|
|
58
|
-
description: Carbon intensity for the grid
|
|
59
|
-
unit: gCO2eq/kWh
|
|
60
|
-
aggregation: avg
|
|
61
|
-
instance-type:
|
|
62
|
-
description: Type of Cloud Instance name used in the cloud provider APIs
|
|
63
|
-
unit: None
|
|
64
|
-
aggregation: None
|
|
65
|
-
location:
|
|
66
|
-
description: Geographic location of provider as string (for watt-time model it is provided as latitude and longitude, comma separated, in decimal degrees)
|
|
67
|
-
unit: None (decimal degrees for watt-time model)
|
|
68
|
-
aggregation: None
|
|
69
|
-
operational-carbon:
|
|
70
|
-
description: Operational Emissions of the component
|
|
71
|
-
unit: gCO2e
|
|
72
|
-
aggregation: sum
|
|
73
|
-
physical-processor:
|
|
74
|
-
description: Name of the physical processor
|
|
75
|
-
unit: None
|
|
76
|
-
aggregation: none
|
|
77
|
-
vendor:
|
|
78
|
-
description: Name of the cloud service provider in the ccf model. Can be aws, gcp or azure
|
|
79
|
-
unit: None
|
|
80
|
-
aggregation: none
|
|
81
|
-
ram-alloc:
|
|
82
|
-
description: refers to GB of memory allocated.
|
|
83
|
-
unit: GB
|
|
84
|
-
aggregation: avg
|
|
85
|
-
ram-util:
|
|
86
|
-
description: refers to percentage of memory utilized.
|
|
87
|
-
unit: percentage
|
|
88
|
-
aggregation: avg
|
|
89
|
-
resources-reserved:
|
|
90
|
-
description: resources reserved for an application
|
|
91
|
-
unit: count
|
|
92
|
-
aggregation: none
|
|
93
|
-
thermal-design-power:
|
|
94
|
-
description: thermal design power for a processor
|
|
95
|
-
unit: kwh
|
|
96
|
-
aggregation: avg
|
|
97
|
-
total-embodied-emissions:
|
|
98
|
-
description: total embodied emissions of some component
|
|
99
|
-
unit: gCO2e
|
|
100
|
-
aggregation: sum
|
|
101
|
-
timestamp:
|
|
102
|
-
description: refers to the time of occurrence of the input
|
|
103
|
-
unit: RFC3339
|
|
104
|
-
aggregation: none
|
|
105
|
-
time-reserved:
|
|
106
|
-
description: time reserved for a component
|
|
107
|
-
unit: seconds
|
|
108
|
-
aggregation: none
|
|
109
|
-
total-resources:
|
|
110
|
-
description: total resources available
|
|
111
|
-
unit: count
|
|
112
|
-
aggregation: none
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { ImplInitializeModel, InitalizedModels } from '../types/models-universe';
|
|
2
|
-
/**
|
|
3
|
-
* Models Initialization Lifecycle.
|
|
4
|
-
*/
|
|
5
|
-
export declare class ModelsUniverse {
|
|
6
|
-
/**
|
|
7
|
-
* Models list.
|
|
8
|
-
*/
|
|
9
|
-
initalizedModels: InitalizedModels;
|
|
10
|
-
/**
|
|
11
|
-
* Checks if model is instance of `IOutputModelInterface`.
|
|
12
|
-
*/
|
|
13
|
-
private instanceOfModel;
|
|
14
|
-
/**
|
|
15
|
-
* Imports module by given `path`.
|
|
16
|
-
*/
|
|
17
|
-
private importModuleFrom;
|
|
18
|
-
/**
|
|
19
|
-
* Imports `module` from given `path`, then checks if it's `ModelPluginInterface` extension.
|
|
20
|
-
*/
|
|
21
|
-
private importAndVerifyModule;
|
|
22
|
-
/**
|
|
23
|
-
* Returns plugin model. Checks if model is missing then rejects with error.
|
|
24
|
-
* Then checks if `path` is starting with github, then grabs the repository name.
|
|
25
|
-
* Imports module, then checks if it's a class which implements input model interface.
|
|
26
|
-
*/
|
|
27
|
-
private handModel;
|
|
28
|
-
/**
|
|
29
|
-
* Initializes and registers model.
|
|
30
|
-
*/
|
|
31
|
-
writeDown(modelToInitalize: ImplInitializeModel): Promise<InitalizedModels>;
|
|
32
|
-
/**
|
|
33
|
-
* Returns existing model by `name`.
|
|
34
|
-
*/
|
|
35
|
-
getInitializedModel(modelName: string, config: any): Promise<import("../types/model-interface").ModelPluginInterface>;
|
|
36
|
-
}
|