@grnsft/if 0.6.0 → 0.7.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/Refactor-migration-guide.md +68 -82
- package/github-processes.md +3 -9
- package/manifests/examples/builtins/coefficient/failure-invalid-config-input-param.yml +2 -4
- package/manifests/examples/builtins/coefficient/failure-output-param-is-null.yaml +1 -3
- package/manifests/examples/builtins/coefficient/success.yml +1 -3
- package/manifests/examples/builtins/csv-lookup/cloud-metadata/failure-invalid-instance-type.yaml +1 -2
- package/manifests/examples/builtins/csv-lookup/cloud-metadata/failure-invalid-vendor.yaml +3 -4
- package/manifests/examples/builtins/csv-lookup/cloud-metadata/failure-missing-cloud-vendor.yml +2 -3
- package/manifests/examples/builtins/csv-lookup/cloud-metadata/success.yml +1 -2
- package/manifests/examples/builtins/csv-lookup/region-metadata/failure-missing-column.yml +1 -1
- package/manifests/examples/builtins/csv-lookup/region-metadata/failure-missing-output.yml +2 -2
- package/manifests/examples/builtins/csv-lookup/region-metadata/success-renaming.yml +1 -1
- package/manifests/examples/builtins/csv-lookup/region-metadata/success.yml +1 -1
- package/manifests/examples/builtins/csv-lookup/tdp-finder/failure-missing-input-param.yml +1 -2
- package/manifests/examples/builtins/csv-lookup/tdp-finder/failure-unsupported-physical-processor.yml +1 -2
- package/manifests/examples/builtins/csv-lookup/tdp-finder/success.yml +1 -2
- package/manifests/examples/builtins/divide/failure-invalid-config-denominator.yml +3 -5
- package/manifests/examples/builtins/divide/failure-missing-numerator.yml +2 -4
- package/manifests/examples/builtins/divide/success.yml +2 -2
- package/manifests/examples/builtins/exponent/success.yml +1 -1
- package/manifests/examples/builtins/interpolation/success.yml +1 -1
- package/manifests/examples/builtins/mock-observations/failure-invalid-config-cpu-range.yml +2 -2
- package/manifests/examples/builtins/mock-observations/failure-invalid-memory-utilization-range.yml +1 -1
- package/manifests/examples/builtins/mock-observations/failure-missing-timestamp-from-param.yml +1 -1
- package/manifests/examples/builtins/mock-observations/success.yml +1 -1
- package/manifests/examples/builtins/multiply/failure-input-parameter-is-missing.yml +1 -1
- package/manifests/examples/builtins/multiply/success-with-multiple-inputs.yml +1 -1
- package/manifests/examples/builtins/multiply/success.yml +1 -1
- package/manifests/examples/builtins/regex/failure-missing-input-param.yml +1 -1
- package/manifests/examples/builtins/regex/failure-not-matching-with-regex.yml +2 -2
- package/manifests/examples/builtins/regex/success.yml +1 -1
- package/manifests/examples/builtins/sci/failure-invalid-config-value.yml +3 -4
- package/manifests/examples/builtins/sci/failure-missing-input-param.yml +1 -1
- package/manifests/examples/builtins/sci/success.yml +1 -1
- package/manifests/examples/builtins/sci-embodied/scenario-1.yml +27 -0
- package/manifests/examples/builtins/sci-embodied/scenario-2.yml +37 -0
- package/manifests/examples/builtins/sci-embodied/success.yml +13 -0
- package/manifests/examples/builtins/shell/failure-invalid-command.yml +2 -2
- package/manifests/examples/builtins/shell/success.yml +2 -2
- package/manifests/examples/builtins/subtract/success.yml +1 -1
- package/manifests/examples/builtins/sum/failure-missing-input-param.yml +2 -2
- package/manifests/examples/builtins/sum/failure-missing-output-param.yml +2 -2
- package/manifests/examples/builtins/sum/success.yml +1 -1
- package/manifests/examples/builtins/time-converter/success.yaml +3 -3
- package/manifests/examples/builtins/time-sync/failure-config-start-later-end.yml +10 -12
- package/manifests/examples/builtins/time-sync/{failure-missing-global-config.yml → failure-missing-config.yml} +3 -8
- package/manifests/examples/builtins/time-sync/success.yml +2 -2
- package/manifests/examples/features/regroup/failure-missing-cloud-instance-type.yml +1 -1
- package/manifests/examples/features/regroup/success.yml +1 -1
- package/manifests/examples/pipelines/generics.yml +8 -8
- package/manifests/examples/pipelines/instance-metadata.yml +2 -2
- package/manifests/examples/pipelines/nesting.yml +75 -33
- package/manifests/examples/pipelines/outputs-if-diff/pipeline-with-aggregate.yaml +166 -122
- package/manifests/examples/pipelines/outputs-if-diff/pipeline-with-mocks.yaml +130 -70
- package/manifests/examples/pipelines/pipeline-teads-sci.yml +15 -15
- package/manifests/examples/pipelines/pipeline-with-aggregate.yml +57 -27
- package/manifests/examples/pipelines/pipeline-with-mocks.yml +99 -41
- package/manifests/examples/pipelines/scenario-3.yml +1 -1
- package/manifests/examples/pipelines/scenario-4.yml +5 -5
- package/manifests/examples/pipelines/scenario-5.yml +3 -3
- package/manifests/examples/pipelines/sci.yml +12 -12
- package/manifests/examples/pipelines/teads-curve.yml +10 -10
- package/manifests/examples/pipelines/zeros.yml +23 -23
- package/manifests/outputs/bugs/aggregation-error-wrong-metric.yaml +40 -40
- package/manifests/outputs/bugs/input-error-missing-duration.yaml +1 -1
- package/manifests/outputs/bugs/mock-observations-failure-duration-is-zero.yaml +2 -2
- package/manifests/outputs/bugs/pipeline-error-naming-mismatch.yaml +1 -1
- package/manifests/outputs/bugs/pipeline-error-uninitialized-plugin.yaml +1 -1
- package/manifests/outputs/bugs/pipeline-ordering-error.yaml +6 -6
- package/manifests/outputs/builtins/coefficient/failure-invalid-config-input-param.yaml +2 -2
- package/manifests/outputs/builtins/coefficient/failure-output-param-is-null.yaml +1 -1
- package/manifests/outputs/builtins/coefficient/success.yaml +23 -22
- package/manifests/outputs/builtins/csv-lookup/cloud-metadata/failure-invalid-instance-type.yaml +1 -1
- package/manifests/outputs/builtins/csv-lookup/cloud-metadata/failure-invalid-vendor.yaml +76 -0
- package/manifests/outputs/builtins/csv-lookup/cloud-metadata/failure-missing-cloud-vendor.yaml +22 -21
- package/manifests/outputs/builtins/csv-lookup/cloud-metadata/success.yaml +1 -1
- package/manifests/outputs/builtins/csv-lookup/region-metadata/failure-missing-column.yaml +1 -1
- package/manifests/outputs/builtins/csv-lookup/region-metadata/failure-missing-output.yaml +21 -20
- package/manifests/outputs/builtins/csv-lookup/region-metadata/success-renaming.yaml +1 -1
- package/manifests/outputs/builtins/csv-lookup/region-metadata/success.yaml +1 -1
- package/manifests/outputs/builtins/csv-lookup/tdp-finder/failure-missing-input-param.yaml +1 -1
- package/manifests/outputs/builtins/csv-lookup/tdp-finder/failure-unsupported-physical-processor.yaml +1 -1
- package/manifests/outputs/builtins/csv-lookup/tdp-finder/success.yaml +1 -1
- package/manifests/outputs/builtins/divide/failure-invalid-config-denominator.yaml +41 -25
- package/manifests/outputs/builtins/divide/failure-missing-numerator.yaml +32 -23
- package/manifests/outputs/builtins/divide/success-denominator-equal-zero.yaml +2 -2
- package/manifests/outputs/builtins/divide/success.yaml +2 -2
- package/manifests/outputs/builtins/exponent/success.yaml +1 -1
- package/manifests/outputs/builtins/interpolation/interpolation.yaml +1 -1
- package/manifests/outputs/builtins/interpolation/success.yaml +1 -1
- package/manifests/outputs/builtins/mock-observations/failure-invalid-config-cpu-range.yaml +3 -3
- package/manifests/outputs/builtins/mock-observations/failure-invalid-memory-utilization-range.yaml +2 -2
- package/manifests/outputs/builtins/mock-observations/failure-missing-timestamp-from-param.yaml +1 -1
- package/manifests/outputs/builtins/mock-observations/success.yaml +49 -190
- package/manifests/outputs/builtins/multiply/failure-input-parameter-is-missing.yaml +1 -1
- package/manifests/outputs/builtins/multiply/success-with-multiple-inputs.yaml +1 -1
- package/manifests/outputs/builtins/multiply/success.yaml +1 -1
- package/manifests/outputs/builtins/regex/failure-missing-input-param.yaml +1 -1
- package/manifests/outputs/builtins/regex/failure-not-matching-with-regex.yaml +72 -0
- package/manifests/outputs/builtins/regex/success.yaml +1 -1
- package/manifests/outputs/builtins/sci/failure-invalid-config-value.yaml +22 -23
- package/manifests/outputs/builtins/sci/failure-missing-input-param.yaml +1 -1
- package/manifests/outputs/builtins/sci/success.yaml +1 -1
- package/manifests/outputs/builtins/sci-embodied/failure-invalid-default-emission-value.yaml +22 -26
- package/manifests/outputs/builtins/sci-embodied/scenario-1.yaml +100 -0
- package/manifests/outputs/builtins/sci-embodied/scenario-2.yaml +101 -0
- package/manifests/outputs/builtins/sci-embodied/success.yaml +44 -20
- package/manifests/outputs/builtins/shell/failure-invalid-command.yaml +2 -2
- package/manifests/outputs/builtins/shell/success.yaml +1 -1
- package/manifests/outputs/builtins/subtract/success.yaml +1 -1
- package/manifests/outputs/builtins/sum/failure-missing-input-param.yaml +2 -2
- package/manifests/outputs/builtins/sum/failure-missing-output-param.yaml +2 -2
- package/manifests/outputs/builtins/sum/success.yaml +1 -1
- package/manifests/outputs/builtins/time-converter/success.yaml +73 -0
- package/manifests/outputs/builtins/time-sync/failure-config-start-later-end.yaml +3 -3
- package/manifests/outputs/builtins/time-sync/failure-missing-config.yaml +74 -0
- package/manifests/outputs/builtins/time-sync/success.yaml +50 -59
- package/manifests/outputs/features/aggregate-failure-invalid-metrics.yaml +1 -1
- package/manifests/outputs/features/aggregate-failure-missing-metric-in-inputs.yaml +1 -1
- package/manifests/outputs/features/aggregate-horizontal.yaml +4 -2
- package/manifests/outputs/features/aggregate-vertical.yaml +4 -2
- package/manifests/outputs/features/aggregate.yaml +4 -2
- package/manifests/outputs/features/regroup/failure-invalid-regroup.yaml +87 -0
- package/manifests/outputs/features/regroup/failure-missing-cloud-instance-type.yaml +87 -0
- package/manifests/outputs/pipelines/cloud-metadata-divide.yaml +2 -2
- package/manifests/outputs/pipelines/generics.yaml +28 -28
- package/manifests/outputs/pipelines/instance-metadata.yaml +14 -14
- package/manifests/outputs/pipelines/nesting.yaml +713 -486
- package/manifests/outputs/pipelines/pipeline-teads-sci.yaml +63 -32
- package/manifests/outputs/pipelines/scenario-4.yaml +105 -0
- package/manifests/outputs/pipelines/sci.yaml +56 -32
- package/manifests/outputs/pipelines/teads-curve.yaml +18 -18
- package/manifests/outputs/pipelines/zeros.yaml +27 -27
- package/package.json +4 -4
- package/src/__mocks__/mock-manifest.yaml +1 -2
- package/src/if-env/config/env-template.yml +1 -2
- package/src/if-run/builtins/coefficient/README.md +41 -17
- package/src/if-run/builtins/copy-param/README.md +28 -8
- package/src/if-run/builtins/csv-lookup/README.md +31 -11
- package/src/if-run/builtins/divide/README.md +34 -12
- package/src/if-run/builtins/exponent/README.md +29 -11
- package/src/if-run/builtins/interpolation/README.md +37 -22
- package/src/if-run/builtins/mock-observations/README.md +27 -7
- package/src/if-run/builtins/multiply/README.md +27 -9
- package/src/if-run/builtins/regex/README.md +31 -11
- package/src/if-run/builtins/sci/README.md +29 -8
- package/src/if-run/builtins/sci-embodied/README.md +76 -75
- package/src/if-run/builtins/shell/README.md +15 -7
- package/src/if-run/builtins/subtract/README.md +28 -11
- package/src/if-run/builtins/sum/README.md +47 -14
- package/src/if-run/builtins/time-converter/README.md +8 -8
- package/src/if-run/builtins/time-sync/README.md +44 -22
- package/.gitmodules +0 -3
- package/build/common/config/index.d.ts +0 -1
- package/build/common/config/index.js +0 -6
- package/build/common/config/strings.d.ts +0 -9
- package/build/common/config/strings.js +0 -17
- package/build/common/lib/load.d.ts +0 -6
- package/build/common/lib/load.js +0 -18
- package/build/common/types/manifest.d.ts +0 -13
- package/build/common/types/manifest.js +0 -3
- package/build/common/util/debug-logger.d.ts +0 -4
- package/build/common/util/debug-logger.js +0 -115
- package/build/common/util/fs.d.ts +0 -20
- package/build/common/util/fs.js +0 -94
- package/build/common/util/helpers.d.ts +0 -15
- package/build/common/util/helpers.js +0 -80
- package/build/common/util/logger.d.ts +0 -5
- package/build/common/util/logger.js +0 -39
- package/build/common/util/validations.d.ts +0 -367
- package/build/common/util/validations.js +0 -141
- package/build/common/util/yaml.d.ts +0 -12
- package/build/common/util/yaml.js +0 -59
- package/build/if-check/config/config.d.ts +0 -6
- package/build/if-check/config/config.js +0 -31
- package/build/if-check/config/index.d.ts +0 -2
- package/build/if-check/config/index.js +0 -8
- package/build/if-check/config/strings.d.ts +0 -11
- package/build/if-check/config/strings.js +0 -15
- package/build/if-check/index.d.ts +0 -2
- package/build/if-check/index.js +0 -98
- package/build/if-check/types/process-args.d.ts +0 -4
- package/build/if-check/types/process-args.js +0 -3
- package/build/if-check/util/args.d.ts +0 -10
- package/build/if-check/util/args.js +0 -56
- package/build/if-check/util/helpers.d.ts +0 -4
- package/build/if-check/util/helpers.js +0 -18
- package/build/if-check/util/npm.d.ts +0 -4
- package/build/if-check/util/npm.js +0 -59
- package/build/if-csv/config/config.d.ts +0 -6
- package/build/if-csv/config/config.js +0 -36
- package/build/if-csv/config/index.d.ts +0 -2
- package/build/if-csv/config/index.js +0 -8
- package/build/if-csv/config/strings.d.ts +0 -3
- package/build/if-csv/config/strings.js +0 -7
- package/build/if-csv/index.d.ts +0 -2
- package/build/if-csv/index.js +0 -63
- package/build/if-csv/types/csv.d.ts +0 -7
- package/build/if-csv/types/csv.js +0 -3
- package/build/if-csv/types/process-args.d.ts +0 -5
- package/build/if-csv/types/process-args.js +0 -3
- package/build/if-csv/util/args.d.ts +0 -12
- package/build/if-csv/util/args.js +0 -47
- package/build/if-csv/util/helpers.d.ts +0 -9
- package/build/if-csv/util/helpers.js +0 -95
- package/build/if-diff/config/config.d.ts +0 -6
- package/build/if-diff/config/config.js +0 -31
- package/build/if-diff/config/index.d.ts +0 -2
- package/build/if-diff/config/index.js +0 -8
- package/build/if-diff/config/strings.d.ts +0 -6
- package/build/if-diff/config/strings.js +0 -10
- package/build/if-diff/index.d.ts +0 -2
- package/build/if-diff/index.js +0 -46
- package/build/if-diff/lib/compare.d.ts +0 -10
- package/build/if-diff/lib/compare.js +0 -56
- package/build/if-diff/lib/load.d.ts +0 -55
- package/build/if-diff/lib/load.js +0 -51
- package/build/if-diff/types/args.d.ts +0 -5
- package/build/if-diff/types/args.js +0 -3
- package/build/if-diff/types/compare.d.ts +0 -7
- package/build/if-diff/types/compare.js +0 -3
- package/build/if-diff/types/process-args.d.ts +0 -4
- package/build/if-diff/types/process-args.js +0 -3
- package/build/if-diff/util/args.d.ts +0 -5
- package/build/if-diff/util/args.js +0 -51
- package/build/if-diff/util/helpers.d.ts +0 -13
- package/build/if-diff/util/helpers.js +0 -75
- package/build/if-env/config/config.d.ts +0 -6
- package/build/if-env/config/config.js +0 -37
- package/build/if-env/config/index.d.ts +0 -2
- package/build/if-env/config/index.js +0 -8
- package/build/if-env/config/strings.d.ts +0 -7
- package/build/if-env/config/strings.js +0 -11
- package/build/if-env/index.d.ts +0 -2
- package/build/if-env/index.js +0 -40
- package/build/if-env/types/if-env.d.ts +0 -8
- package/build/if-env/types/if-env.js +0 -3
- package/build/if-env/types/npm.d.ts +0 -9
- package/build/if-env/types/npm.js +0 -3
- package/build/if-env/types/process-args.d.ts +0 -5
- package/build/if-env/types/process-args.js +0 -3
- package/build/if-env/util/args.d.ts +0 -12
- package/build/if-env/util/args.js +0 -47
- package/build/if-env/util/helpers.d.ts +0 -20
- package/build/if-env/util/helpers.js +0 -94
- package/build/if-env/util/npm.d.ts +0 -24
- package/build/if-env/util/npm.js +0 -126
- package/build/if-merge/config/config.d.ts +0 -6
- package/build/if-merge/config/config.js +0 -43
- package/build/if-merge/config/index.d.ts +0 -2
- package/build/if-merge/config/index.js +0 -8
- package/build/if-merge/config/strings.d.ts +0 -5
- package/build/if-merge/config/strings.js +0 -9
- package/build/if-merge/index.d.ts +0 -2
- package/build/if-merge/index.js +0 -26
- package/build/if-merge/types/process-args.d.ts +0 -6
- package/build/if-merge/types/process-args.js +0 -3
- package/build/if-merge/util/args.d.ts +0 -9
- package/build/if-merge/util/args.js +0 -59
- package/build/if-merge/util/helpers.d.ts +0 -5
- package/build/if-merge/util/helpers.js +0 -83
- package/build/if-run/builtins/coefficient/index.d.ts +0 -2
- package/build/if-run/builtins/coefficient/index.js +0 -67
- package/build/if-run/builtins/copy-param/index.d.ts +0 -2
- package/build/if-run/builtins/copy-param/index.js +0 -70
- package/build/if-run/builtins/csv-lookup/index.d.ts +0 -2
- package/build/if-run/builtins/csv-lookup/index.js +0 -190
- package/build/if-run/builtins/divide/index.d.ts +0 -2
- package/build/if-run/builtins/divide/index.js +0 -80
- package/build/if-run/builtins/exponent/index.d.ts +0 -2
- package/build/if-run/builtins/exponent/index.js +0 -60
- package/build/if-run/builtins/export-log.d.ts +0 -4
- package/build/if-run/builtins/export-log.js +0 -44
- package/build/if-run/builtins/export-yaml.d.ts +0 -4
- package/build/if-run/builtins/export-yaml.js +0 -30
- package/build/if-run/builtins/index.d.ts +0 -16
- package/build/if-run/builtins/index.js +0 -36
- package/build/if-run/builtins/interpolation/index.d.ts +0 -2
- package/build/if-run/builtins/interpolation/index.js +0 -151
- package/build/if-run/builtins/mock-observations/helpers/common-generator.d.ts +0 -3
- package/build/if-run/builtins/mock-observations/helpers/common-generator.js +0 -29
- package/build/if-run/builtins/mock-observations/helpers/rand-int-generator.d.ts +0 -3
- package/build/if-run/builtins/mock-observations/helpers/rand-int-generator.js +0 -48
- package/build/if-run/builtins/mock-observations/index.d.ts +0 -2
- package/build/if-run/builtins/mock-observations/index.js +0 -116
- package/build/if-run/builtins/mock-observations/interfaces/index.d.ts +0 -6
- package/build/if-run/builtins/mock-observations/interfaces/index.js +0 -3
- package/build/if-run/builtins/multiply/index.d.ts +0 -2
- package/build/if-run/builtins/multiply/index.js +0 -59
- package/build/if-run/builtins/regex/index.d.ts +0 -2
- package/build/if-run/builtins/regex/index.js +0 -76
- package/build/if-run/builtins/sci/index.d.ts +0 -2
- package/build/if-run/builtins/sci/index.js +0 -92
- package/build/if-run/builtins/sci-embodied/index.d.ts +0 -2
- package/build/if-run/builtins/sci-embodied/index.js +0 -156
- package/build/if-run/builtins/shell/index.d.ts +0 -2
- package/build/if-run/builtins/shell/index.js +0 -60
- package/build/if-run/builtins/subtract/index.d.ts +0 -2
- package/build/if-run/builtins/subtract/index.js +0 -61
- package/build/if-run/builtins/sum/index.d.ts +0 -2
- package/build/if-run/builtins/sum/index.js +0 -66
- package/build/if-run/builtins/time-converter/config.d.ts +0 -1
- package/build/if-run/builtins/time-converter/config.js +0 -44
- package/build/if-run/builtins/time-converter/index.d.ts +0 -2
- package/build/if-run/builtins/time-converter/index.js +0 -79
- package/build/if-run/builtins/time-sync/index.d.ts +0 -17
- package/build/if-run/builtins/time-sync/index.js +0 -339
- package/build/if-run/config/config.d.ts +0 -9
- package/build/if-run/config/config.js +0 -73
- package/build/if-run/config/index.d.ts +0 -2
- package/build/if-run/config/index.js +0 -8
- package/build/if-run/config/strings.d.ts +0 -64
- package/build/if-run/config/strings.js +0 -76
- package/build/if-run/index.d.ts +0 -2
- package/build/if-run/index.js +0 -63
- package/build/if-run/lib/aggregate.d.ts +0 -15
- package/build/if-run/lib/aggregate.js +0 -123
- package/build/if-run/lib/compute.d.ts +0 -5
- package/build/if-run/lib/compute.js +0 -142
- package/build/if-run/lib/environment.d.ts +0 -5
- package/build/if-run/lib/environment.js +0 -75
- package/build/if-run/lib/exhaust.d.ts +0 -7
- package/build/if-run/lib/exhaust.js +0 -27
- package/build/if-run/lib/explain.d.ts +0 -9
- package/build/if-run/lib/explain.js +0 -43
- package/build/if-run/lib/initialize.d.ts +0 -6
- package/build/if-run/lib/initialize.js +0 -109
- package/build/if-run/lib/regroup.d.ts +0 -5
- package/build/if-run/lib/regroup.js +0 -64
- package/build/if-run/types/aggregation.d.ts +0 -5
- package/build/if-run/types/aggregation.js +0 -6
- package/build/if-run/types/compute.d.ts +0 -29
- package/build/if-run/types/compute.js +0 -3
- package/build/if-run/types/environment.d.ts +0 -18
- package/build/if-run/types/environment.js +0 -3
- package/build/if-run/types/exhaust-plugin-interface.d.ts +0 -7
- package/build/if-run/types/exhaust-plugin-interface.js +0 -3
- package/build/if-run/types/explain.d.ts +0 -10
- package/build/if-run/types/explain.js +0 -3
- package/build/if-run/types/interface.d.ts +0 -3
- package/build/if-run/types/interface.js +0 -6
- package/build/if-run/types/plugin-storage.d.ts +0 -6
- package/build/if-run/types/plugin-storage.js +0 -3
- package/build/if-run/types/process-args.d.ts +0 -25
- package/build/if-run/types/process-args.js +0 -3
- package/build/if-run/types/time-sync.d.ts +0 -17
- package/build/if-run/types/time-sync.js +0 -3
- package/build/if-run/util/aggregation-helper.d.ts +0 -7
- package/build/if-run/util/aggregation-helper.js +0 -47
- package/build/if-run/util/args.d.ts +0 -9
- package/build/if-run/util/args.js +0 -60
- package/build/if-run/util/helpers.d.ts +0 -14
- package/build/if-run/util/helpers.js +0 -57
- package/build/if-run/util/log-memoize.d.ts +0 -3
- package/build/if-run/util/log-memoize.js +0 -19
- package/build/if-run/util/os-checker.d.ts +0 -7
- package/build/if-run/util/os-checker.js +0 -97
- package/build/if-run/util/plugin-storage.d.ts +0 -14
- package/build/if-run/util/plugin-storage.js +0 -34
- package/grafana/IF_GRAFANA_SETUP.md +0 -71
- package/grafana/if_grafana_config.json +0 -370
- package/manifests/examples/builtins/divide/failure-denominator-equal-zero.yml +0 -38
- package/manifests/examples/builtins/interpolation/interpolation.yml +0 -24
- package/manifests/examples/builtins/sci-embodied/failure-invalid-default-emission-value.yml +0 -23
- package/manifests/examples/builtins/sci-embodied/failure-missing-expected-lifespan.yml +0 -23
- package/manifests/examples/pipelines/scenario-1.yml +0 -34
- package/manifests/examples/pipelines/scenario-2.yml +0 -52
- package/manifests/outputs/bugs/sci-embodied-missing-resources-total.yaml +0 -72
- package/manifests/outputs/builtins/sci-embodied/failure-missing-expected-lifespan.yaml +0 -69
- package/manifests/outputs/pipelines/mock-obs-time-sync.yaml +0 -449
|
@@ -2,135 +2,136 @@
|
|
|
2
2
|
|
|
3
3
|
Software systems cause emissions through the hardware that they operate on, both through the energy that the physical hardware consumes and the emissions associated with manufacturing the hardware. Embodied carbon refers to the carbon emitted during the manufacture and eventual disposal of a component. It is added to the operational carbon (carbon emitted when a component is used) to give an overall SCI score.
|
|
4
4
|
|
|
5
|
-
Read more on [embodied carbon](https://github.com/Green-Software-Foundation/sci/blob/main/Software_Carbon_Intensity/Software_Carbon_Intensity_Specification.md#embodied-emissions)
|
|
5
|
+
Read more on [embodied carbon](https://github.com/Green-Software-Foundation/sci/blob/main/Software_Carbon_Intensity/Software_Carbon_Intensity_Specification.md#embodied-emissions).
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Our plugin follows the Cloud Carbon Footprint methodology for calculating embodied carbon and extends it to scale down the total embodied carbon for a piece of hardware by the portion of it that should be allocated to a particular application, using a `usage-ratio` and `time`. The `usage-ratio` is a term that can be used to scale by, for example, the storage you actually use on a shared server, rather than the total storage available for that hardware, or the time you are active compared to the hardware lifespan.
|
|
8
8
|
|
|
9
|
-
### Plugin config
|
|
10
9
|
|
|
11
|
-
|
|
10
|
+
## Parameters
|
|
12
11
|
|
|
13
|
-
### Plugin
|
|
12
|
+
### Plugin Configuration
|
|
14
13
|
|
|
15
|
-
The `
|
|
14
|
+
The `SciEmbodied` plugin requires a configuration object and parameter metadata (optional) to do the calculation.
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
### Plugin Parameter Metadata
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
- `unit`: unit of the parameter
|
|
21
|
-
- `aggregation-method`: aggregation method of the parameter (it can be `sum`, `avg` or `none`)
|
|
18
|
+
The `parameter-metadata` section contains information about the `description`, `unit`, and `aggregation-method` of the input and output parameters.
|
|
22
19
|
|
|
23
|
-
- `
|
|
24
|
-
- `description`: description of the parameter
|
|
25
|
-
- `unit`: unit of the parameter
|
|
26
|
-
- `aggregation-method`:
|
|
20
|
+
- `inputs`: Describes the parameters for the input data. Each parameter includes:
|
|
21
|
+
- `description`: A brief description of the parameter.
|
|
22
|
+
- `unit`: The unit of measurement for the parameter.
|
|
23
|
+
- `aggregation-method`: The method used to aggregate this parameter (`sum`, `avg`, or `none`).
|
|
27
24
|
|
|
28
|
-
|
|
25
|
+
- `outputs`: Describes the `embodied-carbon` parameter, which includes:
|
|
26
|
+
- `description`: A brief description of the parameter.
|
|
27
|
+
- `unit`: The unit of measurement for the parameter.
|
|
28
|
+
- `aggregation-method`: The method used to aggregate this parameter (`sum`, `avg`, or `none`).
|
|
29
29
|
|
|
30
|
-
|
|
31
|
-
- `device/expected-lifespan`: the length of time, in seconds, between a component's manufacture and its disposal
|
|
32
|
-
- `resources-reserved`: the number of resources reserved for use by the software
|
|
33
|
-
- `resources-total`: the total number of resources available
|
|
34
|
-
- `duration`: the amount of time covered by an observation, in this context it is used as the share of the total life span of the hardware reserved for use by an application, in seconds.
|
|
30
|
+
### Mapping
|
|
35
31
|
|
|
36
|
-
|
|
32
|
+
The `mapping` block is an optional block. It is added in the plugin section and allows the plugin to receive a parameter from the input with a different name than the one the plugin uses for data manipulation. The parameter with the mapped name will not appear in the outputs. It also maps the output parameter of the plugin. The structure of the `mapping` block is:
|
|
37
33
|
|
|
38
|
-
|
|
34
|
+
```yaml
|
|
35
|
+
sci-embodied:
|
|
36
|
+
method: SciEmbodied
|
|
37
|
+
path: 'builtins'
|
|
38
|
+
mapping:
|
|
39
|
+
'parameter-name-in-the-plugin': 'parameter-name-in-the-input'
|
|
40
|
+
```
|
|
39
41
|
|
|
40
|
-
|
|
42
|
+
### Config
|
|
41
43
|
|
|
42
|
-
|
|
44
|
+
`baseline-vcpus`: the number of CPUs to use in the baseline server, defaults tothe CCF value of 1,
|
|
45
|
+
`baseline-memory`: the amount of memory to use in the baseline server, defaults tothe CCF value of 16,
|
|
46
|
+
`baseline-emissions`: the embodied carbon assumed to represent a baseline server, in g
|
|
47
|
+
`lifespan`: the lifespan of the device, in seconds. Defaults to 4 years (126144000 seconds),
|
|
48
|
+
`time`: the time to consider when scaling the total device embodied carbon, if not given defaults to `duration`
|
|
49
|
+
`vcpu-emissions-constant`: emissions for a CPU in gCO2e. Defaults tothe CCF value (100000),
|
|
50
|
+
`memory-emissions-constant`: value used in calculating emissions due to memory, defaults to the CCf value of 533/384
|
|
51
|
+
`ssd-emissions-constant`: emissions for a SSD in gCO2e. Defaults tothe CCF value (50000),
|
|
52
|
+
`hdd-emissions-constant`: emissions for a CPU in gCO2e. Defaults tothe CCF value (100000),
|
|
53
|
+
`gpu-emissions-constant`: emissions for a GPU in gCO2e. Defaults tothe CCF value (150000),
|
|
54
|
+
`output-parameter`: name to give the output value, defaults to `embodied-carbon`
|
|
43
55
|
|
|
44
|
-
|
|
56
|
+
Note that if you do not provide any config at all, we will fallback to defaults for everything, equivalent to setting the baseline server equal to the CCF version, which has 1000000g of embodied emissions.
|
|
45
57
|
|
|
46
|
-
|
|
47
|
-
m = te * ts * rs
|
|
48
|
-
```
|
|
58
|
+
### Inputs
|
|
49
59
|
|
|
50
|
-
|
|
60
|
+
- `vCPUs`: number of CPUs available on device
|
|
61
|
+
- `memory`: amount of RAM available on device, in GB
|
|
62
|
+
- `ssd`: number of SSD drives mounted on device
|
|
63
|
+
- `hdd`: number of HDD drives mounted on device
|
|
64
|
+
- `gpu`: number of GPUs available on device
|
|
65
|
+
- `duration`: The length of time the hardware is reserved for use by the software, in seconds.
|
|
66
|
+
- `time`: the time to use for scalign the total embodied carbon per timestap, if you do not want to use `duration`
|
|
67
|
+
- `usage-ratio`: the ratio by which to scale down the total embodied carbon according to your usage, e.g. for a shared storage server the total storage divided by your actual storage.
|
|
51
68
|
|
|
52
|
-
|
|
69
|
+
Note that if you do not provide any inputs at all, we fall back to defaults that are equivalent to using the full resources of the baseline server, scaled only by `duration`.
|
|
53
70
|
|
|
54
|
-
|
|
71
|
+
### Outputs
|
|
55
72
|
|
|
56
|
-
|
|
57
|
-
- `duration` = the length of time the hardware is reserved for use by the software.
|
|
58
|
-
- `device/expected-lifespan` = Expected lifespan: the length of time, in seconds, between a component's manufacture and its disposal.
|
|
73
|
+
- `embodied-carbon`: The total embodied emissions for the component, measured in gCO2e, per timestep.
|
|
59
74
|
|
|
60
|
-
|
|
61
|
-
- `resourceShare` is calculated as `resources-reserved/resources-total`, where:
|
|
62
|
-
- `resources-reserved` = Resources reserved; the number of resources reserved for use by the software.
|
|
63
|
-
- `resources-total` = Total Resources; the total number of resources available.
|
|
75
|
+
## Calculation
|
|
64
76
|
|
|
65
|
-
|
|
77
|
+
The plugin calculates the total embodied carbon emissions using the following steps:
|
|
66
78
|
|
|
67
|
-
|
|
79
|
+
- CPU emissions (`cpuE`) are calculated based on the difference between allocated vCPUs and baseline vCPUs.
|
|
80
|
+
- Memory emissions (`memoryE`) are calculated based on the difference between allocated memory and baseline memory.
|
|
81
|
+
- Emissions for HDD, SSD, and GPU are also calculated based on their respective differences from baseline values.
|
|
82
|
+
- The total embodied emissions are calculated by summing the baseline emissions with the above components scaling by the usage ratio and time.
|
|
68
83
|
|
|
69
|
-
##
|
|
84
|
+
## Implementation
|
|
70
85
|
|
|
71
|
-
The
|
|
86
|
+
The plugin can be instantiated and executed as follows:
|
|
72
87
|
|
|
73
88
|
```typescript
|
|
74
89
|
import {SciEmbodied} from 'builtins';
|
|
75
90
|
|
|
76
|
-
const sciEmbodied = SciEmbodied();
|
|
91
|
+
const sciEmbodied = SciEmbodied(config, parametersMetadata, {});
|
|
77
92
|
const results = await sciEmbodied.execute([
|
|
78
93
|
{
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
94
|
+
duration: 3600, // time reserved in seconds
|
|
95
|
+
vCPUs: 2, // allocated vCPUs
|
|
96
|
+
memory: 32, // allocated memory in GB
|
|
97
|
+
ssd: 100, // allocated SSD storage in GB
|
|
98
|
+
hdd: 1000, // allocated HDD storage in GB
|
|
99
|
+
gpu: 1, // allocated GPUs
|
|
84
100
|
},
|
|
85
101
|
]);
|
|
102
|
+
|
|
103
|
+
console.log(results);
|
|
86
104
|
```
|
|
87
105
|
|
|
88
|
-
|
|
106
|
+
# Example Manifest
|
|
89
107
|
|
|
90
|
-
IF users will typically call the plugin as part of a pipeline defined in a `manifest` file. In this case, instantiating the plugin is handled by `
|
|
108
|
+
IF users will typically call the plugin as part of a pipeline defined in a `manifest` file. In this case, instantiating the plugin is handled by `if-run` and does not have to be done explicitly by the user. The following is an example `manifest` that calls `sci-embodied`:
|
|
91
109
|
|
|
92
110
|
```yaml
|
|
93
111
|
name: sci-embodied
|
|
94
|
-
description:
|
|
112
|
+
description: demo invoking sci-embodied
|
|
95
113
|
tags:
|
|
96
114
|
initialize:
|
|
97
115
|
plugins:
|
|
98
116
|
sci-embodied:
|
|
99
117
|
method: SciEmbodied
|
|
100
118
|
path: 'builtins'
|
|
119
|
+
mapping:
|
|
120
|
+
device/emissions-embodied: device/carbon-footprint
|
|
101
121
|
tree:
|
|
102
122
|
children:
|
|
103
123
|
child:
|
|
104
124
|
pipeline:
|
|
105
125
|
compute:
|
|
106
|
-
- sci-embodied
|
|
107
|
-
defaults:
|
|
108
|
-
device/emissions-embodied: 1533.120 # gCO2eq
|
|
109
|
-
device/expected-lifespan: 3 # 3 years in seconds
|
|
110
|
-
resources-reserved: 1
|
|
111
|
-
resources-total: 8
|
|
126
|
+
- sci-embodied
|
|
112
127
|
inputs:
|
|
113
|
-
- timestamp:
|
|
128
|
+
- timestamp: 2024-08-19T00:00
|
|
114
129
|
duration: 3600
|
|
115
130
|
```
|
|
116
131
|
|
|
117
|
-
|
|
132
|
+
To run this example manifest, use the following command:
|
|
118
133
|
|
|
119
|
-
```
|
|
134
|
+
```bash
|
|
120
135
|
npm i -g @grnsft/if
|
|
121
|
-
if-run --manifest manifests/plugins/sci-embodied.yml --output manifests/outputs/
|
|
136
|
+
if-run --manifest manifests/plugins/sci-embodied/success.yml --output manifests/outputs/success.yml
|
|
122
137
|
```
|
|
123
|
-
|
|
124
|
-
The results will be saved to a new `yaml` file in `./examples/outputs`.
|
|
125
|
-
|
|
126
|
-
## Errors
|
|
127
|
-
|
|
128
|
-
`SciEmbodied` uses one of IF's error classes
|
|
129
|
-
|
|
130
|
-
### `SciEmbodiedError`
|
|
131
|
-
|
|
132
|
-
This error class is used to describe a problem with one of the input values to `sci-embodied`. This is typically due to an incorrect type or a reference to a value that is not available.
|
|
133
|
-
|
|
134
|
-
You will receive a specific error message explaining which parameter is problematic, and you can check and replace where appropriate.
|
|
135
|
-
|
|
136
|
-
For more information on our error classes, please visit [our docs](https://if.greensoftware.foundation/reference/errors
|
|
@@ -4,7 +4,7 @@ The `shell` is a wrapper enabling plugins implemented in any other programming l
|
|
|
4
4
|
|
|
5
5
|
## Parameters
|
|
6
6
|
|
|
7
|
-
### Plugin
|
|
7
|
+
### Plugin config
|
|
8
8
|
|
|
9
9
|
The plugin should be initialized as follows:
|
|
10
10
|
|
|
@@ -14,7 +14,7 @@ initialize:
|
|
|
14
14
|
shell:
|
|
15
15
|
method: Shell
|
|
16
16
|
path: 'builtin'
|
|
17
|
-
|
|
17
|
+
config:
|
|
18
18
|
command: python3 /usr/local/bin/sampler
|
|
19
19
|
```
|
|
20
20
|
|
|
@@ -30,12 +30,16 @@ The `parameter-metadata` section contains information about `description`, `unit
|
|
|
30
30
|
|
|
31
31
|
- `description`: description of the parameter
|
|
32
32
|
- `unit`: unit of the parameter
|
|
33
|
-
- `aggregation-method`: aggregation method of the parameter
|
|
33
|
+
- `aggregation-method`: aggregation method object of the parameter
|
|
34
|
+
- `time`: this value is used for `horizontal` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
|
|
35
|
+
- `component`: this value is used for `vertical` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
|
|
34
36
|
|
|
35
37
|
- `outputs`: describe the output parameter. The parameter has the following attributes:
|
|
36
38
|
- `description`: description of the parameter
|
|
37
39
|
- `unit`: unit of the parameter
|
|
38
|
-
- `aggregation-method`: aggregation method of the parameter
|
|
40
|
+
- `aggregation-method`: aggregation method object of the parameter
|
|
41
|
+
- `time`: this value is used for `horizontal` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
|
|
42
|
+
- `component`: this value is used for `vertical` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
|
|
39
43
|
|
|
40
44
|
### Inputs
|
|
41
45
|
|
|
@@ -53,7 +57,11 @@ The specific return types depend on the plugin being invoked. Typically, we woul
|
|
|
53
57
|
To run the plugin, you must first create an instance of `Shell` and call its `execute()` to run the external plugin.
|
|
54
58
|
|
|
55
59
|
```typescript
|
|
56
|
-
const
|
|
60
|
+
const config = {
|
|
61
|
+
command: '/usr/local/bin/sampler',
|
|
62
|
+
};
|
|
63
|
+
const parametersMetadata = {inputs: {}, outputs: {}};
|
|
64
|
+
const output = Shell(config, parametersMetadata);
|
|
57
65
|
const result = await output.execute([
|
|
58
66
|
{
|
|
59
67
|
timestamp: '2021-01-01T00:00:00Z',
|
|
@@ -85,7 +93,7 @@ initialize:
|
|
|
85
93
|
sampler:
|
|
86
94
|
method: Shell
|
|
87
95
|
path: 'builtin'
|
|
88
|
-
|
|
96
|
+
config:
|
|
89
97
|
command: python3 /usr/local/bin/sampler
|
|
90
98
|
tree:
|
|
91
99
|
children:
|
|
@@ -112,7 +120,7 @@ initialize:
|
|
|
112
120
|
sampler:
|
|
113
121
|
method: Shell
|
|
114
122
|
path: 'builtin'
|
|
115
|
-
|
|
123
|
+
config:
|
|
116
124
|
command: python3 /usr/local/bin/sampler
|
|
117
125
|
tree:
|
|
118
126
|
children:
|
|
@@ -10,7 +10,7 @@ For example, you could subtract `cpu/energy` and `network/energy` and name the r
|
|
|
10
10
|
|
|
11
11
|
### Plugin config
|
|
12
12
|
|
|
13
|
-
Two parameters are required in
|
|
13
|
+
Two parameters are required in config: `input-parameters` and `output-parameter`.
|
|
14
14
|
|
|
15
15
|
`input-parameters`: an array of strings. Each string should match an existing key in the `inputs` array
|
|
16
16
|
`output-parameter`: a string defining the name to use to add the result of the diff to the output array.
|
|
@@ -19,16 +19,32 @@ Two parameters are required in global config: `input-parameters` and `output-par
|
|
|
19
19
|
|
|
20
20
|
The `parameter-metadata` section contains information about `description`, `unit` and `aggregation-method` of the parameters of the inputs and outputs
|
|
21
21
|
|
|
22
|
-
- `inputs`: describe parameters of the `input-parameters` of the
|
|
22
|
+
- `inputs`: describe parameters of the `input-parameters` of the config. Each parameter has the following attributes:
|
|
23
23
|
|
|
24
24
|
- `description`: description of the parameter
|
|
25
25
|
- `unit`: unit of the parameter
|
|
26
|
-
- `aggregation-method`: aggregation method of the parameter
|
|
26
|
+
- `aggregation-method`: aggregation method object of the parameter
|
|
27
|
+
- `time`: this value is used for `horizontal` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
|
|
28
|
+
- `component`: this value is used for `vertical` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
|
|
27
29
|
|
|
28
|
-
- `outputs`: describe the parameter of the `output-parameter` of the
|
|
30
|
+
- `outputs`: describe the parameter of the `output-parameter` of the config. The parameter has the following attributes:
|
|
29
31
|
- `description`: description of the parameter
|
|
30
32
|
- `unit`: unit of the parameter
|
|
31
|
-
- `aggregation-method`: aggregation method of the parameter
|
|
33
|
+
- `aggregation-method`: aggregation method object of the parameter
|
|
34
|
+
- `time`: this value is used for `horizontal` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
|
|
35
|
+
- `component`: this value is used for `vertical` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
|
|
36
|
+
|
|
37
|
+
### Mapping
|
|
38
|
+
|
|
39
|
+
The `mapping` block is an optional block. It is added in the plugin section and allows the plugin to receive a parameter from the input with a different name than the one the plugin uses for data manipulation. The parameter with the mapped name will not appear in the outputs. It also maps the output parameter of the plugin. The structure of the `mapping` block is:
|
|
40
|
+
|
|
41
|
+
```yaml
|
|
42
|
+
subtract:
|
|
43
|
+
method: Subtract
|
|
44
|
+
path: 'builtin'
|
|
45
|
+
mapping:
|
|
46
|
+
'parameter-name-in-the-plugin': 'parameter-name-in-the-input'
|
|
47
|
+
```
|
|
32
48
|
|
|
33
49
|
### Inputs
|
|
34
50
|
|
|
@@ -36,7 +52,7 @@ All of `input-parameters` must be available in the input array.
|
|
|
36
52
|
|
|
37
53
|
## Returns
|
|
38
54
|
|
|
39
|
-
- `output-parameter`: the subtraction of all `input-parameters` with the parameter name defined by `output-parameter` in
|
|
55
|
+
- `output-parameter`: the subtraction of all `input-parameters` with the parameter name defined by `output-parameter` in config.
|
|
40
56
|
|
|
41
57
|
## Calculation
|
|
42
58
|
|
|
@@ -55,9 +71,10 @@ const config = {
|
|
|
55
71
|
inputParameters: ['cpu/energy', 'network/energy'],
|
|
56
72
|
outputParameter: 'offset/energy',
|
|
57
73
|
};
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
const
|
|
74
|
+
const parametersMetadata = {inputs: {}, outputs: {}};
|
|
75
|
+
const mapping = {};
|
|
76
|
+
const subtract = Subtract(config, parametersMetadata, mapping);
|
|
77
|
+
const result = await subtract.execute([
|
|
61
78
|
{
|
|
62
79
|
duration: 3600,
|
|
63
80
|
timestamp: '2021-01-01T00:00:00Z',
|
|
@@ -80,7 +97,7 @@ initialize:
|
|
|
80
97
|
subtract:
|
|
81
98
|
method: Subtract
|
|
82
99
|
path: 'builtin'
|
|
83
|
-
|
|
100
|
+
config:
|
|
84
101
|
input-parameters: ['cpu/energy', 'network/energy']
|
|
85
102
|
output-parameter: 'energy/diff'
|
|
86
103
|
tree:
|
|
@@ -113,4 +130,4 @@ The results will be saved to a new `yaml` file in `manifests/outputs`.
|
|
|
113
130
|
|
|
114
131
|
This error arises when an invalid value is passed to `Subtract`. Typically, this can occur when a non-numeric value (such as a string made of alphabetic characters) is passed where a number or numeric string is expected. Please check that the types are correct for all the relevant fields in your `inputs` array.
|
|
115
132
|
|
|
116
|
-
For more information on our error classes, please visit [our docs](https://if.greensoftware.foundation/reference/errors
|
|
133
|
+
For more information on our error classes, please visit [our docs](https://if.greensoftware.foundation/reference/errors)
|
|
@@ -10,7 +10,7 @@ For example, you could add `cpu/energy` and `network/energy` and name the result
|
|
|
10
10
|
|
|
11
11
|
### Plugin config
|
|
12
12
|
|
|
13
|
-
Two parameters are required in
|
|
13
|
+
Two parameters are required in config: `input-parameters` and `output-parameter`.
|
|
14
14
|
|
|
15
15
|
`input-parameters`: an array of strings. Each string should match an existing key in the `inputs` array
|
|
16
16
|
`output-parameter`: a string defining the name to use to add the result of summing the input parameters to the output array.
|
|
@@ -19,16 +19,32 @@ Two parameters are required in global config: `input-parameters` and `output-par
|
|
|
19
19
|
|
|
20
20
|
The `parameter-metadata` section contains information about `description`, `unit` and `aggregation-method` of the parameters of the inputs and outputs
|
|
21
21
|
|
|
22
|
-
- `inputs`: describe parameters of the `input-parameters` of the
|
|
22
|
+
- `inputs`: describe parameters of the `input-parameters` of the config. Each parameter has:
|
|
23
23
|
|
|
24
24
|
- `description`: description of the parameter
|
|
25
25
|
- `unit`: unit of the parameter
|
|
26
|
-
- `aggregation-method`: aggregation method of the parameter
|
|
26
|
+
- `aggregation-method`: aggregation method object of the parameter
|
|
27
|
+
- `time`: this value is used for `horizontal` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
|
|
28
|
+
- `component`: this value is used for `vertical` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
|
|
27
29
|
|
|
28
|
-
- `outputs`: describe the parameter of the `output-parameter` of the
|
|
30
|
+
- `outputs`: describe the parameter of the `output-parameter` of the config. The parameter has the following attributes:
|
|
29
31
|
- `description`: description of the parameter
|
|
30
32
|
- `unit`: unit of the parameter
|
|
31
|
-
- `aggregation-method`: aggregation method of the parameter
|
|
33
|
+
- `aggregation-method`: aggregation method object of the parameter
|
|
34
|
+
- `time`: this value is used for `horizontal` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
|
|
35
|
+
- `component`: this value is used for `vertical` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
|
|
36
|
+
|
|
37
|
+
### Mapping
|
|
38
|
+
|
|
39
|
+
The `mapping` block is an optional block. It is added in the plugin section and allows the plugin to receive a parameter from the input with a different name than the one the plugin uses for data manipulation. The parameter with the mapped name will not appear in the outputs. It also maps the output parameter of the plugin. The structure of the `mapping` block is:
|
|
40
|
+
|
|
41
|
+
```yaml
|
|
42
|
+
sum:
|
|
43
|
+
method: Sum
|
|
44
|
+
path: 'builtin'
|
|
45
|
+
mapping:
|
|
46
|
+
'parameter-name-in-the-plugin': 'parameter-name-in-the-input'
|
|
47
|
+
```
|
|
32
48
|
|
|
33
49
|
### Inputs
|
|
34
50
|
|
|
@@ -36,7 +52,7 @@ All of `input-parameters` must be available in the input array.
|
|
|
36
52
|
|
|
37
53
|
## Returns
|
|
38
54
|
|
|
39
|
-
- `output-parameter`: the sum of all `input-parameters` with the parameter name defined by `output-parameter` in
|
|
55
|
+
- `output-parameter`: the sum of all `input-parameters` with the parameter name defined by `output-parameter` in config.
|
|
40
56
|
|
|
41
57
|
## Calculation
|
|
42
58
|
|
|
@@ -53,9 +69,14 @@ const config = {
|
|
|
53
69
|
inputParameters: ['cpu/energy', 'network/energy'],
|
|
54
70
|
outputParameter: 'energy',
|
|
55
71
|
};
|
|
72
|
+
const parametersMetadata = {inputs: {}, outputs: {}};
|
|
73
|
+
const = mapping {
|
|
74
|
+
'cpu/energy': 'energy-from-cpu',
|
|
75
|
+
'network/energy': 'energy-from-network',
|
|
76
|
+
};
|
|
56
77
|
|
|
57
|
-
const sum = Sum(config, parametersMetadata);
|
|
58
|
-
const result = sum.execute([
|
|
78
|
+
const sum = Sum(config, parametersMetadata, mapping);
|
|
79
|
+
const result = await sum.execute([
|
|
59
80
|
{
|
|
60
81
|
timestamp: '2021-01-01T00:00:00Z',
|
|
61
82
|
duration: 3600,
|
|
@@ -78,7 +99,7 @@ initialize:
|
|
|
78
99
|
sum:
|
|
79
100
|
method: Sum
|
|
80
101
|
path: 'builtin'
|
|
81
|
-
|
|
102
|
+
config:
|
|
82
103
|
input-parameters: ['cpu/energy', 'network/energy']
|
|
83
104
|
output-parameter: 'energy'
|
|
84
105
|
parameter-metadata:
|
|
@@ -86,16 +107,28 @@ initialize:
|
|
|
86
107
|
cpu/energy:
|
|
87
108
|
description: energy consumed by the cpu
|
|
88
109
|
unit: kWh
|
|
89
|
-
aggregation-method:
|
|
110
|
+
aggregation-method:
|
|
111
|
+
time: sum
|
|
112
|
+
component: sum
|
|
113
|
+
aggregation-method:
|
|
114
|
+
time: sum
|
|
115
|
+
component: sum
|
|
90
116
|
network/energy:
|
|
91
117
|
description: energy consumed by data ingress and egress
|
|
92
118
|
unit: kWh
|
|
93
|
-
aggregation-method:
|
|
119
|
+
aggregation-method:
|
|
120
|
+
time: sum
|
|
121
|
+
component: sum
|
|
122
|
+
aggregation-method:
|
|
123
|
+
time: sum
|
|
124
|
+
component: sum
|
|
94
125
|
outputs:
|
|
95
126
|
energy:
|
|
96
127
|
description: sum of energy components
|
|
97
128
|
unit: kWh
|
|
98
|
-
aggregation-method:
|
|
129
|
+
aggregation-method:
|
|
130
|
+
time: sum
|
|
131
|
+
component: sum
|
|
99
132
|
tree:
|
|
100
133
|
children:
|
|
101
134
|
child:
|
|
@@ -121,9 +154,9 @@ The results will be saved to a new `yaml` file in `./examples/outputs`.
|
|
|
121
154
|
|
|
122
155
|
`Sum` exposes two of the IF error classes.
|
|
123
156
|
|
|
124
|
-
###
|
|
157
|
+
### ConfigError
|
|
125
158
|
|
|
126
|
-
You will receive an error starting `
|
|
159
|
+
You will receive an error starting `ConfigError: ` if you have not provided the expected configuration data in the plugin's `initialize` block.
|
|
127
160
|
|
|
128
161
|
The required parameters are:
|
|
129
162
|
|
|
@@ -10,7 +10,7 @@ For example, you could add `energy-per-year`, the time unit `year`, and the new
|
|
|
10
10
|
|
|
11
11
|
### Plugin config
|
|
12
12
|
|
|
13
|
-
These parameters are required in
|
|
13
|
+
These parameters are required in config:
|
|
14
14
|
|
|
15
15
|
- `input-parameter`: a string that should match an existing key in the `inputs` array
|
|
16
16
|
- `original-time-unit`: a string that defines the time unit of the `input-parameter`. The original time unit should be a valid unit, like `year`, `month`, `day`, `hour` and so on
|
|
@@ -21,13 +21,13 @@ These parameters are required in global config:
|
|
|
21
21
|
|
|
22
22
|
The `parameter-metadata` section contains information about `description` and `unit` of the parameters of the inputs and outputs
|
|
23
23
|
|
|
24
|
-
- `inputs`: describe parameters of the `input-parameter` of the
|
|
24
|
+
- `inputs`: describe parameters of the `input-parameter` of the config. Each parameter has:
|
|
25
25
|
|
|
26
26
|
- `description`: description of the parameter
|
|
27
27
|
- `unit`: unit of the parameter
|
|
28
28
|
- `aggregation-method`: the aggregation method of the parameter (can be `sum`, `avg` or `none`)
|
|
29
29
|
|
|
30
|
-
- `outputs`: describe the parameter of the `output-parameter` of the
|
|
30
|
+
- `outputs`: describe the parameter of the `output-parameter` of the config. The parameter has the following attributes:
|
|
31
31
|
- `description`: description of the parameter
|
|
32
32
|
- `unit`: unit of the parameter
|
|
33
33
|
- `aggregation-method`: the aggregation method of the parameter (can be `sum`, `avg` or `none`)
|
|
@@ -38,7 +38,7 @@ The `input-parameter` must be available in the input array.
|
|
|
38
38
|
|
|
39
39
|
## Returns
|
|
40
40
|
|
|
41
|
-
- `output-parameter`: the converted energy of the `input-parameter` with the parameter name defined by `output-parameter` in
|
|
41
|
+
- `output-parameter`: the converted energy of the `input-parameter` with the parameter name defined by `output-parameter` in config.
|
|
42
42
|
|
|
43
43
|
## Calculation
|
|
44
44
|
|
|
@@ -59,7 +59,7 @@ const config = {
|
|
|
59
59
|
};
|
|
60
60
|
|
|
61
61
|
const timeConverter = TimeConverter(config, parametersMetadata);
|
|
62
|
-
const result = timeConverter.execute([
|
|
62
|
+
const result = await timeConverter.execute([
|
|
63
63
|
{
|
|
64
64
|
timestamp: '2021-01-01T00:00:00Z',
|
|
65
65
|
duration: 3600,
|
|
@@ -81,7 +81,7 @@ initialize:
|
|
|
81
81
|
time-converter:
|
|
82
82
|
method: TimeConverter
|
|
83
83
|
path: builtin
|
|
84
|
-
|
|
84
|
+
config:
|
|
85
85
|
input-parameter: 'energy-per-year'
|
|
86
86
|
original-time-unit: 'year'
|
|
87
87
|
new-time-unit: 'duration'
|
|
@@ -111,9 +111,9 @@ The results will be saved to a new `yaml` file in `./examples/outputs`.
|
|
|
111
111
|
|
|
112
112
|
`TimeConverter` exposes two of the IF error classes.
|
|
113
113
|
|
|
114
|
-
###
|
|
114
|
+
### ConfigError
|
|
115
115
|
|
|
116
|
-
You will receive an error starting `
|
|
116
|
+
You will receive an error starting `ConfigError: ` if you have not provided the expected configuration data in the plugin's `initialize` block.
|
|
117
117
|
|
|
118
118
|
The required parameters are:
|
|
119
119
|
|