@grnsft/if 0.5.0-beta.0 → 0.6.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/README.md +5 -17
- package/Refactor-migration-guide.md +110 -164
- package/build/common/config/index.d.ts +1 -0
- package/build/common/config/index.js +6 -0
- package/build/common/config/strings.d.ts +8 -0
- package/build/common/config/strings.js +16 -0
- package/build/common/lib/load.d.ts +6 -0
- package/build/common/lib/load.js +18 -0
- package/build/{types → common/types}/manifest.d.ts +4 -1
- package/build/common/types/manifest.js +3 -0
- package/build/common/util/debug-logger.js +115 -0
- package/build/common/util/fs.js +94 -0
- package/build/common/util/helpers.d.ts +15 -0
- package/build/common/util/helpers.js +80 -0
- package/build/{util → common/util}/logger.js +1 -1
- package/build/{util → common/util}/validations.d.ts +149 -47
- package/build/common/util/validations.js +141 -0
- package/build/common/util/yaml.js +59 -0
- package/build/if-check/config/config.d.ts +6 -0
- package/build/if-check/config/config.js +31 -0
- package/build/{config → if-check/config}/index.d.ts +0 -1
- package/build/if-check/config/index.js +8 -0
- package/build/if-check/config/strings.d.ts +12 -0
- package/build/if-check/config/strings.js +16 -0
- package/build/if-check/index.js +98 -0
- package/build/if-check/types/process-args.d.ts +4 -0
- package/build/if-check/types/process-args.js +3 -0
- package/build/if-check/util/args.d.ts +10 -0
- package/build/if-check/util/args.js +56 -0
- package/build/if-check/util/helpers.d.ts +4 -0
- package/build/if-check/util/helpers.js +18 -0
- package/build/if-check/util/npm.d.ts +4 -0
- package/build/if-check/util/npm.js +59 -0
- package/build/if-csv/config/config.d.ts +6 -0
- package/build/if-csv/config/config.js +37 -0
- package/build/if-csv/config/index.d.ts +2 -0
- package/build/if-csv/config/index.js +8 -0
- package/build/if-csv/config/strings.d.ts +4 -0
- package/build/if-csv/config/strings.js +8 -0
- package/build/if-csv/index.js +63 -0
- package/build/if-csv/types/csv.d.ts +7 -0
- package/build/if-csv/types/csv.js +3 -0
- package/build/if-csv/types/process-args.d.ts +5 -0
- package/build/if-csv/types/process-args.js +3 -0
- package/build/if-csv/util/args.d.ts +12 -0
- package/build/if-csv/util/args.js +51 -0
- package/build/if-csv/util/helpers.d.ts +9 -0
- package/build/if-csv/util/helpers.js +95 -0
- package/build/if-diff/config/config.d.ts +6 -0
- package/build/if-diff/config/config.js +31 -0
- package/build/if-diff/config/index.d.ts +2 -0
- package/build/if-diff/config/index.js +8 -0
- package/build/if-diff/config/strings.d.ts +6 -0
- package/build/if-diff/config/strings.js +10 -0
- package/build/if-diff/index.js +46 -0
- package/build/{lib → if-diff/lib}/compare.d.ts +1 -1
- package/build/if-diff/lib/compare.js +56 -0
- package/build/{lib → if-diff/lib}/load.d.ts +16 -18
- package/build/if-diff/lib/load.js +51 -0
- package/build/if-diff/types/args.js +3 -0
- package/build/if-diff/types/compare.js +3 -0
- package/build/if-diff/types/process-args.d.ts +4 -0
- package/build/if-diff/types/process-args.js +3 -0
- package/build/if-diff/util/args.d.ts +5 -0
- package/build/if-diff/util/args.js +51 -0
- package/build/if-diff/util/helpers.d.ts +13 -0
- package/build/if-diff/util/helpers.js +75 -0
- package/build/if-env/config/config.d.ts +6 -0
- package/build/if-env/config/config.js +37 -0
- package/build/if-env/config/index.d.ts +2 -0
- package/build/if-env/config/index.js +8 -0
- package/build/if-env/config/strings.d.ts +7 -0
- package/build/if-env/config/strings.js +11 -0
- package/build/if-env/index.js +40 -0
- package/build/if-env/types/if-env.js +3 -0
- package/build/if-env/types/npm.js +3 -0
- package/build/if-env/types/process-args.d.ts +5 -0
- package/build/if-env/types/process-args.js +3 -0
- package/build/if-env/util/args.d.ts +12 -0
- package/build/if-env/util/args.js +47 -0
- package/build/if-env/util/helpers.d.ts +20 -0
- package/build/if-env/util/helpers.js +94 -0
- package/build/{util → if-env/util}/npm.d.ts +0 -4
- package/build/if-env/util/npm.js +126 -0
- package/build/if-run/builtins/coefficient/index.d.ts +2 -0
- package/build/if-run/builtins/coefficient/index.js +67 -0
- package/build/if-run/builtins/copy-param/index.d.ts +2 -0
- package/build/if-run/builtins/copy-param/index.js +70 -0
- package/build/if-run/builtins/csv-lookup/index.d.ts +2 -0
- package/build/if-run/builtins/csv-lookup/index.js +190 -0
- package/build/if-run/builtins/divide/index.d.ts +2 -0
- package/build/if-run/builtins/divide/index.js +80 -0
- package/build/if-run/builtins/exponent/index.d.ts +2 -0
- package/build/if-run/builtins/exponent/index.js +60 -0
- package/build/{builtins → if-run/builtins}/export-log.d.ts +1 -1
- package/build/{builtins → if-run/builtins}/export-log.js +1 -1
- package/build/{builtins → if-run/builtins}/export-yaml.d.ts +1 -1
- package/build/if-run/builtins/export-yaml.js +30 -0
- package/build/{builtins → if-run/builtins}/index.d.ts +1 -2
- package/build/{builtins → if-run/builtins}/index.js +4 -6
- package/build/if-run/builtins/interpolation/index.d.ts +2 -0
- package/build/if-run/builtins/interpolation/index.js +151 -0
- package/build/if-run/builtins/mock-observations/helpers/common-generator.js +29 -0
- package/build/if-run/builtins/mock-observations/helpers/rand-int-generator.js +48 -0
- package/build/if-run/builtins/mock-observations/index.d.ts +2 -0
- package/build/if-run/builtins/mock-observations/index.js +116 -0
- package/build/if-run/builtins/mock-observations/interfaces/index.js +3 -0
- package/build/if-run/builtins/multiply/index.d.ts +2 -0
- package/build/if-run/builtins/multiply/index.js +59 -0
- package/build/if-run/builtins/regex/index.d.ts +2 -0
- package/build/if-run/builtins/regex/index.js +76 -0
- package/build/if-run/builtins/sci/config.js +44 -0
- package/build/if-run/builtins/sci/index.d.ts +2 -0
- package/build/if-run/builtins/sci/index.js +92 -0
- package/build/if-run/builtins/sci-embodied/index.d.ts +2 -0
- package/build/if-run/builtins/sci-embodied/index.js +156 -0
- package/build/if-run/builtins/shell/index.d.ts +2 -0
- package/build/if-run/builtins/shell/index.js +60 -0
- package/build/if-run/builtins/subtract/index.d.ts +2 -0
- package/build/if-run/builtins/subtract/index.js +61 -0
- package/build/if-run/builtins/sum/index.d.ts +2 -0
- package/build/if-run/builtins/sum/index.js +66 -0
- package/build/if-run/builtins/time-sync/index.d.ts +17 -0
- package/build/if-run/builtins/time-sync/index.js +339 -0
- package/build/if-run/config/config.d.ts +9 -0
- package/build/if-run/config/config.js +73 -0
- package/build/if-run/config/index.d.ts +2 -0
- package/build/if-run/config/index.js +8 -0
- package/build/{config → if-run/config}/strings.d.ts +28 -50
- package/build/if-run/config/strings.js +76 -0
- package/build/if-run/index.d.ts +2 -0
- package/build/if-run/index.js +63 -0
- package/build/if-run/lib/aggregate.d.ts +15 -0
- package/build/if-run/lib/aggregate.js +123 -0
- package/build/if-run/lib/compute.js +136 -0
- package/build/{lib → if-run/lib}/environment.d.ts +1 -1
- package/build/if-run/lib/environment.js +75 -0
- package/build/{lib → if-run/lib}/exhaust.d.ts +1 -1
- package/build/if-run/lib/exhaust.js +27 -0
- package/build/if-run/lib/explain.d.ts +9 -0
- package/build/if-run/lib/explain.js +43 -0
- package/build/if-run/lib/initialize.d.ts +6 -0
- package/build/if-run/lib/initialize.js +109 -0
- package/build/if-run/lib/regroup.d.ts +5 -0
- package/build/if-run/lib/regroup.js +64 -0
- package/build/if-run/types/aggregation.d.ts +5 -0
- package/build/if-run/types/aggregation.js +6 -0
- package/build/{types → if-run/types}/compute.d.ts +12 -8
- package/build/if-run/types/compute.js +3 -0
- package/build/if-run/types/environment.js +3 -0
- package/build/{types → if-run/types}/exhaust-plugin-interface.d.ts +1 -1
- package/build/if-run/types/exhaust-plugin-interface.js +3 -0
- package/build/if-run/types/explain.d.ts +10 -0
- package/build/if-run/types/explain.js +3 -0
- package/build/if-run/types/interface.d.ts +3 -0
- package/build/if-run/types/interface.js +6 -0
- package/build/if-run/types/plugin-storage.js +3 -0
- package/build/if-run/types/process-args.d.ts +25 -0
- package/build/if-run/types/process-args.js +3 -0
- package/build/if-run/types/time-sync.js +3 -0
- package/build/{util → if-run/util}/aggregation-helper.d.ts +2 -1
- package/build/if-run/util/aggregation-helper.js +47 -0
- package/build/if-run/util/args.d.ts +9 -0
- package/build/if-run/util/args.js +60 -0
- package/build/if-run/util/helpers.d.ts +14 -0
- package/build/if-run/util/helpers.js +57 -0
- package/build/if-run/util/log-memoize.js +19 -0
- package/build/if-run/util/os-checker.js +97 -0
- package/build/{util → if-run/util}/plugin-storage.d.ts +1 -1
- package/build/if-run/util/plugin-storage.js +34 -0
- package/jest.config.js +2 -6
- package/manifests/{plugins → examples/builtins}/coefficient/failure-invalid-config-input-param.yml +2 -2
- package/manifests/{plugins → examples/builtins}/coefficient/failure-output-param-is-null.yaml +3 -3
- package/manifests/{plugins → examples/builtins}/coefficient/success.yml +2 -2
- package/manifests/{plugins → examples/builtins}/csv-lookup/cloud-metadata/failure-invalid-instance-type.yaml +3 -3
- package/manifests/{plugins → examples/builtins}/csv-lookup/cloud-metadata/failure-invalid-vendor.yaml +3 -3
- package/manifests/{plugins → examples/builtins}/csv-lookup/cloud-metadata/failure-missing-cloud-vendor.yml +3 -3
- package/manifests/{plugins → examples/builtins}/csv-lookup/cloud-metadata/success.yml +3 -3
- package/manifests/{plugins → examples/builtins}/csv-lookup/region-metadata/failure-missing-column.yml +3 -4
- package/manifests/{plugins → examples/builtins}/csv-lookup/region-metadata/failure-missing-output.yml +3 -4
- package/manifests/{plugins → examples/builtins}/csv-lookup/region-metadata/success-renaming.yml +4 -5
- package/manifests/{plugins → examples/builtins}/csv-lookup/region-metadata/success.yml +3 -4
- package/manifests/{plugins → examples/builtins}/csv-lookup/tdp-finder/failure-missing-input-param.yml +2 -2
- package/manifests/{plugins → examples/builtins}/csv-lookup/tdp-finder/failure-unsupported-physical-processor.yml +2 -2
- package/manifests/{plugins → examples/builtins}/csv-lookup/tdp-finder/success.yml +2 -2
- package/manifests/{plugins → examples/builtins}/divide/failure-denominator-equal-zero.yml +4 -4
- package/manifests/{plugins → examples/builtins}/divide/failure-invalid-config-denominator.yml +5 -5
- package/manifests/{plugins → examples/builtins}/divide/failure-missing-numerator.yml +4 -4
- package/manifests/{plugins → examples/builtins}/divide/success.yml +4 -6
- package/manifests/{plugins → examples/builtins}/exponent/success.yml +5 -8
- package/manifests/{plugins → examples/builtins}/interpolation/interpolation.yml +2 -2
- package/manifests/{plugins → examples/builtins}/interpolation/success.yml +2 -2
- package/manifests/{plugins → examples/builtins}/mock-observations/failure-invalid-config-cpu-range.yml +2 -2
- package/manifests/{plugins → examples/builtins}/mock-observations/failure-invalid-memory-utilization-range.yml +2 -2
- package/manifests/{plugins → examples/builtins}/mock-observations/failure-missing-timestamp-from-param.yml +2 -2
- package/manifests/{plugins → examples/builtins}/mock-observations/success.yml +2 -2
- package/manifests/{plugins → examples/builtins}/multiply/failure-input-parameter-is-missing.yml +2 -4
- package/manifests/{plugins → examples/builtins}/multiply/success-with-multiple-inputs.yml +2 -4
- package/manifests/{plugins → examples/builtins}/multiply/success.yml +3 -4
- package/manifests/{plugins → examples/builtins}/regex/failure-missing-input-param.yml +2 -4
- package/manifests/{plugins → examples/builtins}/regex/failure-not-matching-with-regex.yml +2 -4
- package/manifests/{plugins → examples/builtins}/regex/success.yml +2 -4
- package/manifests/{plugins → examples/builtins}/sci/failure-invalid-config-value.yml +2 -2
- package/manifests/{plugins → examples/builtins}/sci/failure-missing-input-param.yml +3 -2
- package/manifests/{plugins → examples/builtins}/sci/success.yml +2 -3
- package/manifests/{plugins → examples/builtins}/sci-embodied/failure-invalid-default-emission-value.yml +3 -3
- package/manifests/{plugins → examples/builtins}/sci-embodied/failure-missing-expected-lifespan.yml +2 -2
- package/manifests/{plugins → examples/builtins}/sci-embodied/success.yml +2 -2
- package/manifests/{plugins → examples/builtins}/shell/failure-invalid-command.yml +2 -2
- package/manifests/{plugins → examples/builtins}/shell/success.yml +2 -1
- package/manifests/{plugins → examples/builtins}/subtract/success.yml +6 -9
- package/manifests/{plugins → examples/builtins}/sum/failure-missing-input-param.yml +2 -4
- package/manifests/{plugins → examples/builtins}/sum/failure-missing-output-param.yml +3 -5
- package/manifests/{plugins → examples/builtins}/sum/success.yml +2 -4
- package/manifests/{plugins → examples/builtins}/time-sync/failure-config-start-later-end.yml +3 -3
- package/manifests/{plugins → examples/builtins}/time-sync/failure-missing-global-config.yml +3 -3
- package/manifests/{plugins → examples/builtins}/time-sync/success.yml +2 -2
- package/manifests/{plugins/groupby/failure-invalid-config-group.yml → examples/features/regroup/failure-invalid-regroup.yml} +4 -11
- package/manifests/{plugins/groupby → examples/features/regroup}/failure-missing-cloud-instance-type.yml +5 -12
- package/manifests/{plugins/groupby → examples/features/regroup}/success.yml +4 -11
- package/manifests/examples/{generics.yml → pipelines/generics.yml} +12 -12
- package/manifests/examples/{instance-metadata.yml → pipelines/instance-metadata.yml} +6 -7
- package/manifests/examples/{nesting.yml → pipelines/nesting.yml} +157 -50
- package/manifests/examples/pipelines/outputs-if-diff/pipeline-with-aggregate.yaml +997 -0
- package/manifests/examples/pipelines/outputs-if-diff/pipeline-with-mocks.yaml +1059 -0
- package/manifests/examples/{pipeline-teads-sci.yml → pipelines/pipeline-teads-sci.yml} +11 -11
- package/manifests/examples/{pipeline-with-aggregate.yml → pipelines/pipeline-with-aggregate.yml} +113 -36
- package/manifests/examples/pipelines/pipeline-with-mocks.yml +297 -0
- package/manifests/{bugs/mock-observations-failure-duration-is-zero.yml → examples/pipelines/scenario-1.yml} +7 -7
- package/manifests/examples/pipelines/scenario-2.yml +52 -0
- package/manifests/examples/pipelines/scenario-3.yml +86 -0
- package/manifests/examples/pipelines/scenario-4.yml +46 -0
- package/manifests/examples/pipelines/scenario-5.yml +46 -0
- package/manifests/examples/{sci.yml → pipelines/sci.yml} +15 -17
- package/manifests/examples/{teads-curve.yml → pipelines/teads-curve.yml} +7 -6
- package/manifests/examples/{zeros.yaml → pipelines/zeros.yml} +15 -16
- package/manifests/outputs/bugs/aggregation-error-wrong-metric.yaml +235 -0
- package/manifests/outputs/bugs/input-error-missing-duration.yaml +82 -0
- package/manifests/outputs/bugs/mock-observations-failure-duration-is-zero.yaml +79 -0
- package/manifests/outputs/bugs/pipeline-error-naming-mismatch.yaml +89 -0
- package/manifests/outputs/bugs/pipeline-error-uninitialized-plugin.yaml +90 -0
- package/manifests/outputs/bugs/pipeline-ordering-error.yaml +152 -0
- package/manifests/outputs/bugs/sci-embodied-missing-resources-total.yaml +72 -0
- package/manifests/outputs/builtins/coefficient/failure-invalid-config-input-param.yaml +69 -0
- package/manifests/outputs/builtins/coefficient/failure-output-param-is-null.yaml +69 -0
- package/manifests/outputs/builtins/coefficient/success.yaml +70 -0
- package/manifests/outputs/builtins/csv-lookup/cloud-metadata/failure-invalid-instance-type.yaml +76 -0
- package/manifests/outputs/builtins/csv-lookup/cloud-metadata/failure-missing-cloud-vendor.yaml +74 -0
- package/manifests/outputs/builtins/csv-lookup/cloud-metadata/success.yaml +79 -0
- package/manifests/outputs/builtins/csv-lookup/region-metadata/failure-missing-column.yaml +75 -0
- package/manifests/outputs/builtins/csv-lookup/region-metadata/failure-missing-output.yaml +73 -0
- package/manifests/outputs/builtins/csv-lookup/region-metadata/success-renaming.yaml +78 -0
- package/manifests/outputs/builtins/csv-lookup/region-metadata/success.yaml +90 -0
- package/manifests/outputs/builtins/csv-lookup/tdp-finder/failure-missing-input-param.yaml +71 -0
- package/manifests/outputs/builtins/csv-lookup/tdp-finder/failure-unsupported-physical-processor.yaml +73 -0
- package/manifests/outputs/builtins/csv-lookup/tdp-finder/success.yaml +74 -0
- package/manifests/outputs/builtins/divide/failure-invalid-config-denominator.yaml +69 -0
- package/manifests/outputs/builtins/divide/failure-missing-numerator.yaml +75 -0
- package/manifests/outputs/builtins/divide/success-denominator-equal-zero.yaml +91 -0
- package/manifests/outputs/builtins/divide/success.yaml +91 -0
- package/manifests/outputs/builtins/exponent/success.yaml +73 -0
- package/manifests/outputs/builtins/interpolation/interpolation.yaml +81 -0
- package/manifests/outputs/builtins/interpolation/success.yaml +81 -0
- package/manifests/outputs/builtins/mock-observations/failure-invalid-config-cpu-range.yaml +84 -0
- package/manifests/outputs/builtins/mock-observations/failure-invalid-memory-utilization-range.yaml +82 -0
- package/manifests/outputs/builtins/mock-observations/failure-missing-timestamp-from-param.yaml +81 -0
- package/manifests/outputs/builtins/mock-observations/success.yaml +358 -0
- package/manifests/outputs/builtins/multiply/failure-input-parameter-is-missing.yaml +71 -0
- package/manifests/outputs/builtins/multiply/success-with-multiple-inputs.yaml +92 -0
- package/manifests/outputs/builtins/multiply/success.yaml +74 -0
- package/manifests/outputs/builtins/regex/failure-missing-input-param.yaml +71 -0
- package/manifests/outputs/builtins/regex/success.yaml +76 -0
- package/manifests/outputs/builtins/sci/failure-invalid-config-value.yaml +70 -0
- package/manifests/outputs/builtins/sci/failure-missing-input-param.yaml +70 -0
- package/manifests/outputs/builtins/sci/success.yaml +77 -0
- package/manifests/outputs/builtins/sci-embodied/failure-invalid-default-emission-value.yaml +73 -0
- package/manifests/outputs/builtins/sci-embodied/failure-missing-expected-lifespan.yaml +69 -0
- package/manifests/outputs/builtins/sci-embodied/success.yaml +76 -0
- package/manifests/outputs/builtins/shell/failure-invalid-command.yaml +68 -0
- package/manifests/outputs/builtins/shell/success.yaml +66 -0
- package/manifests/outputs/builtins/subtract/success.yaml +74 -0
- package/manifests/outputs/builtins/sum/failure-missing-input-param.yaml +71 -0
- package/manifests/outputs/builtins/sum/failure-missing-output-param.yaml +74 -0
- package/manifests/outputs/builtins/sum/success.yaml +74 -0
- package/manifests/outputs/builtins/time-sync/failure-config-start-later-end.yaml +79 -0
- package/manifests/outputs/builtins/time-sync/success.yaml +122 -0
- package/manifests/outputs/features/aggregate-failure-invalid-metrics.yaml +100 -0
- package/manifests/outputs/features/aggregate-failure-missing-metric-in-inputs.yaml +99 -0
- package/manifests/outputs/features/aggregate-horizontal.yaml +132 -0
- package/manifests/outputs/features/aggregate-vertical.yaml +155 -0
- package/manifests/outputs/features/aggregate.yaml +159 -0
- package/manifests/outputs/features/failure-invalid-regroup.yaml +87 -0
- package/manifests/outputs/features/failure-missing-cloud-instance-type.yaml +86 -0
- package/manifests/outputs/pipelines/cloud-metadata-divide.yaml +91 -0
- package/manifests/outputs/pipelines/generics.yaml +239 -0
- package/manifests/outputs/pipelines/instance-metadata.yaml +98 -0
- package/manifests/outputs/pipelines/mock-obs-time-sync.yaml +449 -0
- package/manifests/outputs/pipelines/nesting.yaml +1799 -0
- package/manifests/outputs/pipelines/pipeline-teads-sci.yaml +276 -0
- package/manifests/outputs/pipelines/sci.yaml +297 -0
- package/manifests/outputs/pipelines/teads-curve.yaml +188 -0
- package/manifests/outputs/pipelines/zeros.yaml +198 -0
- package/package.json +15 -16
- package/src/__mocks__/mock-manifest.yaml +2 -3
- package/src/{config → if-env/config}/env-template.yml +2 -3
- package/src/{builtins → if-run/builtins}/coefficient/README.md +31 -9
- package/src/{builtins → if-run/builtins}/copy-param/README.md +30 -11
- package/src/{builtins → if-run/builtins}/csv-lookup/README.md +32 -20
- package/src/{builtins → if-run/builtins}/divide/README.md +21 -8
- package/src/{builtins → if-run/builtins}/exponent/README.md +19 -8
- package/src/{builtins → if-run/builtins}/interpolation/README.md +21 -6
- package/src/{builtins → if-run/builtins}/mock-observations/README.md +18 -4
- package/src/{builtins → if-run/builtins}/multiply/README.md +20 -8
- package/src/{builtins → if-run/builtins}/regex/README.md +19 -9
- package/src/{builtins → if-run/builtins}/sci/README.md +19 -9
- package/src/{builtins → if-run/builtins}/sci-embodied/README.md +17 -5
- package/src/{builtins → if-run/builtins}/shell/README.md +19 -7
- package/src/{builtins → if-run/builtins}/subtract/README.md +17 -6
- package/src/{builtins → if-run/builtins}/sum/README.md +34 -8
- package/src/if-run/builtins/time-sync/README.md +267 -0
- package/build/builtins/coefficient/index.d.ts +0 -2
- package/build/builtins/coefficient/index.js +0 -65
- package/build/builtins/copy-param/index.d.ts +0 -2
- package/build/builtins/copy-param/index.js +0 -68
- package/build/builtins/csv-lookup/index.d.ts +0 -2
- package/build/builtins/csv-lookup/index.js +0 -188
- package/build/builtins/divide/index.d.ts +0 -2
- package/build/builtins/divide/index.js +0 -78
- package/build/builtins/exponent/index.d.ts +0 -2
- package/build/builtins/exponent/index.js +0 -58
- package/build/builtins/export-csv-raw.d.ts +0 -4
- package/build/builtins/export-csv-raw.js +0 -132
- package/build/builtins/export-csv.d.ts +0 -10
- package/build/builtins/export-csv.js +0 -96
- package/build/builtins/export-yaml.js +0 -30
- package/build/builtins/group-by.d.ts +0 -5
- package/build/builtins/group-by.js +0 -71
- package/build/builtins/interpolation/index.d.ts +0 -2
- package/build/builtins/interpolation/index.js +0 -148
- package/build/builtins/mock-observations/helpers/common-generator.js +0 -29
- package/build/builtins/mock-observations/helpers/rand-int-generator.js +0 -48
- package/build/builtins/mock-observations/index.d.ts +0 -2
- package/build/builtins/mock-observations/index.js +0 -114
- package/build/builtins/mock-observations/interfaces/index.js +0 -3
- package/build/builtins/multiply/index.d.ts +0 -2
- package/build/builtins/multiply/index.js +0 -57
- package/build/builtins/regex/index.d.ts +0 -2
- package/build/builtins/regex/index.js +0 -74
- package/build/builtins/sci/config.js +0 -44
- package/build/builtins/sci/index.d.ts +0 -2
- package/build/builtins/sci/index.js +0 -70
- package/build/builtins/sci-embodied/index.d.ts +0 -2
- package/build/builtins/sci-embodied/index.js +0 -114
- package/build/builtins/shell/index.d.ts +0 -2
- package/build/builtins/shell/index.js +0 -58
- package/build/builtins/subtract/index.d.ts +0 -2
- package/build/builtins/subtract/index.js +0 -59
- package/build/builtins/sum/index.d.ts +0 -2
- package/build/builtins/sum/index.js +0 -64
- package/build/builtins/time-sync.d.ts +0 -2
- package/build/builtins/time-sync.js +0 -300
- package/build/check.js +0 -85
- package/build/config/config.d.ts +0 -29
- package/build/config/config.js +0 -147
- package/build/config/index.js +0 -10
- package/build/config/params.d.ts +0 -2
- package/build/config/params.js +0 -196
- package/build/config/strings.js +0 -101
- package/build/diff.js +0 -46
- package/build/env.js +0 -38
- package/build/index.js +0 -48
- package/build/lib/aggregate.d.ts +0 -6
- package/build/lib/aggregate.js +0 -77
- package/build/lib/compare.js +0 -56
- package/build/lib/compute.js +0 -91
- package/build/lib/environment.js +0 -75
- package/build/lib/exhaust.js +0 -53
- package/build/lib/initialize.d.ts +0 -6
- package/build/lib/initialize.js +0 -101
- package/build/lib/load.js +0 -70
- package/build/lib/parameterize.d.ts +0 -6
- package/build/lib/parameterize.js +0 -55
- package/build/types/aggregation.d.ts +0 -2
- package/build/types/aggregation.js +0 -5
- package/build/types/compute.js +0 -3
- package/build/types/environment.js +0 -3
- package/build/types/exhaust-plugin-interface.js +0 -3
- package/build/types/if-env.js +0 -3
- package/build/types/interface.d.ts +0 -4
- package/build/types/interface.js +0 -8
- package/build/types/lib/compare.js +0 -3
- package/build/types/manifest.js +0 -3
- package/build/types/npm.js +0 -3
- package/build/types/parameters.d.ts +0 -5
- package/build/types/parameters.js +0 -5
- package/build/types/plugin-storage.js +0 -3
- package/build/types/process-args.d.ts +0 -33
- package/build/types/process-args.js +0 -3
- package/build/types/time-sync.js +0 -3
- package/build/types/util/args.js +0 -3
- package/build/util/aggregation-helper.js +0 -55
- package/build/util/args.d.ts +0 -37
- package/build/util/args.js +0 -205
- package/build/util/debug-logger.js +0 -117
- package/build/util/fs.js +0 -94
- package/build/util/helpers.d.ts +0 -57
- package/build/util/helpers.js +0 -250
- package/build/util/json.d.ts +0 -4
- package/build/util/json.js +0 -36
- package/build/util/log-memoize.js +0 -19
- package/build/util/npm.js +0 -152
- package/build/util/os-checker.js +0 -97
- package/build/util/plugin-storage.js +0 -34
- package/build/util/validations.js +0 -124
- package/build/util/yaml.js +0 -59
- package/manifests/bugs/aggregation-error-wrong-metric.yml +0 -178
- package/manifests/bugs/azure-importer-ignoring-defaults.yml +0 -64
- package/manifests/bugs/azure-importer-incorrect-calculation.yml +0 -59
- package/manifests/bugs/initialize-error-no-config.yml +0 -26
- package/manifests/bugs/initialize-error-no-path.yml +0 -32
- package/manifests/bugs/initialize-error-no-plugins.yml +0 -23
- package/manifests/bugs/input-error-missing-duration.yml +0 -25
- package/manifests/bugs/pipeline-error-naming-mismatch.yml +0 -32
- package/manifests/bugs/pipeline-error-uninitialized-plugin.yml +0 -33
- package/manifests/bugs/pipeline-ordering-error.yml +0 -91
- package/manifests/bugs/sci-embodied-missing-resources-total.yml +0 -23
- package/manifests/examples/copy.yaml +0 -20
- package/manifests/examples/mock-cpu-util-to-carbon.yml +0 -76
- package/manifests/examples/pipeline-with-mocks.yml +0 -207
- package/manifests/examples/region-metadata.yml +0 -26
- package/manifests/examples/tdp-finder.yml +0 -23
- package/manifests/features/aggregate-failure-invalid-metrics.yml +0 -49
- package/manifests/features/aggregate-failure-missing-metric-in-inputs.yml +0 -49
- package/manifests/features/aggregate-horizontal.yml +0 -50
- package/manifests/features/aggregate-vertical.yml +0 -50
- package/manifests/features/aggregate.yml +0 -50
- package/manifests/integrations/cloud-metadata-divide.yml +0 -37
- package/manifests/integrations/instance-metadata/failure-invalid-instance-type.yaml +0 -33
- package/manifests/integrations/instance-metadata/failure-invalid-provider.yaml +0 -33
- package/manifests/integrations/instance-metadata/failure-missing-queried-input.yml +0 -33
- package/manifests/integrations/instance-metadata/success.yml +0 -33
- package/manifests/integrations/mock-obs-group-by-cloud-meta.yml +0 -57
- package/manifests/integrations/mock-obs-groupby.yml +0 -39
- package/manifests/integrations/mock-obs-time-sync.yml +0 -110
- package/src/__tests__/integration/templates/integration.yaml +0 -16
- package/src/builtins/README.md +0 -848
- /package/build/{util → common/util}/debug-logger.d.ts +0 -0
- /package/build/{util → common/util}/fs.d.ts +0 -0
- /package/build/{util → common/util}/logger.d.ts +0 -0
- /package/build/{util → common/util}/yaml.d.ts +0 -0
- /package/build/{index.d.ts → if-check/index.d.ts} +0 -0
- /package/build/{check.d.ts → if-csv/index.d.ts} +0 -0
- /package/build/{diff.d.ts → if-diff/index.d.ts} +0 -0
- /package/build/{types/util → if-diff/types}/args.d.ts +0 -0
- /package/build/{types/lib → if-diff/types}/compare.d.ts +0 -0
- /package/build/{env.d.ts → if-env/index.d.ts} +0 -0
- /package/build/{types → if-env/types}/if-env.d.ts +0 -0
- /package/build/{types → if-env/types}/npm.d.ts +0 -0
- /package/build/{builtins → if-run/builtins}/mock-observations/helpers/common-generator.d.ts +0 -0
- /package/build/{builtins → if-run/builtins}/mock-observations/helpers/rand-int-generator.d.ts +0 -0
- /package/build/{builtins → if-run/builtins}/mock-observations/interfaces/index.d.ts +0 -0
- /package/build/{builtins → if-run/builtins}/sci/config.d.ts +0 -0
- /package/build/{lib → if-run/lib}/compute.d.ts +0 -0
- /package/build/{types → if-run/types}/environment.d.ts +0 -0
- /package/build/{types → if-run/types}/plugin-storage.d.ts +0 -0
- /package/build/{types → if-run/types}/time-sync.d.ts +0 -0
- /package/build/{util → if-run/util}/log-memoize.d.ts +0 -0
- /package/build/{util → if-run/util}/os-checker.d.ts +0 -0
|
@@ -13,19 +13,17 @@ For example, for the following CSV:
|
|
|
13
13
|
| 2022 | Google Cloud | asia-east2 | Hong Kong | HK | HK | Hong Kong | 22.3,114.2 | 0.28 | | | 0 | 453 | | | | 360 |
|
|
14
14
|
| 2022 | Google Cloud | asia-northeast1 | Tokyo | JP-TK | JP-TK | Tokyo | 35.6897,139.692 | 0.28 | | | 0 | 463 | | | | 463 |
|
|
15
15
|
|
|
16
|
-
|
|
17
16
|
You could select all the data for the cloud provider `Google Cloud` in the region `asia-east2` using the following configuration:
|
|
18
17
|
|
|
19
18
|
```yaml
|
|
20
19
|
filepath: https://raw.githubusercontent.com/Green-Software-Foundation/if-data/main/region-metadata.csv
|
|
21
20
|
query:
|
|
22
|
-
cloud-provider:
|
|
23
|
-
cloud-region:
|
|
24
|
-
output:
|
|
21
|
+
cloud-provider: 'cloud/provider'
|
|
22
|
+
cloud-region: 'cloud/region'
|
|
23
|
+
output: '*'
|
|
25
24
|
```
|
|
26
25
|
|
|
27
|
-
Notice that the query parameters are key/value pairs where the key is the column name in the target CSV and the value is a **reference to a value** in your `input` data (
|
|
28
|
-
|
|
26
|
+
Notice that the query parameters are key/value pairs where the key is the column name in the target CSV and the value is a **reference to a value** in your `input` data (_not_ an actual value - a reference). This is to enable you to chain CSV lookups together based on information from other plugins in your pipeline.
|
|
29
27
|
|
|
30
28
|
## Parameters
|
|
31
29
|
|
|
@@ -33,28 +31,43 @@ Notice that the query parameters are key/value pairs where the key is the column
|
|
|
33
31
|
|
|
34
32
|
- `filepath` - path to a csv file, either on the local filesystem or on the internet
|
|
35
33
|
- `query` - an array of key/value pairs where the key is a column name in the target csv and the value is a parameter from inputs
|
|
36
|
-
- `output` - the columns to grab data from and add to output data - should support wildcard or multiple values.
|
|
34
|
+
- `output` - the columns to grab data from and add to output data - should support wildcard or multiple values.
|
|
37
35
|
|
|
38
|
-
The plugin also supports data renaming. This means you can grab data from a named column but push it into your manifest file data under another name, for example, maybe we want to grab data from the `processor-name` column int he target csv and add it to the manifest file data as `processor-id` because this is the name expected by some other plugin in your piepline. You can do this by passing comma separated values in arrays.
|
|
36
|
+
The plugin also supports data renaming. This means you can grab data from a named column but push it into your manifest file data under another name, for example, maybe we want to grab data from the `processor-name` column int he target csv and add it to the manifest file data as `processor-id` because this is the name expected by some other plugin in your piepline. You can do this by passing comma separated values in arrays.
|
|
39
37
|
|
|
40
38
|
```yaml
|
|
41
|
-
output:
|
|
42
|
-
["processor-name": "processor-id"]
|
|
39
|
+
output: ['processor-name': 'processor-id']
|
|
43
40
|
```
|
|
44
41
|
|
|
45
42
|
You can nest arrays to do this renaming for multiple columns.
|
|
46
43
|
|
|
47
44
|
```yaml
|
|
48
45
|
output:
|
|
49
|
-
[[
|
|
46
|
+
[['processor-name', 'processor-model-id'], ['tdp', 'thermal-design-power']]
|
|
50
47
|
```
|
|
51
48
|
|
|
52
49
|
All the following values are valid for the `output` field:
|
|
50
|
+
|
|
53
51
|
- `"*"`
|
|
54
52
|
- `"tdp"`
|
|
55
53
|
- `["processor-name", "processor-model-id"]`
|
|
56
54
|
- `[["processor-name", "processor-model-id"],["tdp","thermal-design-power"]]`
|
|
57
55
|
|
|
56
|
+
### Plugin parameter metadata
|
|
57
|
+
|
|
58
|
+
The `parameter-metadata` section contains information about `description`, `unit` and `aggregation-method` of the parameters of the inputs and outputs
|
|
59
|
+
|
|
60
|
+
- `inputs`: describe the parameters of the `inputs`. Each parameter has:
|
|
61
|
+
|
|
62
|
+
- `description`: description of the parameter
|
|
63
|
+
- `unit`: unit of the parameter
|
|
64
|
+
- `aggregation-method`: aggregation method of the parameter (it can be `sum`, `avg` or `none`)
|
|
65
|
+
|
|
66
|
+
- `outputs`: describe the parameters in the `output` of the config block. The parameter has the following attributes:
|
|
67
|
+
- `description`: description of the parameter
|
|
68
|
+
- `unit`: unit of the parameter
|
|
69
|
+
- `aggregation-method`: aggregation method of the parameter (it can be `sum`, `avg` or `none`)
|
|
70
|
+
|
|
58
71
|
### Inputs
|
|
59
72
|
|
|
60
73
|
There are no strict requirements on input for this plugin because they depend upon the contents of the target CSV and your input data at the time the CSV lookup is invoked. Please make sure you are requesting data from columns that exist in the target csv file and that your query values are available in your `input` data.
|
|
@@ -86,7 +99,7 @@ const globalConfig = {
|
|
|
86
99
|
},
|
|
87
100
|
output: ['cpu-tdp', 'tdp'],
|
|
88
101
|
};
|
|
89
|
-
const
|
|
102
|
+
const csvLookup = CSVLookup(globalConfig);
|
|
90
103
|
|
|
91
104
|
const input = [
|
|
92
105
|
{
|
|
@@ -108,8 +121,6 @@ name: csv-lookup-demo
|
|
|
108
121
|
description:
|
|
109
122
|
tags:
|
|
110
123
|
initialize:
|
|
111
|
-
outputs:
|
|
112
|
-
- yaml
|
|
113
124
|
plugins:
|
|
114
125
|
cloud-metadata:
|
|
115
126
|
method: CSVLookup
|
|
@@ -117,14 +128,15 @@ initialize:
|
|
|
117
128
|
global-config:
|
|
118
129
|
filepath: https://raw.githubusercontent.com/Green-Software-Foundation/if-data/main/region-metadata.csv
|
|
119
130
|
query:
|
|
120
|
-
cloud-provider:
|
|
121
|
-
cloud-region:
|
|
122
|
-
output:
|
|
131
|
+
cloud-provider: 'cloud/provider'
|
|
132
|
+
cloud-region: 'cloud/region'
|
|
133
|
+
output: '*'
|
|
123
134
|
tree:
|
|
124
135
|
children:
|
|
125
136
|
child:
|
|
126
137
|
pipeline:
|
|
127
|
-
|
|
138
|
+
compute:
|
|
139
|
+
- cloud-metadata
|
|
128
140
|
inputs:
|
|
129
141
|
- timestamp: 2023-08-06T00:00
|
|
130
142
|
duration: 3600
|
|
@@ -141,7 +153,6 @@ if-run --manifest manifests/plugins/csv-lookup.yml --output manifests/outputs/cs
|
|
|
141
153
|
|
|
142
154
|
The results will be saved to a new `yaml` file in `manifests/outputs`.
|
|
143
155
|
|
|
144
|
-
|
|
145
156
|
## Errors
|
|
146
157
|
|
|
147
158
|
Coefficient exposes six of the IF error classes.
|
|
@@ -171,10 +182,11 @@ This error arises due to problems parsing CSV data into IF. This can occur when
|
|
|
171
182
|
You will receive an error starting `GlobalConfigError: ` if you have not provided the expected configuration data in the plugin's `initialize` block.
|
|
172
183
|
|
|
173
184
|
The required parameters are:
|
|
185
|
+
|
|
174
186
|
- `filepath`: This must be a path to a csv file
|
|
175
187
|
- `query`: this must be an array of key-value pairs where the key is a string containing a column name an the value is a string containing the name of a value in `inputs`
|
|
176
188
|
- `output`: this must be a string containing a name or a wildcard character (`"*"`)
|
|
177
189
|
|
|
178
190
|
You can fix this error by checking you are providing valid values for each parameter in the config.
|
|
179
191
|
|
|
180
|
-
For more information on our error classes, please visit [our docs](https://if.greensoftware.foundation/reference/errors
|
|
192
|
+
For more information on our error classes, please visit [our docs](https://if.greensoftware.foundation/reference/errors)
|
|
@@ -12,6 +12,21 @@ You provide the names of the values you want to divide, and a name to use to add
|
|
|
12
12
|
- `denominator` - a parameter by a specific configured number or the number by which `numerator` is divided
|
|
13
13
|
- `output` - the number to a configured output parameter
|
|
14
14
|
|
|
15
|
+
### Plugin parameter metadata
|
|
16
|
+
|
|
17
|
+
The `parameter-metadata` section contains information about `description`, `unit` and `aggregation-method` of the parameters of the inputs and outputs
|
|
18
|
+
|
|
19
|
+
- `inputs`: describe the parameter of the `numerator` of the global config. The parameter has the following attributes:
|
|
20
|
+
|
|
21
|
+
- `description`: description of the parameter
|
|
22
|
+
- `unit`: unit of the parameter
|
|
23
|
+
- `aggregation-method`: aggregation method of the parameter (it can be `sum`, `avg` or `none`)
|
|
24
|
+
|
|
25
|
+
- `outputs`: describe the parameter of the `denominator` of the global config. The parameter has the following attributes:
|
|
26
|
+
- `description`: description of the parameter
|
|
27
|
+
- `unit`: unit of the parameter
|
|
28
|
+
- `aggregation-method`: aggregation method of the parameter (it can be `sum`, `avg` or `none`)
|
|
29
|
+
|
|
15
30
|
### Inputs
|
|
16
31
|
|
|
17
32
|
- `numerator` - as input parameter, must be available in the input array
|
|
@@ -24,7 +39,7 @@ You provide the names of the values you want to divide, and a name to use to add
|
|
|
24
39
|
|
|
25
40
|
The plugin throws an exception if the division result is not a number.
|
|
26
41
|
|
|
27
|
-
>Note: Plugin will warn and return `numerator` value in case if `denominator` is zero.
|
|
42
|
+
> Note: Plugin will warn and return `numerator` value in case if `denominator` is zero.
|
|
28
43
|
|
|
29
44
|
## Calculation
|
|
30
45
|
|
|
@@ -42,7 +57,7 @@ const globalConfig = {
|
|
|
42
57
|
denominator: 2,
|
|
43
58
|
output: 'cpu/number-cores',
|
|
44
59
|
};
|
|
45
|
-
const divide = Divide(globalConfig);
|
|
60
|
+
const divide = Divide(globalConfig, parametersMetadata);
|
|
46
61
|
|
|
47
62
|
const input = [
|
|
48
63
|
{
|
|
@@ -62,8 +77,6 @@ name: divide-demo
|
|
|
62
77
|
description:
|
|
63
78
|
tags:
|
|
64
79
|
initialize:
|
|
65
|
-
outputs:
|
|
66
|
-
- yaml
|
|
67
80
|
plugins:
|
|
68
81
|
divide:
|
|
69
82
|
method: Divide
|
|
@@ -76,9 +89,8 @@ tree:
|
|
|
76
89
|
children:
|
|
77
90
|
child:
|
|
78
91
|
pipeline:
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
divide:
|
|
92
|
+
compute:
|
|
93
|
+
- divide
|
|
82
94
|
inputs:
|
|
83
95
|
- timestamp: 2023-08-06T00:00
|
|
84
96
|
duration: 3600
|
|
@@ -103,6 +115,7 @@ The results will be saved to a new `yaml` file in `./examples/outputs`.
|
|
|
103
115
|
You will receive an error starting `GlobalConfigError: ` if you have not provided the expected configuration data in the plugin's `initialize` block.
|
|
104
116
|
|
|
105
117
|
The required parameters are:
|
|
118
|
+
|
|
106
119
|
- `numerator`: a string containing the name of the input parameter whose value should be divided by `denominator`
|
|
107
120
|
- `denominator`: a number to use as the denominator
|
|
108
121
|
- ``output`: a string containing the name to assign the result of the division
|
|
@@ -113,9 +126,9 @@ You can fix this error by checking you are providing valid values for each param
|
|
|
113
126
|
|
|
114
127
|
This error arises when a necessary piece of input data is missing from the `inputs` array.
|
|
115
128
|
Every element in the ``inputs` array must contain:
|
|
129
|
+
|
|
116
130
|
- `timestamp`
|
|
117
131
|
- `duration`
|
|
118
132
|
- whatever value you passed to `numerator`
|
|
119
133
|
|
|
120
|
-
|
|
121
134
|
For more information on our error classes, please visit [our docs](https://if.greensoftware.foundation/reference/errors
|
|
@@ -16,6 +16,21 @@ Three parameters are required in global config: `input-parameter`, `exponent` an
|
|
|
16
16
|
`exponent`: a number defining the exponent.
|
|
17
17
|
`output-parameter`: a string defining the name to use to add the result of the exponent to the output array.
|
|
18
18
|
|
|
19
|
+
### Plugin parameter metadata
|
|
20
|
+
|
|
21
|
+
The `parameter-metadata` section contains information about `description`, `unit` and `aggregation-method` of the parameters of the inputs and outputs
|
|
22
|
+
|
|
23
|
+
- `inputs`: describe the parameter of the `input-parameter` of the global config. The parameter has the following attributes:
|
|
24
|
+
|
|
25
|
+
- `description`: description of the parameter
|
|
26
|
+
- `unit`: unit of the parameter
|
|
27
|
+
- `aggregation-method`: aggregation method of the parameter (it can be `sum`, `avg` or `none`)
|
|
28
|
+
|
|
29
|
+
- `outputs`: describe the parameter of the `output-parameter` of the global config. The parameter has the following attributes::
|
|
30
|
+
- `description`: description of the parameter
|
|
31
|
+
- `unit`: unit of the parameter
|
|
32
|
+
- `aggregation-method`: aggregation method of the parameter (it can be `sum`, `avg` or `none`)
|
|
33
|
+
|
|
19
34
|
### Inputs
|
|
20
35
|
|
|
21
36
|
`input-parameter` and `exponent` must be available in the input array.
|
|
@@ -63,8 +78,6 @@ name: exponent demo
|
|
|
63
78
|
description:
|
|
64
79
|
tags:
|
|
65
80
|
initialize:
|
|
66
|
-
outputs:
|
|
67
|
-
- yaml
|
|
68
81
|
plugins:
|
|
69
82
|
exponent:
|
|
70
83
|
method: Exponent
|
|
@@ -77,9 +90,8 @@ tree:
|
|
|
77
90
|
children:
|
|
78
91
|
child:
|
|
79
92
|
pipeline:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
exponent:
|
|
93
|
+
compute:
|
|
94
|
+
- exponent
|
|
83
95
|
inputs:
|
|
84
96
|
- timestamp: 2023-08-06T00:00
|
|
85
97
|
duration: 3600
|
|
@@ -91,7 +103,7 @@ You can run this example by saving it as `manifests/examples/test/exponent.yml`
|
|
|
91
103
|
|
|
92
104
|
```sh
|
|
93
105
|
npm i -g @grnsft/if
|
|
94
|
-
if-run --manifest manifests/examples/test/exponent.yml --output manifests/outputs/exponent
|
|
106
|
+
if-run --manifest manifests/examples/test/exponent.yml --output manifests/outputs/exponent
|
|
95
107
|
```
|
|
96
108
|
|
|
97
109
|
The results will be saved to a new `yaml` file in `manifests/outputs`.
|
|
@@ -109,9 +121,8 @@ Every element in the `inputs` array must contain:
|
|
|
109
121
|
- `duration`
|
|
110
122
|
- whatever value you passed to `input-parameter`
|
|
111
123
|
|
|
112
|
-
|
|
113
124
|
### `InputValidationError`
|
|
114
125
|
|
|
115
126
|
This error arises when an invalid value is passed to `Exponent`. 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.
|
|
116
127
|
|
|
117
|
-
For more information on our error classes, please visit [our docs](https://if.greensoftware.foundation/reference/errors
|
|
128
|
+
For more information on our error classes, please visit [our docs](https://if.greensoftware.foundation/reference/errors)
|
|
@@ -25,6 +25,21 @@ To employ the `Interpolation` plugin, adhere to these steps:
|
|
|
25
25
|
|
|
26
26
|
`x` and `y` arrays must be equal lengths.
|
|
27
27
|
|
|
28
|
+
## Plugin parameter metadata
|
|
29
|
+
|
|
30
|
+
The `parameter-metadata` section contains information about `description`, `unit` and `aggregation-method` of the parameters of the inputs and outputs
|
|
31
|
+
|
|
32
|
+
- `inputs`: describe the parameter of the `input-parameter` of the global config. The parameter has the following attributes:
|
|
33
|
+
|
|
34
|
+
- `description`: description of the parameter
|
|
35
|
+
- `unit`: unit of the parameter
|
|
36
|
+
- `aggregation-method`: aggregation method of the parameter (it can be `sum`, `avg` or `none`)
|
|
37
|
+
|
|
38
|
+
- `outputs`: describe the parameters of the `output-parameter` of the global config. The parameter has the following attributes:
|
|
39
|
+
- `description`: description of the parameter
|
|
40
|
+
- `unit`: unit of the parameter
|
|
41
|
+
- `aggregation-method`: aggregation method of the parameter (it can be `sum`, `avg` or `none`)
|
|
42
|
+
|
|
28
43
|
## Input Parameters
|
|
29
44
|
|
|
30
45
|
The plugin expects the following input parameters:
|
|
@@ -102,8 +117,6 @@ name: interpolation-demo
|
|
|
102
117
|
description: simple demo of interpolation plugin
|
|
103
118
|
tags:
|
|
104
119
|
initialize:
|
|
105
|
-
outputs:
|
|
106
|
-
- yaml
|
|
107
120
|
plugins:
|
|
108
121
|
interpolation:
|
|
109
122
|
method: Interpolation
|
|
@@ -118,7 +131,8 @@ tree:
|
|
|
118
131
|
children:
|
|
119
132
|
child:
|
|
120
133
|
pipeline:
|
|
121
|
-
|
|
134
|
+
compute:
|
|
135
|
+
- interpolation
|
|
122
136
|
inputs:
|
|
123
137
|
- timestamp: 2023-07-06T00:00
|
|
124
138
|
duration: 3600
|
|
@@ -132,8 +146,6 @@ name: interpolation-demo
|
|
|
132
146
|
description: simple demo of interpolation plugin
|
|
133
147
|
tags:
|
|
134
148
|
initialize:
|
|
135
|
-
outputs:
|
|
136
|
-
- yaml
|
|
137
149
|
plugins:
|
|
138
150
|
interpolation:
|
|
139
151
|
method: Interpolation
|
|
@@ -148,7 +160,8 @@ tree:
|
|
|
148
160
|
children:
|
|
149
161
|
child:
|
|
150
162
|
pipeline:
|
|
151
|
-
|
|
163
|
+
compute:
|
|
164
|
+
- interpolation
|
|
152
165
|
inputs:
|
|
153
166
|
- timestamp: 2023-07-06T00:00
|
|
154
167
|
duration: 3600
|
|
@@ -178,6 +191,7 @@ if-run --manifest ./manifests/examples/interpolation.yml --output ./manifests/ou
|
|
|
178
191
|
You will receive an error starting `GlobalConfigError: ` if you have not provided the expected configuration data in the plugin's `initialize` block.
|
|
179
192
|
|
|
180
193
|
The required parameters are:
|
|
194
|
+
|
|
181
195
|
- `method`: a string containing either `linear`, `spline` or `polynomial`
|
|
182
196
|
- `x`: an array of numbers
|
|
183
197
|
- `y`: an array of numbers
|
|
@@ -189,6 +203,7 @@ You can fix this error by checking you are providing valid values for each param
|
|
|
189
203
|
### Validation errors
|
|
190
204
|
|
|
191
205
|
There are also several validation errors that can arise, including:
|
|
206
|
+
|
|
192
207
|
- if the lengths of `x` and `y` are not equal
|
|
193
208
|
- if `x` or `y` are empty
|
|
194
209
|
- if the requested point to interpolate at is outside the range of `x`
|
|
@@ -17,6 +17,21 @@ The mode currently mocks 2 types of observation data:
|
|
|
17
17
|
- `generators` define which fields to generate for each observation
|
|
18
18
|
- `components` define the components for which to generate observations. The observations generated according to `timestamp-from`, `timestamp-to`, `duration` and `generators` will be duplicated for each component.
|
|
19
19
|
|
|
20
|
+
### Plugin parameter metadata
|
|
21
|
+
|
|
22
|
+
The `parameter-metadata` section contains information about `description`, `unit` and `aggregation-method` of the parameters of the inputs and outputs
|
|
23
|
+
|
|
24
|
+
- `inputs`: describe the parameters of the `inputs`. Each parameter has:
|
|
25
|
+
|
|
26
|
+
- `description`: description of the parameter
|
|
27
|
+
- `unit`: unit of the parameter
|
|
28
|
+
- `aggregation-method`: aggregation method of the parameter (it can be `sum`, `avg` or `none`)
|
|
29
|
+
|
|
30
|
+
- `outputs`: describe the output parameters. The parameter has the following attributes:
|
|
31
|
+
- `description`: description of the parameter
|
|
32
|
+
- `unit`: unit of the parameter
|
|
33
|
+
- `aggregation-method`: aggregation method of the parameter (it can be `sum`, `avg` or `none`)
|
|
34
|
+
|
|
20
35
|
### Authentication
|
|
21
36
|
|
|
22
37
|
N/A
|
|
@@ -47,15 +62,13 @@ const result = await mockObservations.execute([]);
|
|
|
47
62
|
|
|
48
63
|
### manifest Example
|
|
49
64
|
|
|
50
|
-
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 `
|
|
65
|
+
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 `mock-observation`:
|
|
51
66
|
|
|
52
67
|
```yaml
|
|
53
68
|
name: mock-observation-demo
|
|
54
69
|
description: example invoking mock-observation plugin
|
|
55
70
|
tags:
|
|
56
71
|
initialize:
|
|
57
|
-
outputs:
|
|
58
|
-
- yaml
|
|
59
72
|
plugins:
|
|
60
73
|
mock-observations:
|
|
61
74
|
kind: plugin
|
|
@@ -83,7 +96,8 @@ tree:
|
|
|
83
96
|
children:
|
|
84
97
|
child:
|
|
85
98
|
pipeline:
|
|
86
|
-
|
|
99
|
+
observe:
|
|
100
|
+
- mock-observations
|
|
87
101
|
inputs:
|
|
88
102
|
```
|
|
89
103
|
|
|
@@ -15,6 +15,21 @@ Two parameters are required in global config: `input-parameters` and `output-par
|
|
|
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 product of the input parameters to the output array.
|
|
17
17
|
|
|
18
|
+
### Plugin parameter metadata
|
|
19
|
+
|
|
20
|
+
The `parameter-metadata` section contains information about `description`, `unit` and `aggregation-method` of the parameters of the inputs and outputs
|
|
21
|
+
|
|
22
|
+
- `inputs`: describe parameters of the `input-parameters` of the global config. Each parameter has:
|
|
23
|
+
|
|
24
|
+
- `description`: description of the parameter
|
|
25
|
+
- `unit`: unit of the parameter
|
|
26
|
+
- `aggregation-method`: aggregation method of the parameter (it can be `sum`, `avg` or `none`)
|
|
27
|
+
|
|
28
|
+
- `outputs`: describe the parameter of the `output-parameter` of the global config. The parameter has the following attributes:
|
|
29
|
+
- `description`: description of the parameter
|
|
30
|
+
- `unit`: unit of the parameter
|
|
31
|
+
- `aggregation-method`: aggregation method of the parameter (it can be `sum`, `avg` or `none`)
|
|
32
|
+
|
|
18
33
|
### Inputs
|
|
19
34
|
|
|
20
35
|
All of `input-parameters` must be available in the input array.
|
|
@@ -41,8 +56,8 @@ const config = {
|
|
|
41
56
|
outputParameter: 'energy-product',
|
|
42
57
|
};
|
|
43
58
|
|
|
44
|
-
const
|
|
45
|
-
const result = await
|
|
59
|
+
const multiply = Multiply(config, parametersMetadata);
|
|
60
|
+
const result = await multiply.execute([
|
|
46
61
|
{
|
|
47
62
|
duration: 3600,
|
|
48
63
|
timestamp: '2021-01-01T00:00:00Z',
|
|
@@ -61,8 +76,6 @@ name: multiply-demo
|
|
|
61
76
|
description:
|
|
62
77
|
tags:
|
|
63
78
|
initialize:
|
|
64
|
-
outputs:
|
|
65
|
-
- yaml
|
|
66
79
|
plugins:
|
|
67
80
|
multiply:
|
|
68
81
|
method: Multiply
|
|
@@ -74,9 +87,8 @@ tree:
|
|
|
74
87
|
children:
|
|
75
88
|
child:
|
|
76
89
|
pipeline:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
multiply:
|
|
90
|
+
compute:
|
|
91
|
+
- multiply
|
|
80
92
|
inputs:
|
|
81
93
|
- timestamp: 2023-08-06T00:00
|
|
82
94
|
duration: 3600
|
|
@@ -93,7 +105,6 @@ if-run --manifest ./examples/manifests/test/multiply.yml --output ./examples/out
|
|
|
93
105
|
|
|
94
106
|
The results will be saved to a new `yaml` file in `./examples/outputs`
|
|
95
107
|
|
|
96
|
-
|
|
97
108
|
## Errors
|
|
98
109
|
|
|
99
110
|
`Multiply` uses one of the IF error classes.
|
|
@@ -102,6 +113,7 @@ The results will be saved to a new `yaml` file in `./examples/outputs`
|
|
|
102
113
|
|
|
103
114
|
This error arises when a necessary piece of input data is missing from the `inputs` array.
|
|
104
115
|
Every element in the `inputs` array must contain:
|
|
116
|
+
|
|
105
117
|
- `timestamp`
|
|
106
118
|
- `duration`
|
|
107
119
|
- whatever values you passed to `input-parameters`
|
|
@@ -16,20 +16,34 @@ Intel® Xeon® Platinum 8272CL,Intel® Xeon® 8171M 2.1 GHz,Intel® Xeon® E5-26
|
|
|
16
16
|
- `match` - a regex by which needs to match the `parameter`
|
|
17
17
|
- `output` - output parameter name in the input
|
|
18
18
|
|
|
19
|
+
### Plugin parameter metadata
|
|
20
|
+
|
|
21
|
+
The `parameter-metadata` section contains information about `description`, `unit` and `aggregation-method` of the parameters of the inputs and outputs
|
|
22
|
+
|
|
23
|
+
- `inputs`: describe the parameter of the `parameter` value of the global config. The parameter has the following attributes:
|
|
24
|
+
|
|
25
|
+
- `description`: description of the parameter
|
|
26
|
+
- `unit`: unit of the parameter
|
|
27
|
+
- `aggregation-method`: aggregation method of the parameter (it can be `sum`, `avg` or `none`)
|
|
28
|
+
|
|
29
|
+
- `outputs`: describe the parameters of the `output` of the global config. The parameter has the following attributes:
|
|
30
|
+
- `description`: description of the parameter
|
|
31
|
+
- `unit`: unit of the parameter
|
|
32
|
+
- `aggregation-method`: aggregation method of the parameter (it can be `sum`, `avg` or `none`)
|
|
33
|
+
|
|
19
34
|
### Inputs
|
|
20
35
|
|
|
21
36
|
- `parameter` - as input parameter, must be available in the input array
|
|
22
37
|
|
|
23
38
|
## Returns
|
|
24
39
|
|
|
25
|
-
- `output`:
|
|
40
|
+
- `output`: The match of the `parameter` value using the `match` regex defined in the global config. If the `match` regex includes the global flag (`g`), a string containing all matches separated by spaces.
|
|
26
41
|
|
|
27
42
|
## Implementation
|
|
28
43
|
|
|
29
44
|
To run the plugin, you must first create an instance of `Regex`. Then, you can call `execute()`.
|
|
30
45
|
|
|
31
46
|
```typescript
|
|
32
|
-
|
|
33
47
|
const globalConfig = {
|
|
34
48
|
parameter: 'physical-processor',
|
|
35
49
|
match: '^[^,]+',
|
|
@@ -56,8 +70,6 @@ name: regex-demo
|
|
|
56
70
|
description:
|
|
57
71
|
tags:
|
|
58
72
|
initialize:
|
|
59
|
-
outputs:
|
|
60
|
-
- yaml
|
|
61
73
|
plugins:
|
|
62
74
|
regex:
|
|
63
75
|
method: Regex
|
|
@@ -70,9 +82,8 @@ tree:
|
|
|
70
82
|
children:
|
|
71
83
|
child:
|
|
72
84
|
pipeline:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
regex:
|
|
85
|
+
compute:
|
|
86
|
+
- regex
|
|
76
87
|
inputs:
|
|
77
88
|
- timestamp: 2023-08-06T00:00
|
|
78
89
|
duration: 3600
|
|
@@ -96,11 +107,11 @@ The results will be saved to a new `yaml` file in `manifests/outputs`.
|
|
|
96
107
|
|
|
97
108
|
This error arises when a necessary piece of input data is missing from the `inputs` array.
|
|
98
109
|
Every element in the `inputs` array must contain:
|
|
110
|
+
|
|
99
111
|
- `timestamp`
|
|
100
112
|
- `duration`
|
|
101
113
|
- whatever value you passed to `parameter`
|
|
102
114
|
|
|
103
|
-
|
|
104
115
|
### `GlobalConfigError`
|
|
105
116
|
|
|
106
117
|
You will receive an error starting `GlobalConfigError: ` if you have not provided the expected configuration data in the plugin's `initialize` block.
|
|
@@ -113,7 +124,6 @@ The required parameters are:
|
|
|
113
124
|
|
|
114
125
|
You can fix this error by checking you are providing valid values for each parameter in the config.
|
|
115
126
|
|
|
116
|
-
|
|
117
127
|
### `RegexMismatchError`
|
|
118
128
|
|
|
119
129
|
This error arises when the requested regex cannot find any matches in the given data. If there are multiple matches, the plugin returns the first, but if there are none, it throws this error.
|
|
@@ -8,9 +8,22 @@
|
|
|
8
8
|
|
|
9
9
|
- `functional-unit`: the name of the functional unit in which to express the carbon impact (required)
|
|
10
10
|
|
|
11
|
+
### Plugin parameter metadata
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
The `parameter-metadata` section contains information about `description`, `unit` and `aggregation-method` of the parameters of the inputs and outputs
|
|
14
|
+
|
|
15
|
+
- `inputs`: describe parameters of the `inputs`. Each parameter has:
|
|
16
|
+
|
|
17
|
+
- `description`: description of the parameter
|
|
18
|
+
- `unit`: unit of the parameter
|
|
19
|
+
- `aggregation-method`: aggregation method of the parameter (it can be `sum`, `avg` or `none`)
|
|
20
|
+
|
|
21
|
+
- `outputs`: describe the `sci` parameter which has the following attributes:
|
|
22
|
+
- `description`: description of the parameter
|
|
23
|
+
- `unit`: unit of the parameter
|
|
24
|
+
- `aggregation-method`: aggregation method of the parameter (it can be `sum`, `avg` or `none`)
|
|
13
25
|
|
|
26
|
+
### Inputs
|
|
14
27
|
|
|
15
28
|
- `carbon`: total carbon in gCO2eq (required)
|
|
16
29
|
- `functional-unit`: whatever `functional-unit` you define in global config also has to be present in each input, for example if you provide `functional-unit: requests` in global config, `requests` must be present in your input data.
|
|
@@ -19,7 +32,7 @@
|
|
|
19
32
|
|
|
20
33
|
- `sci`: carbon expressed in terms of the given functional unit
|
|
21
34
|
|
|
22
|
-
>Note: Plugin will warn and return `carbon` value in case if `functional-unit`'s value is zero.
|
|
35
|
+
> Note: Plugin will warn and return `carbon` value in case if `functional-unit`'s value is zero.
|
|
23
36
|
|
|
24
37
|
## Calculation
|
|
25
38
|
|
|
@@ -29,7 +42,6 @@ SCI is calculated as:
|
|
|
29
42
|
sci = carbon / functional unit
|
|
30
43
|
```
|
|
31
44
|
|
|
32
|
-
|
|
33
45
|
## IF Implementation
|
|
34
46
|
|
|
35
47
|
To run the plugin, you must first create an instance of `Sci`. Then, you can call `execute()` to return `sci`.
|
|
@@ -60,8 +72,6 @@ name: sci-demo
|
|
|
60
72
|
description: example invoking sci plugin
|
|
61
73
|
tags:
|
|
62
74
|
initialize:
|
|
63
|
-
outputs:
|
|
64
|
-
- yaml
|
|
65
75
|
plugins:
|
|
66
76
|
sci:
|
|
67
77
|
method: Sci
|
|
@@ -72,8 +82,8 @@ tree:
|
|
|
72
82
|
children:
|
|
73
83
|
child:
|
|
74
84
|
pipeline:
|
|
75
|
-
|
|
76
|
-
|
|
85
|
+
compute:
|
|
86
|
+
- sci
|
|
77
87
|
inputs:
|
|
78
88
|
- timestamp: 2023-07-06T00:00
|
|
79
89
|
carbon: 5
|
|
@@ -99,14 +109,14 @@ The results will be saved to a new `yaml` file.
|
|
|
99
109
|
This error arises when a necessary piece of input data is missing from the `inputs` array.
|
|
100
110
|
|
|
101
111
|
Every element in the `inputs` array must contain:
|
|
112
|
+
|
|
102
113
|
- `timestamp`
|
|
103
114
|
- `duration`
|
|
104
115
|
- `carbon`: a numeric value named `carbon` must exist in the inputs array
|
|
105
116
|
- whatever value you passed to `functional-unit`
|
|
106
117
|
|
|
107
|
-
|
|
108
118
|
### Validation errors
|
|
109
119
|
|
|
110
120
|
There is also a validation step that checks that the `functional-unit` was provided in the plugin config. If you see an error reporting this value as missing, please check you have provided it.
|
|
111
121
|
|
|
112
|
-
For more information on our error classes, please visit [our docs](https://if.greensoftware.foundation/reference/errors
|
|
122
|
+
For more information on our error classes, please visit [our docs](https://if.greensoftware.foundation/reference/errors)
|
|
@@ -10,6 +10,21 @@ Read more on [embodied carbon](https://github.com/Green-Software-Foundation/sci/
|
|
|
10
10
|
|
|
11
11
|
Not Needed
|
|
12
12
|
|
|
13
|
+
### Plugin parameter metadata
|
|
14
|
+
|
|
15
|
+
The `parameter-metadata` section contains information about `description`, `unit` and `aggregation-method` of the parameters of the inputs and outputs
|
|
16
|
+
|
|
17
|
+
- `inputs`: describe the parameters of the `inputs`. Each parameter has:
|
|
18
|
+
|
|
19
|
+
- `description`: description of the parameter
|
|
20
|
+
- `unit`: unit of the parameter
|
|
21
|
+
- `aggregation-method`: aggregation method of the parameter (it can be `sum`, `avg` or `none`)
|
|
22
|
+
|
|
23
|
+
- `outputs`: describe the `carbon-embodied` parameter. The parameter has the following attributes:
|
|
24
|
+
- `description`: description of the parameter
|
|
25
|
+
- `unit`: unit of the parameter
|
|
26
|
+
- `aggregation-method`: aggregation method of the parameter (it can be `sum`, `avg` or `none`)
|
|
27
|
+
|
|
13
28
|
### Inputs
|
|
14
29
|
|
|
15
30
|
- `device/emissions-embodied`: the sum of Life Cycle Assessment (LCA) emissions for the component
|
|
@@ -79,8 +94,6 @@ name: sci-embodied
|
|
|
79
94
|
description: simple demo invoking sci-embodied
|
|
80
95
|
tags:
|
|
81
96
|
initialize:
|
|
82
|
-
outputs:
|
|
83
|
-
- yaml
|
|
84
97
|
plugins:
|
|
85
98
|
sci-embodied:
|
|
86
99
|
method: SciEmbodied
|
|
@@ -89,7 +102,8 @@ tree:
|
|
|
89
102
|
children:
|
|
90
103
|
child:
|
|
91
104
|
pipeline:
|
|
92
|
-
|
|
105
|
+
compute:
|
|
106
|
+
- sci-embodied # duration & config -> embodied
|
|
93
107
|
defaults:
|
|
94
108
|
device/emissions-embodied: 1533.120 # gCO2eq
|
|
95
109
|
device/expected-lifespan: 3 # 3 years in seconds
|
|
@@ -109,7 +123,6 @@ if-run --manifest manifests/plugins/sci-embodied.yml --output manifests/outputs/
|
|
|
109
123
|
|
|
110
124
|
The results will be saved to a new `yaml` file in `./examples/outputs`.
|
|
111
125
|
|
|
112
|
-
|
|
113
126
|
## Errors
|
|
114
127
|
|
|
115
128
|
`SciEmbodied` uses one of IF's error classes
|
|
@@ -120,5 +133,4 @@ This error class is used to describe a problem with one of the input values to `
|
|
|
120
133
|
|
|
121
134
|
You will receive a specific error message explaining which parameter is problematic, and you can check and replace where appropriate.
|
|
122
135
|
|
|
123
|
-
|
|
124
136
|
For more information on our error classes, please visit [our docs](https://if.greensoftware.foundation/reference/errors
|