@grnsft/if 0.3.4 → 0.4.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.commitlintrc.js +0 -1
- package/.lintstagedrc.js +6 -0
- package/README.md +12 -8
- package/Refactor-migration-guide.md +6 -6
- package/build/builtins/coefficient/index.d.ts +3 -0
- package/build/builtins/coefficient/index.js +51 -0
- package/build/builtins/coefficient/types.d.ts +5 -0
- package/build/builtins/coefficient/types.js +3 -0
- package/build/builtins/csv-lookup/index.d.ts +2 -0
- package/build/builtins/csv-lookup/index.js +181 -0
- package/build/builtins/divide/index.d.ts +2 -0
- package/build/builtins/divide/index.js +67 -0
- package/build/builtins/exponent/index.d.ts +3 -0
- package/build/builtins/exponent/index.js +72 -0
- package/build/builtins/exponent/types.d.ts +5 -0
- package/build/builtins/exponent/types.js +3 -0
- package/build/builtins/export-csv-raw.js +4 -1
- package/build/builtins/export-csv.js +4 -1
- package/build/builtins/export-log.js +4 -2
- package/build/builtins/export-yaml.js +4 -1
- package/build/builtins/index.d.ts +13 -0
- package/build/builtins/index.js +28 -2
- package/build/builtins/interpolation/index.d.ts +2 -0
- package/build/builtins/interpolation/index.js +146 -0
- package/build/builtins/interpolation/types.d.ts +5 -0
- package/build/builtins/interpolation/types.js +10 -0
- package/build/builtins/mock-observations/helpers/common-generator.d.ts +3 -0
- package/build/builtins/mock-observations/helpers/common-generator.js +32 -0
- package/build/builtins/mock-observations/helpers/rand-int-generator.d.ts +3 -0
- package/build/builtins/mock-observations/helpers/rand-int-generator.js +58 -0
- package/build/builtins/mock-observations/index.d.ts +3 -0
- package/build/builtins/mock-observations/index.js +116 -0
- package/build/builtins/mock-observations/interfaces/index.d.ts +6 -0
- package/build/builtins/mock-observations/interfaces/index.js +3 -0
- package/build/builtins/mock-observations/types.d.ts +13 -0
- package/build/builtins/mock-observations/types.js +3 -0
- package/build/builtins/multiply/index.d.ts +3 -0
- package/build/builtins/multiply/index.js +63 -0
- package/build/builtins/multiply/types.d.ts +4 -0
- package/build/builtins/multiply/types.js +3 -0
- package/build/builtins/regex/index.d.ts +3 -0
- package/build/builtins/regex/index.js +78 -0
- package/build/builtins/sci/config.d.ts +1 -0
- package/build/builtins/sci/config.js +44 -0
- package/build/builtins/sci/index.d.ts +3 -0
- package/build/builtins/sci/index.js +69 -0
- package/build/builtins/sci-embodied/index.d.ts +2 -0
- package/build/builtins/sci-embodied/index.js +115 -0
- package/build/builtins/shell/index.d.ts +3 -0
- package/build/builtins/shell/index.js +58 -0
- package/build/builtins/subtract/index.d.ts +3 -0
- package/build/builtins/subtract/index.js +75 -0
- package/build/builtins/subtract/types.d.ts +4 -0
- package/build/builtins/subtract/types.js +3 -0
- package/build/builtins/sum/index.d.ts +3 -0
- package/build/builtins/sum/index.js +61 -0
- package/build/builtins/sum/types.d.ts +4 -0
- package/build/builtins/sum/types.js +3 -0
- package/build/config/config.d.ts +8 -2
- package/build/config/config.js +34 -1
- package/build/config/strings.d.ts +22 -0
- package/build/config/strings.js +23 -1
- package/build/diff.d.ts +2 -0
- package/build/diff.js +41 -0
- package/build/index.js +8 -4
- package/build/lib/aggregate.js +5 -1
- package/build/lib/compare.d.ts +10 -0
- package/build/lib/compare.js +56 -0
- package/build/lib/compute.js +9 -1
- package/build/lib/environment.js +9 -3
- package/build/lib/exhaust.js +3 -2
- package/build/lib/initialize.js +5 -2
- package/build/lib/load.d.ts +48 -0
- package/build/lib/load.js +51 -2
- package/build/lib/parameterize.js +8 -4
- package/build/types/common.d.ts +4 -0
- package/build/types/common.js +3 -0
- package/build/types/helpers.d.ts +4 -0
- package/build/types/helpers.js +3 -0
- package/build/types/interface.d.ts +2 -1
- package/build/types/interface.js +1 -1
- package/build/types/lib/compare.d.ts +7 -0
- package/build/types/lib/compare.js +3 -0
- package/build/types/process-args.d.ts +7 -1
- package/build/types/process-args.js +1 -1
- package/build/types/util/args.d.ts +4 -0
- package/build/types/util/args.js +3 -0
- package/build/util/args.d.ts +7 -2
- package/build/util/args.js +49 -11
- package/build/util/debug-logger.d.ts +4 -0
- package/build/util/debug-logger.js +117 -0
- package/build/util/errors.d.ts +1 -1
- package/build/util/errors.js +6 -1
- package/build/util/helpers.d.ts +23 -0
- package/build/util/helpers.js +116 -2
- package/build/util/log-memoize.d.ts +1 -1
- package/build/util/log-memoize.js +1 -1
- package/build/util/validations.d.ts +59 -51
- package/build/util/validations.js +49 -18
- package/github-processes.md +16 -42
- package/manifests/bugs/aggregation-error-wrong-metric.yml +6 -6
- package/manifests/bugs/azure-importer-ignoring-defaults.yml +3 -3
- package/manifests/bugs/azure-importer-incorrect-calculation.yml +2 -2
- package/manifests/bugs/mock-observations-failure-duration-is-zero.yml +34 -0
- package/manifests/bugs/pipeline-error-uninitialized-plugin.yml +1 -1
- package/manifests/bugs/pipeline-ordering-error.yml +6 -6
- package/manifests/bugs/sci-embodied-missing-resources-total.yml +23 -0
- package/manifests/examples/generics.yml +3 -3
- package/manifests/examples/instance-metadata.yml +36 -0
- package/manifests/examples/mock-cpu-util-to-carbon.yml +3 -3
- package/manifests/examples/nesting.yml +37 -10
- package/manifests/examples/pipeline-teads-sci.yml +17 -9
- package/manifests/examples/pipeline-with-aggregate.yml +24 -9
- package/manifests/examples/pipeline-with-mocks.yml +26 -9
- package/manifests/examples/sci.yml +131 -0
- package/manifests/examples/teads-curve.yml +78 -0
- package/manifests/features/aggregate-failure-inalid-metrics.yml +43 -0
- package/manifests/features/aggregate-failure-missing-metric-in-inputs.yml +43 -0
- package/manifests/integrations/cloud-metadata-divide-boavizta.yml +1 -1
- package/manifests/integrations/mock-obs-group-by-cloud-meta.yml +51 -0
- package/manifests/integrations/mock-obs-groupby.yml +2 -2
- package/manifests/integrations/mock-obs-time-sync.yml +1 -1
- package/manifests/plugins/cloud-metadata/failure-invalid-instance-type.yaml +21 -0
- package/manifests/plugins/cloud-metadata/failure-invalid-vendor.yaml +1 -1
- package/manifests/plugins/cloud-metadata/failure-missing-cloud-vendor.yml +21 -0
- package/manifests/plugins/cloud-metadata/success.yml +1 -1
- package/manifests/plugins/coefficient/failure-invalid-config-input-param.yml +1 -1
- package/manifests/plugins/coefficient/failure-output-param-is-null.yaml +24 -0
- package/manifests/plugins/coefficient/success.yml +1 -1
- package/manifests/plugins/csv-lookup/failure-missing-column.yml +26 -0
- package/manifests/plugins/csv-lookup/failure-missing-output.yml +26 -0
- package/manifests/plugins/csv-lookup/success-renaming.yml +26 -0
- package/manifests/plugins/csv-lookup/success.yml +26 -0
- package/manifests/plugins/divide/failure-denominator-equal-zero.yml +39 -0
- package/manifests/plugins/divide/failure-invalid-config-denominator.yml +1 -1
- package/manifests/plugins/divide/failure-missing-numerator.yml +39 -0
- package/manifests/plugins/divide/success.yml +2 -2
- package/manifests/plugins/groupby/failure-missing-cloud-instance-type.yml +49 -0
- package/manifests/plugins/interpolation/interpolation.yml +24 -0
- package/manifests/plugins/mock-observations/failure-invalid-config-cpu-range.yml +1 -1
- package/manifests/plugins/mock-observations/failure-invalid-memory-utilization-range.yml +34 -0
- package/manifests/plugins/mock-observations/failure-missing-timestamp-from-param.yml +34 -0
- package/manifests/plugins/mock-observations/success.yml +2 -2
- package/manifests/plugins/multiply/failure-input-parameter-is-missing.yml +1 -1
- package/manifests/plugins/multiply/success-with-multiple-inputs.yml +32 -0
- package/manifests/plugins/multiply/success.yml +3 -3
- package/manifests/plugins/regex/failure-missing-input-param.yml +1 -1
- package/manifests/plugins/regex/failure-not-matching-with-regex.yml +24 -0
- package/manifests/plugins/regex/success.yml +2 -2
- package/manifests/plugins/sci/failure-invalid-config-value.yml +2 -3
- package/manifests/plugins/sci/failure-missing-input-param.yml +27 -0
- package/manifests/plugins/sci/success.yml +5 -4
- package/manifests/plugins/{sci-m → sci-embodied}/failure-invalid-default-emission-value.yml +5 -6
- package/manifests/plugins/sci-embodied/failure-missing-expected-lifespan.yml +23 -0
- package/manifests/plugins/{sci-m → sci-embodied}/success.yml +5 -6
- package/manifests/plugins/shell/failure-invalid-command.yml +1 -1
- package/manifests/plugins/shell/success.yml +1 -2
- package/manifests/plugins/sum/failure-missing-input-param.yml +1 -1
- package/manifests/plugins/sum/failure-missing-output-param.yml +28 -0
- package/manifests/plugins/sum/success.yml +1 -1
- package/manifests/plugins/tdp-finder/failure-unsupported-physical-processor.yml +19 -0
- package/manifests/plugins/time-sync/failure-missing-global-config.yml +34 -0
- package/package.json +10 -2
- package/src/builtins/README.md +5 -5
- package/src/builtins/coefficient/README.md +92 -0
- package/src/builtins/csv-lookup/README.md +142 -0
- package/src/builtins/divide/README.md +95 -0
- package/src/builtins/exponent/README.md +97 -0
- package/src/builtins/interpolation/README.md +168 -0
- package/src/builtins/mock-observations/README.md +97 -0
- package/src/builtins/multiply/README.md +94 -0
- package/src/builtins/regex/README.md +91 -0
- package/src/builtins/sci/README.md +89 -0
- package/src/builtins/sci-embodied/README.md +110 -0
- package/src/builtins/shell/README.md +130 -0
- package/src/builtins/subtract/README.md +94 -0
- package/src/builtins/sum/README.md +91 -0
- package/.env +0 -5
- package/coverage/clover.xml +0 -1590
- package/coverage/coverage-final.json +0 -50
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/builtins/coefficient/index.html +0 -116
- package/coverage/lcov-report/builtins/coefficient/index.ts.html +0 -295
- package/coverage/lcov-report/builtins/csv-lookup/index.html +0 -116
- package/coverage/lcov-report/builtins/csv-lookup/index.ts.html +0 -832
- package/coverage/lcov-report/builtins/divide/index.html +0 -116
- package/coverage/lcov-report/builtins/divide/index.ts.html +0 -361
- package/coverage/lcov-report/builtins/exponent/index.html +0 -116
- package/coverage/lcov-report/builtins/exponent/index.ts.html +0 -355
- package/coverage/lcov-report/builtins/export-csv-raw.ts.html +0 -553
- package/coverage/lcov-report/builtins/export-csv.ts.html +0 -433
- package/coverage/lcov-report/builtins/export-log.ts.html +0 -145
- package/coverage/lcov-report/builtins/export-yaml.ts.html +0 -184
- package/coverage/lcov-report/builtins/group-by.ts.html +0 -364
- package/coverage/lcov-report/builtins/index.html +0 -206
- package/coverage/lcov-report/builtins/index.ts.html +0 -130
- package/coverage/lcov-report/builtins/interpolation/index.html +0 -131
- package/coverage/lcov-report/builtins/interpolation/index.ts.html +0 -670
- package/coverage/lcov-report/builtins/interpolation/types.ts.html +0 -100
- package/coverage/lcov-report/builtins/mock-observations/helpers/common-generator.ts.html +0 -181
- package/coverage/lcov-report/builtins/mock-observations/helpers/index.html +0 -131
- package/coverage/lcov-report/builtins/mock-observations/helpers/rand-int-generator.ts.html +0 -295
- package/coverage/lcov-report/builtins/mock-observations/index.html +0 -116
- package/coverage/lcov-report/builtins/mock-observations/index.ts.html +0 -613
- package/coverage/lcov-report/builtins/multiply/index.html +0 -116
- package/coverage/lcov-report/builtins/multiply/index.ts.html +0 -337
- package/coverage/lcov-report/builtins/regex/index.html +0 -116
- package/coverage/lcov-report/builtins/regex/index.ts.html +0 -379
- package/coverage/lcov-report/builtins/sci/config.ts.html +0 -205
- package/coverage/lcov-report/builtins/sci/index.html +0 -116
- package/coverage/lcov-report/builtins/sci/index.ts.html +0 -331
- package/coverage/lcov-report/builtins/sci-embodied/index.html +0 -116
- package/coverage/lcov-report/builtins/sci-embodied/index.ts.html +0 -481
- package/coverage/lcov-report/builtins/shell/index.html +0 -116
- package/coverage/lcov-report/builtins/shell/index.ts.html +0 -283
- package/coverage/lcov-report/builtins/subtract/index.html +0 -116
- package/coverage/lcov-report/builtins/subtract/index.ts.html +0 -373
- package/coverage/lcov-report/builtins/sum/index.html +0 -116
- package/coverage/lcov-report/builtins/sum/index.ts.html +0 -340
- package/coverage/lcov-report/builtins/time-sync.ts.html +0 -1459
- package/coverage/lcov-report/config/config.ts.html +0 -334
- package/coverage/lcov-report/config/index.html +0 -161
- package/coverage/lcov-report/config/index.ts.html +0 -94
- package/coverage/lcov-report/config/params.ts.html +0 -697
- package/coverage/lcov-report/config/strings.ts.html +0 -415
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -386
- package/coverage/lcov-report/lib/aggregate.ts.html +0 -331
- package/coverage/lcov-report/lib/compare.ts.html +0 -283
- package/coverage/lcov-report/lib/compute.ts.html +0 -391
- package/coverage/lcov-report/lib/environment.ts.html +0 -343
- package/coverage/lcov-report/lib/exhaust.ts.html +0 -283
- package/coverage/lcov-report/lib/index.html +0 -221
- package/coverage/lcov-report/lib/initialize.ts.html +0 -388
- package/coverage/lcov-report/lib/load.ts.html +0 -268
- package/coverage/lcov-report/lib/parameterize.ts.html +0 -283
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov-report/types/aggregation.ts.html +0 -94
- package/coverage/lcov-report/types/index.html +0 -146
- package/coverage/lcov-report/types/interface.ts.html +0 -181
- package/coverage/lcov-report/types/parameters.ts.html +0 -106
- package/coverage/lcov-report/util/aggregation-helper.ts.html +0 -286
- package/coverage/lcov-report/util/args.ts.html +0 -508
- package/coverage/lcov-report/util/errors.ts.html +0 -232
- package/coverage/lcov-report/util/helpers.ts.html +0 -613
- package/coverage/lcov-report/util/index.html +0 -266
- package/coverage/lcov-report/util/json.ts.html +0 -115
- package/coverage/lcov-report/util/log-memoize.ts.html +0 -145
- package/coverage/lcov-report/util/logger.ts.html +0 -151
- package/coverage/lcov-report/util/os-checker.ts.html +0 -421
- package/coverage/lcov-report/util/plugin-storage.ts.html +0 -199
- package/coverage/lcov-report/util/validations.ts.html +0 -526
- package/coverage/lcov-report/util/yaml.ts.html +0 -193
- package/coverage/lcov.info +0 -2811
- package/src/__tests__/integration/manifest/sci-e.yaml +0 -23
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { ZodSchema, z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* At least one property defined handler.
|
|
4
|
+
*/
|
|
5
|
+
export declare const atLeastOneDefined: (obj: Record<string | number | symbol, unknown>) => boolean;
|
|
6
|
+
/**
|
|
7
|
+
* All properties are defined handler.
|
|
8
|
+
*/
|
|
9
|
+
export declare const allDefined: (obj: Record<string | number | symbol, unknown>) => boolean;
|
|
2
10
|
/**
|
|
3
11
|
* Validation schema for manifests.
|
|
4
12
|
*/
|
|
@@ -74,9 +82,9 @@ export declare const manifestSchema: z.ZodObject<{
|
|
|
74
82
|
}>;
|
|
75
83
|
outputs?: string[] | undefined;
|
|
76
84
|
}>;
|
|
77
|
-
execution: z.ZodObject<{
|
|
78
|
-
command: z.ZodString
|
|
79
|
-
environment: z.ZodObject<{
|
|
85
|
+
execution: z.ZodOptional<z.ZodObject<{
|
|
86
|
+
command: z.ZodOptional<z.ZodString>;
|
|
87
|
+
environment: z.ZodOptional<z.ZodObject<{
|
|
80
88
|
'if-version': z.ZodString;
|
|
81
89
|
os: z.ZodString;
|
|
82
90
|
'os-version': z.ZodString;
|
|
@@ -97,34 +105,34 @@ export declare const manifestSchema: z.ZodObject<{
|
|
|
97
105
|
'node-version': string;
|
|
98
106
|
'date-time': string;
|
|
99
107
|
dependencies: string[];
|
|
100
|
-
}
|
|
108
|
+
}>>;
|
|
101
109
|
status: z.ZodString;
|
|
102
110
|
error: z.ZodOptional<z.ZodString>;
|
|
103
111
|
}, "strip", z.ZodTypeAny, {
|
|
104
112
|
status: string;
|
|
105
|
-
command
|
|
106
|
-
environment
|
|
113
|
+
command?: string | undefined;
|
|
114
|
+
environment?: {
|
|
107
115
|
'if-version': string;
|
|
108
116
|
os: string;
|
|
109
117
|
'os-version': string;
|
|
110
118
|
'node-version': string;
|
|
111
119
|
'date-time': string;
|
|
112
120
|
dependencies: string[];
|
|
113
|
-
};
|
|
121
|
+
} | undefined;
|
|
114
122
|
error?: string | undefined;
|
|
115
123
|
}, {
|
|
116
124
|
status: string;
|
|
117
|
-
command
|
|
118
|
-
environment
|
|
125
|
+
command?: string | undefined;
|
|
126
|
+
environment?: {
|
|
119
127
|
'if-version': string;
|
|
120
128
|
os: string;
|
|
121
129
|
'os-version': string;
|
|
122
130
|
'node-version': string;
|
|
123
131
|
'date-time': string;
|
|
124
132
|
dependencies: string[];
|
|
125
|
-
};
|
|
133
|
+
} | undefined;
|
|
126
134
|
error?: string | undefined;
|
|
127
|
-
}
|
|
135
|
+
}>>;
|
|
128
136
|
tree: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
129
137
|
}, "strip", z.ZodTypeAny, {
|
|
130
138
|
name: string;
|
|
@@ -136,19 +144,6 @@ export declare const manifestSchema: z.ZodObject<{
|
|
|
136
144
|
}>;
|
|
137
145
|
outputs?: string[] | undefined;
|
|
138
146
|
};
|
|
139
|
-
execution: {
|
|
140
|
-
status: string;
|
|
141
|
-
command: string;
|
|
142
|
-
environment: {
|
|
143
|
-
'if-version': string;
|
|
144
|
-
os: string;
|
|
145
|
-
'os-version': string;
|
|
146
|
-
'node-version': string;
|
|
147
|
-
'date-time': string;
|
|
148
|
-
dependencies: string[];
|
|
149
|
-
};
|
|
150
|
-
error?: string | undefined;
|
|
151
|
-
};
|
|
152
147
|
tree: Record<string, any>;
|
|
153
148
|
description?: string | null | undefined;
|
|
154
149
|
tags?: {
|
|
@@ -166,6 +161,19 @@ export declare const manifestSchema: z.ZodObject<{
|
|
|
166
161
|
aggregation: "sum" | "none" | "avg";
|
|
167
162
|
unit: string;
|
|
168
163
|
}[] | null | undefined;
|
|
164
|
+
execution?: {
|
|
165
|
+
status: string;
|
|
166
|
+
command?: string | undefined;
|
|
167
|
+
environment?: {
|
|
168
|
+
'if-version': string;
|
|
169
|
+
os: string;
|
|
170
|
+
'os-version': string;
|
|
171
|
+
'node-version': string;
|
|
172
|
+
'date-time': string;
|
|
173
|
+
dependencies: string[];
|
|
174
|
+
} | undefined;
|
|
175
|
+
error?: string | undefined;
|
|
176
|
+
} | undefined;
|
|
169
177
|
}, {
|
|
170
178
|
name: string;
|
|
171
179
|
initialize: {
|
|
@@ -176,19 +184,6 @@ export declare const manifestSchema: z.ZodObject<{
|
|
|
176
184
|
}>;
|
|
177
185
|
outputs?: string[] | undefined;
|
|
178
186
|
};
|
|
179
|
-
execution: {
|
|
180
|
-
status: string;
|
|
181
|
-
command: string;
|
|
182
|
-
environment: {
|
|
183
|
-
'if-version': string;
|
|
184
|
-
os: string;
|
|
185
|
-
'os-version': string;
|
|
186
|
-
'node-version': string;
|
|
187
|
-
'date-time': string;
|
|
188
|
-
dependencies: string[];
|
|
189
|
-
};
|
|
190
|
-
error?: string | undefined;
|
|
191
|
-
};
|
|
192
187
|
tree: Record<string, any>;
|
|
193
188
|
description?: string | null | undefined;
|
|
194
189
|
tags?: {
|
|
@@ -206,6 +201,19 @@ export declare const manifestSchema: z.ZodObject<{
|
|
|
206
201
|
aggregation: "sum" | "none" | "avg";
|
|
207
202
|
unit: string;
|
|
208
203
|
}[] | null | undefined;
|
|
204
|
+
execution?: {
|
|
205
|
+
status: string;
|
|
206
|
+
command?: string | undefined;
|
|
207
|
+
environment?: {
|
|
208
|
+
'if-version': string;
|
|
209
|
+
os: string;
|
|
210
|
+
'os-version': string;
|
|
211
|
+
'node-version': string;
|
|
212
|
+
'date-time': string;
|
|
213
|
+
dependencies: string[];
|
|
214
|
+
} | undefined;
|
|
215
|
+
error?: string | undefined;
|
|
216
|
+
} | undefined;
|
|
209
217
|
}>;
|
|
210
218
|
/**
|
|
211
219
|
* Validates given `manifest` object to match pattern.
|
|
@@ -220,19 +228,6 @@ export declare const validateManifest: (manifest: any) => {
|
|
|
220
228
|
}>;
|
|
221
229
|
outputs?: string[] | undefined;
|
|
222
230
|
};
|
|
223
|
-
execution: {
|
|
224
|
-
status: string;
|
|
225
|
-
command: string;
|
|
226
|
-
environment: {
|
|
227
|
-
'if-version': string;
|
|
228
|
-
os: string;
|
|
229
|
-
'os-version': string;
|
|
230
|
-
'node-version': string;
|
|
231
|
-
'date-time': string;
|
|
232
|
-
dependencies: string[];
|
|
233
|
-
};
|
|
234
|
-
error?: string | undefined;
|
|
235
|
-
};
|
|
236
231
|
tree: Record<string, any>;
|
|
237
232
|
description?: string | null | undefined;
|
|
238
233
|
tags?: {
|
|
@@ -250,8 +245,21 @@ export declare const validateManifest: (manifest: any) => {
|
|
|
250
245
|
aggregation: "sum" | "none" | "avg";
|
|
251
246
|
unit: string;
|
|
252
247
|
}[] | null | undefined;
|
|
248
|
+
execution?: {
|
|
249
|
+
status: string;
|
|
250
|
+
command?: string | undefined;
|
|
251
|
+
environment?: {
|
|
252
|
+
'if-version': string;
|
|
253
|
+
os: string;
|
|
254
|
+
'os-version': string;
|
|
255
|
+
'node-version': string;
|
|
256
|
+
'date-time': string;
|
|
257
|
+
dependencies: string[];
|
|
258
|
+
} | undefined;
|
|
259
|
+
error?: string | undefined;
|
|
260
|
+
} | undefined;
|
|
253
261
|
};
|
|
254
262
|
/**
|
|
255
263
|
* Validates given `object` with given `schema`.
|
|
256
264
|
*/
|
|
257
|
-
export declare const validate: <T>(schema: ZodSchema<T, z.ZodTypeDef, T>, object: any, errorConstructor?: ErrorConstructor) => T;
|
|
265
|
+
export declare const validate: <T>(schema: ZodSchema<T, z.ZodTypeDef, T>, object: any, index?: number, errorConstructor?: ErrorConstructor) => T;
|
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.validate = exports.validateManifest = exports.manifestSchema = void 0;
|
|
3
|
+
exports.validate = exports.validateManifest = exports.manifestSchema = exports.allDefined = exports.atLeastOneDefined = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const errors_1 = require("./errors");
|
|
6
6
|
const aggregation_1 = require("../types/aggregation");
|
|
7
7
|
const parameters_1 = require("../types/parameters");
|
|
8
|
+
const strings_1 = require("../config/strings");
|
|
8
9
|
const { ManifestValidationError, InputValidationError } = errors_1.ERRORS;
|
|
10
|
+
const { VALIDATING_MANIFEST } = strings_1.STRINGS;
|
|
11
|
+
/**
|
|
12
|
+
* At least one property defined handler.
|
|
13
|
+
*/
|
|
14
|
+
const atLeastOneDefined = (obj) => Object.values(obj).some(v => v !== undefined);
|
|
15
|
+
exports.atLeastOneDefined = atLeastOneDefined;
|
|
16
|
+
/**
|
|
17
|
+
* All properties are defined handler.
|
|
18
|
+
*/
|
|
19
|
+
const allDefined = (obj) => Object.values(obj).every(v => v !== undefined);
|
|
20
|
+
exports.allDefined = allDefined;
|
|
9
21
|
/**
|
|
10
22
|
* Validation schema for manifests.
|
|
11
23
|
*/
|
|
@@ -44,50 +56,69 @@ exports.manifestSchema = zod_1.z.object({
|
|
|
44
56
|
})),
|
|
45
57
|
outputs: zod_1.z.array(zod_1.z.string()).optional(),
|
|
46
58
|
}),
|
|
47
|
-
execution: zod_1.z
|
|
48
|
-
|
|
49
|
-
|
|
59
|
+
execution: zod_1.z
|
|
60
|
+
.object({
|
|
61
|
+
command: zod_1.z.string().optional(),
|
|
62
|
+
environment: zod_1.z
|
|
63
|
+
.object({
|
|
50
64
|
'if-version': zod_1.z.string(),
|
|
51
65
|
os: zod_1.z.string(),
|
|
52
66
|
'os-version': zod_1.z.string(),
|
|
53
67
|
'node-version': zod_1.z.string(),
|
|
54
68
|
'date-time': zod_1.z.string(),
|
|
55
69
|
dependencies: zod_1.z.array(zod_1.z.string()),
|
|
56
|
-
})
|
|
70
|
+
})
|
|
71
|
+
.optional(),
|
|
57
72
|
status: zod_1.z.string(),
|
|
58
73
|
error: zod_1.z.string().optional(),
|
|
59
|
-
})
|
|
74
|
+
})
|
|
75
|
+
.optional(),
|
|
60
76
|
tree: zod_1.z.record(zod_1.z.string(), zod_1.z.any()),
|
|
61
77
|
});
|
|
62
78
|
/**
|
|
63
79
|
* Validates given `manifest` object to match pattern.
|
|
64
80
|
*/
|
|
65
|
-
const validateManifest = (manifest) =>
|
|
81
|
+
const validateManifest = (manifest) => {
|
|
82
|
+
console.debug(VALIDATING_MANIFEST);
|
|
83
|
+
return (0, exports.validate)(exports.manifestSchema, manifest, undefined, ManifestValidationError);
|
|
84
|
+
};
|
|
66
85
|
exports.validateManifest = validateManifest;
|
|
67
86
|
/**
|
|
68
87
|
* Validates given `object` with given `schema`.
|
|
69
88
|
*/
|
|
70
|
-
const validate = (schema, object, errorConstructor = InputValidationError) => {
|
|
89
|
+
const validate = (schema, object, index, errorConstructor = InputValidationError) => {
|
|
71
90
|
const validationResult = schema.safeParse(object);
|
|
72
91
|
if (!validationResult.success) {
|
|
73
|
-
throw new errorConstructor(prettifyErrorMessage(validationResult.error.message));
|
|
92
|
+
throw new errorConstructor(prettifyErrorMessage(validationResult.error.message, index));
|
|
74
93
|
}
|
|
75
94
|
return validationResult.data;
|
|
76
95
|
};
|
|
77
96
|
exports.validate = validate;
|
|
78
97
|
/**
|
|
79
|
-
*
|
|
98
|
+
* Error message formatter for zod issues.
|
|
80
99
|
*/
|
|
81
|
-
const prettifyErrorMessage = (issues) => {
|
|
100
|
+
const prettifyErrorMessage = (issues, index) => {
|
|
82
101
|
const issuesArray = JSON.parse(issues);
|
|
83
102
|
return issuesArray.map((issue) => {
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
const
|
|
87
|
-
if (code ===
|
|
88
|
-
|
|
103
|
+
const code = issue.code;
|
|
104
|
+
let { path, message } = issue;
|
|
105
|
+
const indexErrorMessage = index !== undefined ? ` at index ${index}` : '';
|
|
106
|
+
if (issue.code === zod_1.ZodIssueCode.invalid_union) {
|
|
107
|
+
message = issue.unionErrors[0].issues[0].message;
|
|
108
|
+
path = issue.unionErrors[0].issues[0].path;
|
|
109
|
+
}
|
|
110
|
+
const fullPath = flattenPath(path);
|
|
111
|
+
if (!fullPath) {
|
|
112
|
+
return message;
|
|
89
113
|
}
|
|
90
|
-
return `"${fullPath}" parameter is ${message.toLowerCase()}. Error code: ${code}.`;
|
|
114
|
+
return `"${fullPath}" parameter is ${message.toLowerCase()}${indexErrorMessage}. Error code: ${code}.`;
|
|
91
115
|
});
|
|
92
116
|
};
|
|
93
|
-
|
|
117
|
+
/**
|
|
118
|
+
* Flattens an array representing a nested path into a string.
|
|
119
|
+
*/
|
|
120
|
+
const flattenPath = (path) => {
|
|
121
|
+
const flattenPath = path.map(part => typeof part === 'number' ? `[${part}]` : part);
|
|
122
|
+
return flattenPath.join('.');
|
|
123
|
+
};
|
|
124
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmFsaWRhdGlvbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdXRpbC92YWxpZGF0aW9ucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSw2QkFBeUQ7QUFFekQscUNBQWdDO0FBRWhDLHNEQUF5RDtBQUN6RCxvREFBc0Q7QUFFdEQsK0NBQTBDO0FBRTFDLE1BQU0sRUFBQyx1QkFBdUIsRUFBRSxvQkFBb0IsRUFBQyxHQUFHLGVBQU0sQ0FBQztBQUMvRCxNQUFNLEVBQUMsbUJBQW1CLEVBQUMsR0FBRyxpQkFBTyxDQUFDO0FBQ3RDOztHQUVHO0FBQ0ksTUFBTSxpQkFBaUIsR0FBRyxDQUMvQixHQUE4QyxFQUM5QyxFQUFFLENBQUMsTUFBTSxDQUFDLE1BQU0sQ0FBQyxHQUFHLENBQUMsQ0FBQyxJQUFJLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLEtBQUssU0FBUyxDQUFDLENBQUM7QUFGdEMsUUFBQSxpQkFBaUIscUJBRXFCO0FBRW5EOztHQUVHO0FBQ0ksTUFBTSxVQUFVLEdBQUcsQ0FBQyxHQUE4QyxFQUFFLEVBQUUsQ0FDM0UsTUFBTSxDQUFDLE1BQU0sQ0FBQyxHQUFHLENBQUMsQ0FBQyxLQUFLLENBQUMsQ0FBQyxDQUFDLEVBQUUsQ0FBQyxDQUFDLEtBQUssU0FBUyxDQUFDLENBQUM7QUFEcEMsUUFBQSxVQUFVLGNBQzBCO0FBRWpEOztHQUVHO0FBQ1UsUUFBQSxjQUFjLEdBQUcsT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ubnVsbGFibGUoKSxcbiAgcGFyYW1zOiB6XG4gICAgLmFycmF5KFxuICAgICAgei5vYmplY3Qoe1xuICAgICAgICBuYW1lOiB6LnN0cmluZygpLFxuICAgICAgICBkZXNjcmlwdGlvbjogei5zdHJpbmcoKSxcbiAgICAgICAgYWdncmVnYXRpb246IHouZW51bShBR0dSRUdBVElPTl9UWVBFUyksXG4gICAgICAgIHVuaXQ6IHouc3RyaW5nKCksXG4gICAgICB9KVxuICAgIClcbiAgICAub3B0aW9uYWwoKVxuICAgIC5udWxsYWJsZSgpLFxuICBpbml0aWFsaXplOiB6Lm9iamVjdCh7XG4gICAgcGx1Z2luczogei5yZWNvcmQoXG4gICAgICB6LnN0cmluZygpLFxuICAgICAgei5vYmplY3Qoe1xuICAgICAgICBwYXRoOiB6LnN0cmluZygpLFxuICAgICAgICBtZXRob2Q6IHouc3RyaW5nKCksXG4gICAgICAgICdnbG9iYWwtY29uZmlnJzogei5yZWNvcmQoei5zdHJpbmcoKSwgei5hbnkoKSkub3B0aW9uYWwoKSxcbiAgICAgIH0pXG4gICAgKSxcbiAgICBvdXRwdXRzOiB6LmFycmF5KHouc3RyaW5nKCkpLm9wdGlvbmFsKCksXG4gIH0pLFxuICBleGVjdXRpb246IHpcbiAgICAub2JqZWN0KHtcbiAgICAgIGNvbW1hbmQ6IHouc3RyaW5nKCkub3B0aW9uYWwoKSxcbiAgICAgIGVudmlyb25tZW50OiB6XG4gICAgICAgIC5vYmplY3Qoe1xuICAgICAgICAgICdpZi12ZXJzaW9uJzogei5zdHJpbmcoKSxcbiAgICAgICAgICBvczogei5zdHJpbmcoKSxcbiAgICAgICAgICAnb3MtdmVyc2lvbic6IHouc3RyaW5nKCksXG4gICAgICAgICAgJ25vZGUtdmVyc2lvbic6IHouc3RyaW5nKCksXG4gICAgICAgICAgJ2RhdGUtdGltZSc6IHouc3RyaW5nKCksXG4gICAgICAgICAgZGVwZW5kZW5jaWVzOiB6LmFycmF5KHouc3RyaW5nKCkpLFxu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ciBjb2RlOiAke2NvZGV9LmA7XG4gIH0pO1xufTtcblxuLyoqXG4gKiBGbGF0dGVucyBhbiBhcnJheSByZXByZXNlbnRpbmcgYSBuZXN0ZWQgcGF0aCBpbnRvIGEgc3RyaW5nLlxuICovXG5jb25zdCBmbGF0dGVuUGF0aCA9IChwYXRoOiAoc3RyaW5nIHwgbnVtYmVyKVtdKTogc3RyaW5nID0+IHtcbiAgY29uc3QgZmxhdHRlblBhdGggPSBwYXRoLm1hcChwYXJ0ID0+XG4gICAgdHlwZW9mIHBhcnQgPT09ICdudW1iZXInID8gYFske3BhcnR9XWAgOiBwYXJ0XG4gICk7XG4gIHJldHVybiBmbGF0dGVuUGF0aC5qb2luKCcuJyk7XG59O1xuIl19
|
package/github-processes.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
- [`if`](https://github.com/Green-Software-Foundation/if)
|
|
5
5
|
- source code for the IF
|
|
6
|
-
- [`if-plugins`](https://github.com/Green-Software-Foundation/if-plugins)
|
|
6
|
+
- [`if-plugins`](https://github.com/Green-Software-Foundation/if-plugins) **DEPRECATED**
|
|
7
7
|
- source code for standard library of plugins
|
|
8
8
|
- IF core team commit to maintaining these plugins
|
|
9
9
|
- [`if-unofficial-plugins`](https://github.com/Green-Software-Foundation/if-unofficial-plugins)
|
|
@@ -110,47 +110,21 @@ We intend to respond to new PRs and issues within 3 days of the ticket being ope
|
|
|
110
110
|
|
|
111
111
|
## Labels
|
|
112
112
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
other
|
|
129
|
-
|
|
130
|
-
// size labels
|
|
131
|
-
small
|
|
132
|
-
medium
|
|
133
|
-
large
|
|
134
|
-
|
|
135
|
-
// priority labels
|
|
136
|
-
high-priority
|
|
137
|
-
med-priority
|
|
138
|
-
low-priority
|
|
139
|
-
|
|
140
|
-
//delay explanation labels
|
|
141
|
-
abandoned
|
|
142
|
-
blocked
|
|
143
|
-
backlogged
|
|
144
|
-
|
|
145
|
-
// other labels
|
|
146
|
-
project-management
|
|
147
|
-
agenda
|
|
148
|
-
discussion
|
|
149
|
-
help-wanted
|
|
150
|
-
good-first-issue
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
Each PR is expected to have one label from each category (except `other`) assigned to it at all times.
|
|
113
|
+
| Label | Used by | Description |
|
|
114
|
+
| ---------------- | --------- | ------------------------------------------------------------------------------------------ |
|
|
115
|
+
| blocked | all | The issue is blocked and cannot proceed. |
|
|
116
|
+
| bug | all | Error, flaw or fault |
|
|
117
|
+
| core-only | all | This issue is reserved for the IF core team only |
|
|
118
|
+
| draft | all | The issue is still being written, no need to respond or action on anything. |
|
|
119
|
+
| good-first-issue | all | This issue is a good one for someone looking to get involved with this project/initiative. |
|
|
120
|
+
| help-wanted | all | This issue can be picked up by anyone in the community |
|
|
121
|
+
| needs-response | all | The issue has stalled because someone isn’t responding. |
|
|
122
|
+
| agenda | core team | Use for any meeting agenda or minutes issue. |
|
|
123
|
+
| EPIC | core team | Used to denote an issue that represents a whole epic |
|
|
124
|
+
| initiative | core team | A helper label, needed for GSF internal processes |
|
|
125
|
+
| i-summary | core team | A helper label, needed for GSF internal processes |
|
|
126
|
+
| i-milestone | core team | A helper label, needed for GSF internal processes |
|
|
127
|
+
| project-update | core team | Used to flag project progress updates |
|
|
154
128
|
|
|
155
129
|
|
|
156
130
|
## Releases
|
|
@@ -15,14 +15,14 @@ initialize:
|
|
|
15
15
|
"sci-e":
|
|
16
16
|
path: "@grnsft/if-plugins"
|
|
17
17
|
method: SciE
|
|
18
|
-
"sci-
|
|
19
|
-
path: "
|
|
20
|
-
method:
|
|
18
|
+
"sci-embodied":
|
|
19
|
+
path: "builtin"
|
|
20
|
+
method: SciEmbodied
|
|
21
21
|
"sci-o":
|
|
22
22
|
path: "@grnsft/if-plugins"
|
|
23
23
|
method: SciO
|
|
24
24
|
"sci":
|
|
25
|
-
path: "
|
|
25
|
+
path: "builtin"
|
|
26
26
|
method: Sci
|
|
27
27
|
global-config:
|
|
28
28
|
functional-unit: "requests"
|
|
@@ -44,7 +44,7 @@ tree:
|
|
|
44
44
|
pipeline:
|
|
45
45
|
- teads-curve
|
|
46
46
|
- sci-e
|
|
47
|
-
- sci-
|
|
47
|
+
- sci-embodied
|
|
48
48
|
- sci-o
|
|
49
49
|
- time-sync
|
|
50
50
|
- sci
|
|
@@ -87,7 +87,7 @@ tree:
|
|
|
87
87
|
pipeline:
|
|
88
88
|
- teads-curve
|
|
89
89
|
- sci-e
|
|
90
|
-
- sci-
|
|
90
|
+
- sci-embodied
|
|
91
91
|
- sci-o
|
|
92
92
|
- time-sync
|
|
93
93
|
- sci
|
|
@@ -15,14 +15,14 @@ initialize:
|
|
|
15
15
|
method: AzureImporter
|
|
16
16
|
path: "@grnsft/if-unofficial-plugins"
|
|
17
17
|
"try-defaults-1":
|
|
18
|
-
path: "
|
|
18
|
+
path: "builtin"
|
|
19
19
|
method: Coefficient
|
|
20
20
|
global-config:
|
|
21
21
|
input-parameter: grid/carbon-intensity
|
|
22
22
|
coefficient: 0.1
|
|
23
23
|
output-parameter: grid/carbon-intensity
|
|
24
24
|
"try-defaults-2":
|
|
25
|
-
path: "
|
|
25
|
+
path: "builtin"
|
|
26
26
|
method: Coefficient
|
|
27
27
|
global-config:
|
|
28
28
|
input-parameter: network/energy
|
|
@@ -58,4 +58,4 @@ tree:
|
|
|
58
58
|
inputs:
|
|
59
59
|
- timestamp: "2024-04-04T08:00:00.001Z"
|
|
60
60
|
duration: 3600
|
|
61
|
-
energy: 100
|
|
61
|
+
energy: 100
|
|
@@ -7,14 +7,14 @@ initialize:
|
|
|
7
7
|
path: '@grnsft/if-unofficial-plugins'
|
|
8
8
|
method: AzureImporter
|
|
9
9
|
try-defaults-1:
|
|
10
|
-
path: '
|
|
10
|
+
path: 'builtin'
|
|
11
11
|
method: Coefficient
|
|
12
12
|
global-config:
|
|
13
13
|
input-parameter: grid/carbon-intensity
|
|
14
14
|
coefficient: 0.1
|
|
15
15
|
output-parameter: grid/carbon-intensity
|
|
16
16
|
try-defaults-2:
|
|
17
|
-
path: '
|
|
17
|
+
path: 'builtin'
|
|
18
18
|
method: Coefficient
|
|
19
19
|
global-config:
|
|
20
20
|
input-parameter: network/energy
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
name: mock-observation-demo
|
|
2
|
+
description: a manifest demonstrating how to use the mock observations feature
|
|
3
|
+
tags:
|
|
4
|
+
initialize:
|
|
5
|
+
outputs: ['yaml']
|
|
6
|
+
plugins:
|
|
7
|
+
mock-observations:
|
|
8
|
+
kind: plugin
|
|
9
|
+
method: MockObservations
|
|
10
|
+
path: "builtin"
|
|
11
|
+
global-config:
|
|
12
|
+
timestamp-from: 2023-07-06T00:00
|
|
13
|
+
timestamp-to: 2023-07-06T00:10
|
|
14
|
+
duration: 0
|
|
15
|
+
components:
|
|
16
|
+
- cloud/instance-type: A1
|
|
17
|
+
- cloud/instance-type: B1
|
|
18
|
+
generators:
|
|
19
|
+
common:
|
|
20
|
+
region: uk-west
|
|
21
|
+
common-key: common-val
|
|
22
|
+
randint:
|
|
23
|
+
cpu/utilization:
|
|
24
|
+
min: 1
|
|
25
|
+
max: 99
|
|
26
|
+
memory/utilization:
|
|
27
|
+
min: 1
|
|
28
|
+
max: 99
|
|
29
|
+
tree:
|
|
30
|
+
children:
|
|
31
|
+
child:
|
|
32
|
+
pipeline:
|
|
33
|
+
- mock-observations
|
|
34
|
+
inputs:
|
|
@@ -2,13 +2,13 @@ name: pipeline-uninitialized-plugin-error
|
|
|
2
2
|
description: a negative test case that fails due to an uninitialized plugin being invoked in a pipeline
|
|
3
3
|
tags:
|
|
4
4
|
initialize:
|
|
5
|
+
# outputs: ['yaml']
|
|
5
6
|
plugins:
|
|
6
7
|
teads-curve:
|
|
7
8
|
path: '@grnsft/if-unofficial-plugins'
|
|
8
9
|
method: TeadsCurve
|
|
9
10
|
global-config:
|
|
10
11
|
interpolation: spline
|
|
11
|
-
outputs: ['yaml']
|
|
12
12
|
tree:
|
|
13
13
|
children:
|
|
14
14
|
child-0:
|
|
@@ -9,21 +9,21 @@ initialize:
|
|
|
9
9
|
global-config:
|
|
10
10
|
interpolation: spline
|
|
11
11
|
"sum":
|
|
12
|
-
path: "
|
|
12
|
+
path: "builtin"
|
|
13
13
|
method: Sum
|
|
14
14
|
global-config:
|
|
15
15
|
input-parameters:
|
|
16
16
|
- cpu/energy
|
|
17
17
|
- network/energy
|
|
18
18
|
output-parameter: energy
|
|
19
|
-
"sci-
|
|
20
|
-
path: "
|
|
21
|
-
method:
|
|
19
|
+
"sci-embodied":
|
|
20
|
+
path: "builtin"
|
|
21
|
+
method: SciEmbodied
|
|
22
22
|
"sci-o":
|
|
23
23
|
path: "@grnsft/if-plugins"
|
|
24
24
|
method: SciO
|
|
25
25
|
"sci":
|
|
26
|
-
path: "
|
|
26
|
+
path: "builtin"
|
|
27
27
|
method: Sci
|
|
28
28
|
global-config:
|
|
29
29
|
functional-unit: ""
|
|
@@ -43,7 +43,7 @@ tree:
|
|
|
43
43
|
- teads-curve
|
|
44
44
|
- sci-o
|
|
45
45
|
- sum
|
|
46
|
-
- sci-
|
|
46
|
+
- sci-embodied
|
|
47
47
|
- time-sync
|
|
48
48
|
- sci
|
|
49
49
|
config:
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name: sci-embodied
|
|
2
|
+
description: receiving incorrect error message when running sci-embodied without `resources-total` issue #716
|
|
3
|
+
tags:
|
|
4
|
+
initialize:
|
|
5
|
+
#outputs: ['yaml']
|
|
6
|
+
plugins:
|
|
7
|
+
"sci-embodied": # a model that calculates m from te, tir, el, rr and rtor
|
|
8
|
+
method: SciEmbodied
|
|
9
|
+
path: "builtin"
|
|
10
|
+
tree:
|
|
11
|
+
children:
|
|
12
|
+
child:
|
|
13
|
+
pipeline:
|
|
14
|
+
- sci-embodied # duration & config -> embodied
|
|
15
|
+
defaults:
|
|
16
|
+
device/emissions-embodied: 1533.120 # gCO2eq
|
|
17
|
+
time-reserved: 3600 # 1hr in seconds
|
|
18
|
+
device/expected-lifespan: 94608000 # 3 years in seconds
|
|
19
|
+
resources-reserved: 1
|
|
20
|
+
# resources-total: 8
|
|
21
|
+
inputs:
|
|
22
|
+
- timestamp: 2023-07-06T00:00
|
|
23
|
+
duration: 3600
|
|
@@ -9,7 +9,7 @@ initialize:
|
|
|
9
9
|
global-config:
|
|
10
10
|
interpolation: spline
|
|
11
11
|
"sum":
|
|
12
|
-
path: "
|
|
12
|
+
path: "builtin"
|
|
13
13
|
method: Sum
|
|
14
14
|
global-config:
|
|
15
15
|
input-parameters:
|
|
@@ -17,14 +17,14 @@ initialize:
|
|
|
17
17
|
- network/energy
|
|
18
18
|
output-parameter: energy-sum
|
|
19
19
|
"coefficient":
|
|
20
|
-
path: "
|
|
20
|
+
path: "builtin"
|
|
21
21
|
method: Coefficient
|
|
22
22
|
global-config:
|
|
23
23
|
input-parameter: energy
|
|
24
24
|
coefficient: 2
|
|
25
25
|
output-parameter: energy-doubled
|
|
26
26
|
"multiply":
|
|
27
|
-
path: "
|
|
27
|
+
path: "builtin"
|
|
28
28
|
method: Multiply
|
|
29
29
|
global-config:
|
|
30
30
|
input-parameters: ["cpu/utilization", "duration"]
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
name: csv-demo
|
|
2
|
+
description: null
|
|
3
|
+
tags: null
|
|
4
|
+
initialize:
|
|
5
|
+
plugins:
|
|
6
|
+
cloud-instance-metadata:
|
|
7
|
+
path: builtin
|
|
8
|
+
method: CSVLookup
|
|
9
|
+
global-config:
|
|
10
|
+
filepath: >-
|
|
11
|
+
https://raw.githubusercontent.com/Green-Software-Foundation/if-data/main/cloud-metdata-azure-instances.csv
|
|
12
|
+
query:
|
|
13
|
+
instance-class: cloud/instance-type
|
|
14
|
+
output: '*'
|
|
15
|
+
extract-processor-name:
|
|
16
|
+
path: builtin
|
|
17
|
+
method: Regex
|
|
18
|
+
global-config:
|
|
19
|
+
parameter: cpu-model-name
|
|
20
|
+
match: /^([^,])+/g
|
|
21
|
+
output: cpu/name
|
|
22
|
+
outputs:
|
|
23
|
+
- yaml
|
|
24
|
+
tree:
|
|
25
|
+
children:
|
|
26
|
+
child:
|
|
27
|
+
pipeline:
|
|
28
|
+
- cloud-instance-metadata
|
|
29
|
+
- extract-processor-name
|
|
30
|
+
inputs:
|
|
31
|
+
- timestamp: 2023-08-06T00:00
|
|
32
|
+
duration: 3600
|
|
33
|
+
cpu/energy: 0.001
|
|
34
|
+
cloud/provider: gcp
|
|
35
|
+
cloud/region: asia-east
|
|
36
|
+
cloud/instance-type: Standard_A1_v2
|