@grnsft/if 0.6.0-beta.0 → 0.7.0-beta.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 +24 -0
- 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 +7 -5
- 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 +136 -0
- 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 -8
- package/build/common/config/strings.js +0 -16
- 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 -12
- package/build/if-check/config/strings.js +0 -16
- 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 -37
- 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 -4
- package/build/if-csv/config/strings.js +0 -8
- 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 -51
- 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-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 -15
- package/build/if-run/builtins/index.js +0 -34
- 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/config.d.ts +0 -1
- package/build/if-run/builtins/sci/config.js +0 -44
- 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-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 -136
- 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
|
@@ -8,7 +8,7 @@ initialize:
|
|
|
8
8
|
sum-zero-and-one:
|
|
9
9
|
path: builtin
|
|
10
10
|
method: Sum
|
|
11
|
-
|
|
11
|
+
config:
|
|
12
12
|
input-parameters:
|
|
13
13
|
- some-value
|
|
14
14
|
- zero-value
|
|
@@ -16,7 +16,7 @@ initialize:
|
|
|
16
16
|
sum-zero-and-zero:
|
|
17
17
|
path: builtin
|
|
18
18
|
method: Sum
|
|
19
|
-
|
|
19
|
+
config:
|
|
20
20
|
input-parameters:
|
|
21
21
|
- zero-value
|
|
22
22
|
- zero-value
|
|
@@ -24,7 +24,7 @@ initialize:
|
|
|
24
24
|
subtract-one-and-zero:
|
|
25
25
|
path: builtin
|
|
26
26
|
method: Subtract
|
|
27
|
-
|
|
27
|
+
config:
|
|
28
28
|
input-parameters:
|
|
29
29
|
- some-value
|
|
30
30
|
- zero-value
|
|
@@ -32,7 +32,7 @@ initialize:
|
|
|
32
32
|
subtract-zero-and-zero:
|
|
33
33
|
path: builtin
|
|
34
34
|
method: Sum
|
|
35
|
-
|
|
35
|
+
config:
|
|
36
36
|
input-parameters:
|
|
37
37
|
- zero-value
|
|
38
38
|
- zero-value
|
|
@@ -40,7 +40,7 @@ initialize:
|
|
|
40
40
|
subtract-zero-and-one:
|
|
41
41
|
path: builtin
|
|
42
42
|
method: Subtract
|
|
43
|
-
|
|
43
|
+
config:
|
|
44
44
|
input-parameters:
|
|
45
45
|
- zero-value
|
|
46
46
|
- some-value
|
|
@@ -48,28 +48,28 @@ initialize:
|
|
|
48
48
|
coefficient-one-times-zero:
|
|
49
49
|
path: builtin
|
|
50
50
|
method: Coefficient
|
|
51
|
-
|
|
51
|
+
config:
|
|
52
52
|
input-parameter: zero-value
|
|
53
53
|
coefficient: 1
|
|
54
54
|
output-parameter: zero-times-one-coefficient
|
|
55
55
|
coefficient-zero-times-one:
|
|
56
56
|
path: builtin
|
|
57
57
|
method: Coefficient
|
|
58
|
-
|
|
58
|
+
config:
|
|
59
59
|
input-parameter: some-value
|
|
60
60
|
coefficient: 0
|
|
61
61
|
output-parameter: one-times-zero-coefficient
|
|
62
62
|
coefficient-zero-times-zero:
|
|
63
63
|
path: builtin
|
|
64
64
|
method: Coefficient
|
|
65
|
-
|
|
65
|
+
config:
|
|
66
66
|
input-parameter: zero-value
|
|
67
67
|
coefficient: 0
|
|
68
68
|
output-parameter: zero-times-zero-coefficient
|
|
69
69
|
multiply-one-times-zero:
|
|
70
70
|
path: builtin
|
|
71
71
|
method: Multiply
|
|
72
|
-
|
|
72
|
+
config:
|
|
73
73
|
input-parameters:
|
|
74
74
|
- some-value
|
|
75
75
|
- zero-value
|
|
@@ -77,7 +77,7 @@ initialize:
|
|
|
77
77
|
multiply-zero-times-one:
|
|
78
78
|
path: builtin
|
|
79
79
|
method: Multiply
|
|
80
|
-
|
|
80
|
+
config:
|
|
81
81
|
input-parameters:
|
|
82
82
|
- zero-value
|
|
83
83
|
- zero-value
|
|
@@ -85,28 +85,28 @@ initialize:
|
|
|
85
85
|
exponent-one-to-zero:
|
|
86
86
|
path: builtin
|
|
87
87
|
method: Exponent
|
|
88
|
-
|
|
88
|
+
config:
|
|
89
89
|
input-parameter: some-value
|
|
90
90
|
exponent: 0
|
|
91
91
|
output-parameter: one-raised-to-zero-power
|
|
92
92
|
exponent-zero-to-zero:
|
|
93
93
|
path: builtin
|
|
94
94
|
method: Exponent
|
|
95
|
-
|
|
95
|
+
config:
|
|
96
96
|
input-parameter: zero-value
|
|
97
97
|
exponent: 0
|
|
98
98
|
output-parameter: zero-raised-to-zero-power
|
|
99
99
|
exponent-zero-to-one:
|
|
100
100
|
path: builtin
|
|
101
101
|
method: Exponent
|
|
102
|
-
|
|
102
|
+
config:
|
|
103
103
|
input-parameter: zero-value
|
|
104
104
|
exponent: 1
|
|
105
105
|
output-parameter: zero-raised-to-first-power
|
|
106
106
|
sci:
|
|
107
107
|
path: builtin
|
|
108
108
|
method: Sci
|
|
109
|
-
|
|
109
|
+
config:
|
|
110
110
|
functional-unit: zero-value
|
|
111
111
|
execution:
|
|
112
112
|
command: >-
|
|
@@ -116,20 +116,20 @@ execution:
|
|
|
116
116
|
environment:
|
|
117
117
|
if-version: 0.5.0
|
|
118
118
|
os: macOS
|
|
119
|
-
os-version:
|
|
119
|
+
os-version: "14.5"
|
|
120
120
|
node-version: 18.14.2
|
|
121
121
|
date-time: 2024-07-19T06:36:00.790Z (UTC)
|
|
122
122
|
dependencies:
|
|
123
|
-
-
|
|
124
|
-
-
|
|
125
|
-
-
|
|
126
|
-
-
|
|
127
|
-
-
|
|
128
|
-
-
|
|
129
|
-
-
|
|
130
|
-
-
|
|
131
|
-
-
|
|
132
|
-
-
|
|
123
|
+
- "@babel/core@7.22.10"
|
|
124
|
+
- "@babel/preset-typescript@7.23.3"
|
|
125
|
+
- "@commitlint/cli@18.6.0"
|
|
126
|
+
- "@commitlint/config-conventional@18.6.0"
|
|
127
|
+
- "@grnsft/if-core@0.0.10"
|
|
128
|
+
- "@jest/globals@29.7.0"
|
|
129
|
+
- "@types/jest@29.5.8"
|
|
130
|
+
- "@types/js-yaml@4.0.9"
|
|
131
|
+
- "@types/luxon@3.4.2"
|
|
132
|
+
- "@types/node@20.9.0"
|
|
133
133
|
- axios-mock-adapter@1.22.0
|
|
134
134
|
- axios@1.7.2
|
|
135
135
|
- cross-env@7.0.3
|
|
@@ -171,13 +171,13 @@ tree:
|
|
|
171
171
|
- exponent-zero-to-zero
|
|
172
172
|
- sci
|
|
173
173
|
inputs:
|
|
174
|
-
- timestamp:
|
|
174
|
+
- timestamp: "2023-12-12T00:00:00.000Z"
|
|
175
175
|
duration: 1
|
|
176
176
|
some-value: 1
|
|
177
177
|
zero-value: 0
|
|
178
178
|
carbon: 10
|
|
179
179
|
outputs:
|
|
180
|
-
- timestamp:
|
|
180
|
+
- timestamp: "2023-12-12T00:00:00.000Z"
|
|
181
181
|
duration: 1
|
|
182
182
|
some-value: 1
|
|
183
183
|
zero-value: 0
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grnsft/if",
|
|
3
3
|
"description": "Impact Framework",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.7.0-beta.0",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Green Software Foundation",
|
|
7
7
|
"email": "info@gsf.com"
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"if-run": "./build/if-run/index.js",
|
|
12
12
|
"if-env": "./build/if-env/index.js",
|
|
13
13
|
"if-check": "./build/if-check/index.js",
|
|
14
|
-
"if-csv": "./build/if-csv/index.js"
|
|
14
|
+
"if-csv": "./build/if-csv/index.js",
|
|
15
|
+
"if-merge": "./build/if-merge/index.js"
|
|
15
16
|
},
|
|
16
17
|
"bugs": {
|
|
17
18
|
"url": "https://github.com/Green-Software-Foundation/if/issues/new?assignees=&labels=feedback&projects=&template=feedback.md&title=Feedback+-+"
|
|
@@ -19,7 +20,7 @@
|
|
|
19
20
|
"dependencies": {
|
|
20
21
|
"@commitlint/cli": "^18.6.0",
|
|
21
22
|
"@commitlint/config-conventional": "^18.6.0",
|
|
22
|
-
"@grnsft/if-core": "^0.0.
|
|
23
|
+
"@grnsft/if-core": "^0.0.25",
|
|
23
24
|
"axios": "^1.7.2",
|
|
24
25
|
"csv-parse": "^5.5.6",
|
|
25
26
|
"csv-stringify": "^6.4.6",
|
|
@@ -57,11 +58,12 @@
|
|
|
57
58
|
"homepage": "https://greensoftware.foundation",
|
|
58
59
|
"keywords": [
|
|
59
60
|
"engine",
|
|
61
|
+
"framework",
|
|
60
62
|
"green software foundation",
|
|
61
63
|
"greensoftware",
|
|
62
64
|
"if",
|
|
63
65
|
"impact",
|
|
64
|
-
"
|
|
66
|
+
"plugins"
|
|
65
67
|
],
|
|
66
68
|
"license": "MIT",
|
|
67
69
|
"publishConfig": {
|
|
@@ -80,11 +82,11 @@
|
|
|
80
82
|
"if-csv": "cross-env CURRENT_DIR=$(node -p \"process.env.INIT_CWD\") npx ts-node src/if-csv/index.ts",
|
|
81
83
|
"if-diff": "npx ts-node src/if-diff/index.ts",
|
|
82
84
|
"if-env": "cross-env CURRENT_DIR=$(node -p \"process.env.INIT_CWD\") npx ts-node src/if-env/index.ts",
|
|
85
|
+
"if-merge": "cross-env CURRENT_DIR=$(node -p \"process.env.INIT_CWD\") npx ts-node src/if-merge/index.ts",
|
|
83
86
|
"if-run": "npx ts-node src/if-run/index.ts",
|
|
84
87
|
"lint": "gts lint",
|
|
85
88
|
"pre-commit": "lint-staged",
|
|
86
89
|
"prepare": "husky install",
|
|
87
|
-
"prepublish": "npm run build",
|
|
88
90
|
"release": "release-it",
|
|
89
91
|
"test": "jest --verbose --testPathPattern=src/__tests__/"
|
|
90
92
|
},
|
|
@@ -6,7 +6,7 @@ initialize:
|
|
|
6
6
|
memory-energy-from-memory-util:
|
|
7
7
|
path: builtin
|
|
8
8
|
method: Coefficient
|
|
9
|
-
|
|
9
|
+
config:
|
|
10
10
|
input-parameter: memory/utilization
|
|
11
11
|
coefficient: 0.0001
|
|
12
12
|
output-parameter: memory/energy
|
|
@@ -59,7 +59,6 @@ tree:
|
|
|
59
59
|
pipeline:
|
|
60
60
|
compute:
|
|
61
61
|
- memory-energy-from-memory-util
|
|
62
|
-
config: null
|
|
63
62
|
inputs:
|
|
64
63
|
- timestamp: 2023-12-12T00:00:00.000Z
|
|
65
64
|
duration: 3600
|
|
@@ -6,7 +6,7 @@ initialize:
|
|
|
6
6
|
memory-energy-from-memory-util: # you can name this any way you like!
|
|
7
7
|
method: Coefficient # the name of the function exported from the plugin
|
|
8
8
|
path: "builtin" # the import path
|
|
9
|
-
|
|
9
|
+
config: # any config required by the plugin
|
|
10
10
|
input-parameter: "memory/utilization"
|
|
11
11
|
coefficient: 0.0001 #kwH/GB
|
|
12
12
|
output-parameter: "memory/energy"
|
|
@@ -16,7 +16,6 @@ tree:
|
|
|
16
16
|
pipeline: # the pipeline is an ordered list of plugins you want to execute
|
|
17
17
|
compute:
|
|
18
18
|
- memory-energy-from-memory-util # must match the name in initialize!
|
|
19
|
-
config: # any plugin specific, node-level config
|
|
20
19
|
inputs:
|
|
21
20
|
- timestamp: 2023-12-12T00:00:00.000Z # ISO 8061 string
|
|
22
21
|
duration: 3600 # units of seconds
|
|
@@ -8,9 +8,9 @@ For example, you could multiply `cpu/energy` by 10 and name the result `energy-p
|
|
|
8
8
|
|
|
9
9
|
## Parameters
|
|
10
10
|
|
|
11
|
-
### Plugin
|
|
11
|
+
### Plugin config
|
|
12
12
|
|
|
13
|
-
Three parameters are required in
|
|
13
|
+
Three parameters are required in config: `input-parameter`, `coefficient` and `output-parameter`.
|
|
14
14
|
|
|
15
15
|
- `input-parameter`: a string matching an existing key in the `inputs` array
|
|
16
16
|
- `coefficient`: the value to multiply `input-parameter` by.
|
|
@@ -21,16 +21,32 @@ Three parameters are required in global config: `input-parameter`, `coefficient`
|
|
|
21
21
|
The `parameter-metadata` section contains information about `description`, `unit` and `aggregation-method`
|
|
22
22
|
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
|
-
- `aggregation-method`: aggregation method of the parameter
|
|
28
|
+
- `aggregation-method`: aggregation method object of the parameter
|
|
29
|
+
- `time`: this value is used for `horizontal` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
|
|
30
|
+
- `component`: this value is used for `vertical` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
|
|
29
31
|
|
|
30
|
-
- `outputs`: describe parameters of the `output-parameter` of the
|
|
32
|
+
- `outputs`: describe parameters of the `output-parameter` of the config. Each parameter has:
|
|
31
33
|
- `description`: description of the parameter
|
|
32
34
|
- `unit`: unit of the parameter
|
|
33
|
-
- `aggregation-method`: aggregation method of the parameter
|
|
35
|
+
- `aggregation-method`: aggregation method object of the parameter
|
|
36
|
+
- `time`: this value is used for `horizontal` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
|
|
37
|
+
- `component`: this value is used for `vertical` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
|
|
38
|
+
|
|
39
|
+
### Mapping
|
|
40
|
+
|
|
41
|
+
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:
|
|
42
|
+
|
|
43
|
+
```yaml
|
|
44
|
+
coefficient:
|
|
45
|
+
method: Coefficient
|
|
46
|
+
path: 'builtin'
|
|
47
|
+
mapping:
|
|
48
|
+
'parameter-name-in-the-plugin': 'parameter-name-in-the-input'
|
|
49
|
+
```
|
|
34
50
|
|
|
35
51
|
### Inputs
|
|
36
52
|
|
|
@@ -38,7 +54,7 @@ All of `input-parameters` must be available in the input array.
|
|
|
38
54
|
|
|
39
55
|
## Returns
|
|
40
56
|
|
|
41
|
-
- `output-parameter`: the product of all `input-parameters` with the parameter name defined by `output-parameter` in
|
|
57
|
+
- `output-parameter`: the product of all `input-parameters` with the parameter name defined by `output-parameter` in config.
|
|
42
58
|
|
|
43
59
|
## Calculation
|
|
44
60
|
|
|
@@ -56,9 +72,11 @@ const config = {
|
|
|
56
72
|
coefficient: 10,
|
|
57
73
|
'output-parameter': 'carbon-product',
|
|
58
74
|
};
|
|
75
|
+
const parametersMetadata = {inputs: {}, outputs: {}};
|
|
76
|
+
const mapping = {};
|
|
59
77
|
|
|
60
|
-
const coeff = Coefficient(config);
|
|
61
|
-
const result = coeff.execute([
|
|
78
|
+
const coeff = Coefficient(config, parametersMetadata, mapping);
|
|
79
|
+
const result = await coeff.execute([
|
|
62
80
|
{
|
|
63
81
|
duration: 3600,
|
|
64
82
|
timestamp: '2021-01-01T00:00:00Z',
|
|
@@ -80,19 +98,25 @@ initialize:
|
|
|
80
98
|
coefficient:
|
|
81
99
|
method: Coefficient
|
|
82
100
|
path: 'builtin'
|
|
83
|
-
|
|
101
|
+
config:
|
|
84
102
|
input-parameter: 'carbon'
|
|
85
103
|
coefficient: 3
|
|
86
104
|
output-parameter: 'carbon-product'
|
|
87
|
-
|
|
105
|
+
parameter-metadata:
|
|
88
106
|
inputs:
|
|
89
107
|
carbon:
|
|
90
|
-
description:
|
|
91
|
-
unit:
|
|
108
|
+
description: 'an amount of carbon emitted into the atmosphere'
|
|
109
|
+
unit: 'gCO2e'
|
|
110
|
+
aggregation-method:
|
|
111
|
+
time: sum
|
|
112
|
+
component: sum
|
|
92
113
|
outputs:
|
|
93
114
|
carbon-product:
|
|
94
|
-
description:
|
|
95
|
-
unit:
|
|
115
|
+
description: 'a product of cabon property and the coefficient'
|
|
116
|
+
unit: 'gCO2e'
|
|
117
|
+
aggregation-method:
|
|
118
|
+
time: sum
|
|
119
|
+
component: sum
|
|
96
120
|
tree:
|
|
97
121
|
children:
|
|
98
122
|
child:
|
|
@@ -117,9 +141,9 @@ The results will be saved to a new `yaml` file in `./examples/outputs`
|
|
|
117
141
|
|
|
118
142
|
`Coefficient` exposes one of the IF error classes.
|
|
119
143
|
|
|
120
|
-
###
|
|
144
|
+
### ConfigError
|
|
121
145
|
|
|
122
|
-
You will receive an error starting `
|
|
146
|
+
You will receive an error starting `ConfigError: ` if you have not provided the expected configuration data in the plugin's `initialize` block.
|
|
123
147
|
|
|
124
148
|
The required parameters are:
|
|
125
149
|
|
|
@@ -43,16 +43,32 @@ Three parameters are required in config: `from` and `to` and `keep-existing`.
|
|
|
43
43
|
|
|
44
44
|
The `parameter-metadata` section contains information about `description`, `unit` and `aggregation-method` of the parameters of the inputs and outputs
|
|
45
45
|
|
|
46
|
-
- `inputs`: describe the parameter of the `from` of the
|
|
46
|
+
- `inputs`: describe the parameter of the `from` of the config. The parameter has the following attributes:
|
|
47
47
|
|
|
48
48
|
- `description`: description of the parameter
|
|
49
49
|
- `unit`: unit of the parameter
|
|
50
|
-
- `aggregation-method`: aggregation method of the parameter
|
|
50
|
+
- `aggregation-method`: aggregation method object of the parameter
|
|
51
|
+
- `time`: this value is used for `horizontal` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
|
|
52
|
+
- `component`: this value is used for `vertical` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
|
|
51
53
|
|
|
52
|
-
- `outputs`: describe the parameters of the `to` of the
|
|
54
|
+
- `outputs`: describe the parameters of the `to` of the config. The parameter has the following attributes:
|
|
53
55
|
- `description`: description of the parameter
|
|
54
56
|
- `unit`: unit of the parameter
|
|
55
|
-
- `aggregation-method`: aggregation method of the parameter
|
|
57
|
+
- `aggregation-method`: aggregation method object of the parameter
|
|
58
|
+
- `time`: this value is used for `horizontal` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
|
|
59
|
+
- `component`: this value is used for `vertical` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
|
|
60
|
+
|
|
61
|
+
### Mapping
|
|
62
|
+
|
|
63
|
+
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:
|
|
64
|
+
|
|
65
|
+
```yaml
|
|
66
|
+
copy-param:
|
|
67
|
+
path: builtin
|
|
68
|
+
method: Copy
|
|
69
|
+
mapping:
|
|
70
|
+
'parameter-name-in-the-plugin': 'parameter-name-in-the-input'
|
|
71
|
+
```
|
|
56
72
|
|
|
57
73
|
### Inputs
|
|
58
74
|
|
|
@@ -69,13 +85,17 @@ To run the plugin, you must first create an instance of `Copy`. Then, you can ca
|
|
|
69
85
|
```typescript
|
|
70
86
|
import {Copy} from '.';
|
|
71
87
|
|
|
72
|
-
const
|
|
88
|
+
const config = {
|
|
73
89
|
'keep-existing': true,
|
|
74
90
|
from: 'from-param',
|
|
75
91
|
to: 'to-param',
|
|
76
|
-
}
|
|
92
|
+
};
|
|
93
|
+
const parametersMetadata = {inputs: {}, outputs: {}};
|
|
94
|
+
const mapping = {};
|
|
95
|
+
|
|
96
|
+
const plugin = Copy(config, parametersMetadata, mapping);
|
|
77
97
|
|
|
78
|
-
const result = plugin.execute([
|
|
98
|
+
const result = await plugin.execute([
|
|
79
99
|
{
|
|
80
100
|
timestamp: '2023-12-12T00:00:13.000Z',
|
|
81
101
|
duration: 30,
|
|
@@ -99,7 +119,7 @@ initialize:
|
|
|
99
119
|
copy-param:
|
|
100
120
|
path: builtin
|
|
101
121
|
method: Copy
|
|
102
|
-
|
|
122
|
+
config:
|
|
103
123
|
keep-existing: true
|
|
104
124
|
from: original
|
|
105
125
|
to: copy
|
|
@@ -61,12 +61,28 @@ The `parameter-metadata` section contains information about `description`, `unit
|
|
|
61
61
|
|
|
62
62
|
- `description`: description of the parameter
|
|
63
63
|
- `unit`: unit of the parameter
|
|
64
|
-
- `aggregation-method`: aggregation method of the parameter
|
|
64
|
+
- `aggregation-method`: aggregation method object of the parameter
|
|
65
|
+
- `time`: this value is used for `horizontal` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
|
|
66
|
+
- `component`: this value is used for `vertical` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
|
|
65
67
|
|
|
66
68
|
- `outputs`: describe the parameters in the `output` of the config block. The parameter has the following attributes:
|
|
67
69
|
- `description`: description of the parameter
|
|
68
70
|
- `unit`: unit of the parameter
|
|
69
|
-
- `aggregation-method`: aggregation method of the parameter
|
|
71
|
+
- `aggregation-method`: aggregation method object of the parameter
|
|
72
|
+
- `time`: this value is used for `horizontal` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
|
|
73
|
+
- `component`: this value is used for `vertical` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
|
|
74
|
+
|
|
75
|
+
### Mapping
|
|
76
|
+
|
|
77
|
+
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:
|
|
78
|
+
|
|
79
|
+
```yaml
|
|
80
|
+
cloud-metadata:
|
|
81
|
+
method: CSVLookup
|
|
82
|
+
path: 'builtin'
|
|
83
|
+
mapping:
|
|
84
|
+
'parameter-name-in-the-plugin': 'parameter-name-in-the-input'
|
|
85
|
+
```
|
|
70
86
|
|
|
71
87
|
### Inputs
|
|
72
88
|
|
|
@@ -78,7 +94,7 @@ The input data with the requested csv content appended to it.
|
|
|
78
94
|
|
|
79
95
|
## Plugin logic
|
|
80
96
|
|
|
81
|
-
1. Validates
|
|
97
|
+
1. Validates config which contains `filepath`, `query` and `output`.
|
|
82
98
|
2. Tries to retrieve given file (with url or local path).
|
|
83
99
|
3. Parses given CSV.
|
|
84
100
|
4. Filters requested information from CSV.
|
|
@@ -90,7 +106,7 @@ The input data with the requested csv content appended to it.
|
|
|
90
106
|
To run the plugin, you must first create an instance of `CSVLookup`. Then, you can call `execute()`.
|
|
91
107
|
|
|
92
108
|
```typescript
|
|
93
|
-
const
|
|
109
|
+
const config = {
|
|
94
110
|
filepath: 'https://raw.githubusercontent.com/Green-Software-Foundation/if-data/main/cloud-metdata-aws-instances.csv',
|
|
95
111
|
query: {
|
|
96
112
|
'cloud-provider': 'cloud/provider'
|
|
@@ -99,9 +115,11 @@ const globalConfig = {
|
|
|
99
115
|
},
|
|
100
116
|
output: ['cpu-tdp', 'tdp'],
|
|
101
117
|
};
|
|
102
|
-
const
|
|
118
|
+
const parametersMetadata = {inputs: {}, outputs: {}};
|
|
119
|
+
const mapping = {};
|
|
120
|
+
const csvLookup = CSVLookup(config, parametersMetadata, mapping);
|
|
103
121
|
|
|
104
|
-
const
|
|
122
|
+
const result = await csvLookup.execute([
|
|
105
123
|
{
|
|
106
124
|
timestamp: '2023-08-06T00:00'
|
|
107
125
|
duration: 3600
|
|
@@ -109,7 +127,7 @@ const input = [
|
|
|
109
127
|
'cloud/provider': gcp
|
|
110
128
|
'cloud/region': asia-east
|
|
111
129
|
},
|
|
112
|
-
];
|
|
130
|
+
]);
|
|
113
131
|
```
|
|
114
132
|
|
|
115
133
|
## Example manifest
|
|
@@ -125,12 +143,14 @@ initialize:
|
|
|
125
143
|
cloud-metadata:
|
|
126
144
|
method: CSVLookup
|
|
127
145
|
path: 'builtin'
|
|
128
|
-
|
|
146
|
+
config:
|
|
129
147
|
filepath: https://raw.githubusercontent.com/Green-Software-Foundation/if-data/main/region-metadata.csv
|
|
130
148
|
query:
|
|
131
149
|
cloud-provider: 'cloud/provider'
|
|
132
150
|
cloud-region: 'cloud/region'
|
|
133
151
|
output: '*'
|
|
152
|
+
mapping:
|
|
153
|
+
cloud/region: cloud/area
|
|
134
154
|
tree:
|
|
135
155
|
children:
|
|
136
156
|
child:
|
|
@@ -141,7 +161,7 @@ tree:
|
|
|
141
161
|
- timestamp: 2023-08-06T00:00
|
|
142
162
|
duration: 3600
|
|
143
163
|
cloud/provider: Google Cloud
|
|
144
|
-
cloud/
|
|
164
|
+
cloud/area: europe-north1
|
|
145
165
|
```
|
|
146
166
|
|
|
147
167
|
You can run this example by saving it as `./examples/manifests/csv-lookup.yml` and executing the following command from the project root:
|
|
@@ -177,9 +197,9 @@ This error is caused by the `CsvLookup` plugin failing to find data that matches
|
|
|
177
197
|
|
|
178
198
|
This error arises due to problems parsing CSV data into IF. This can occur when the CSV data is incorrectly formatted or contains unexpected characters that IF does not recognize. These errors are expected to be unusual edge cases as incorrectly formatted data will usually be identified during file loading and cause a `ReadFileError`. To debug, check your CSV file for any unexpected formatting or unusual characters.
|
|
179
199
|
|
|
180
|
-
###
|
|
200
|
+
### ConfigError
|
|
181
201
|
|
|
182
|
-
You will receive an error starting `
|
|
202
|
+
You will receive an error starting `ConfigError: ` if you have not provided the expected configuration data in the plugin's `initialize` block.
|
|
183
203
|
|
|
184
204
|
The required parameters are:
|
|
185
205
|
|
|
@@ -16,16 +16,32 @@ You provide the names of the values you want to divide, and a name to use to add
|
|
|
16
16
|
|
|
17
17
|
The `parameter-metadata` section contains information about `description`, `unit` and `aggregation-method` of the parameters of the inputs and outputs
|
|
18
18
|
|
|
19
|
-
- `inputs`: describe the parameter of the `numerator` of the
|
|
19
|
+
- `inputs`: describe the parameter of the `numerator` of the config. The parameter has the following attributes:
|
|
20
20
|
|
|
21
21
|
- `description`: description of the parameter
|
|
22
22
|
- `unit`: unit of the parameter
|
|
23
|
-
- `aggregation-method`: aggregation method of the parameter
|
|
23
|
+
- `aggregation-method`: aggregation method object of the parameter
|
|
24
|
+
- `time`: this value is used for `horizontal` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
|
|
25
|
+
- `component`: this value is used for `vertical` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
|
|
24
26
|
|
|
25
27
|
- `outputs`: describe the parameter of the `denominator` of the global config. The parameter has the following attributes:
|
|
26
28
|
- `description`: description of the parameter
|
|
27
29
|
- `unit`: unit of the parameter
|
|
28
|
-
- `aggregation-method`: aggregation method of the parameter
|
|
30
|
+
- `aggregation-method`: aggregation method object of the parameter
|
|
31
|
+
- `time`: this value is used for `horizontal` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
|
|
32
|
+
- `component`: this value is used for `vertical` aggregation. It can be of the following values: `sum`, `avg`, `copy`, or `none`.
|
|
33
|
+
|
|
34
|
+
### Mapping
|
|
35
|
+
|
|
36
|
+
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
|
+
|
|
38
|
+
```yaml
|
|
39
|
+
divide:
|
|
40
|
+
method: Divide
|
|
41
|
+
path: 'builtin'
|
|
42
|
+
mapping:
|
|
43
|
+
'parameter-name-in-the-plugin': 'parameter-name-in-the-input'
|
|
44
|
+
```
|
|
29
45
|
|
|
30
46
|
### Inputs
|
|
31
47
|
|
|
@@ -35,7 +51,7 @@ The `parameter-metadata` section contains information about `description`, `unit
|
|
|
35
51
|
|
|
36
52
|
## Returns
|
|
37
53
|
|
|
38
|
-
- `output`: the division of `numerator` with the parameter name into `denominator` with the parameter name defined by `output` in
|
|
54
|
+
- `output`: the division of `numerator` with the parameter name into `denominator` with the parameter name defined by `output` in config.
|
|
39
55
|
|
|
40
56
|
The plugin throws an exception if the division result is not a number.
|
|
41
57
|
|
|
@@ -52,20 +68,24 @@ output = input0 / input1
|
|
|
52
68
|
To run the plugin, you must first create an instance of `Divide`. Then, you can call `execute()`.
|
|
53
69
|
|
|
54
70
|
```typescript
|
|
55
|
-
const
|
|
71
|
+
const config = {
|
|
56
72
|
numerator: 'vcpus-allocated',
|
|
57
73
|
denominator: 2,
|
|
58
74
|
output: 'cpu/number-cores',
|
|
59
75
|
};
|
|
60
|
-
const
|
|
76
|
+
const parametersMetadata = {inputs: {}, outputs: {}};
|
|
77
|
+
const mapping = {
|
|
78
|
+
'vcpus-allocated': 'vcpus-distributed',
|
|
79
|
+
};
|
|
80
|
+
const divide = Divide(config, parametersMetadata, mapping);
|
|
61
81
|
|
|
62
|
-
const
|
|
82
|
+
const result = await divide.execute([
|
|
63
83
|
{
|
|
64
84
|
timestamp: '2021-01-01T00:00:00Z',
|
|
65
85
|
duration: 3600,
|
|
66
86
|
'vcpus-allocated': 24,
|
|
67
87
|
},
|
|
68
|
-
];
|
|
88
|
+
]);
|
|
69
89
|
```
|
|
70
90
|
|
|
71
91
|
## Example manifest
|
|
@@ -81,10 +101,12 @@ initialize:
|
|
|
81
101
|
divide:
|
|
82
102
|
method: Divide
|
|
83
103
|
path: 'builtin'
|
|
84
|
-
|
|
104
|
+
config:
|
|
85
105
|
numerator: vcpus-allocated
|
|
86
106
|
denominator: 2
|
|
87
107
|
output: cpu/number-cores
|
|
108
|
+
mapping:
|
|
109
|
+
vcpus-allocated: vcpus-distributed
|
|
88
110
|
tree:
|
|
89
111
|
children:
|
|
90
112
|
child:
|
|
@@ -94,7 +116,7 @@ tree:
|
|
|
94
116
|
inputs:
|
|
95
117
|
- timestamp: 2023-08-06T00:00
|
|
96
118
|
duration: 3600
|
|
97
|
-
vcpus-
|
|
119
|
+
vcpus-distributed: 24
|
|
98
120
|
```
|
|
99
121
|
|
|
100
122
|
You can run this example by saving it as `./examples/manifests/divide.yml` and executing the following command from the project root:
|
|
@@ -110,9 +132,9 @@ The results will be saved to a new `yaml` file in `./examples/outputs`.
|
|
|
110
132
|
|
|
111
133
|
`Divide` exposes two of IF's error classes.
|
|
112
134
|
|
|
113
|
-
###
|
|
135
|
+
### ConfigError
|
|
114
136
|
|
|
115
|
-
You will receive an error starting `
|
|
137
|
+
You will receive an error starting `ConfigError: ` if you have not provided the expected configuration data in the plugin's `initialize` block.
|
|
116
138
|
|
|
117
139
|
The required parameters are:
|
|
118
140
|
|