@grnsft/if 0.3.1 → 0.3.2

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.
Files changed (38) hide show
  1. package/CONTRIBUTING.md +8 -0
  2. package/README.md +3 -0
  3. package/build/builtins/export-csv-raw.js +2 -2
  4. package/build/builtins/export-csv.js +15 -5
  5. package/build/builtins/group-by.js +20 -5
  6. package/build/builtins/time-sync.js +2 -1
  7. package/build/config/strings.js +2 -3
  8. package/build/index.js +3 -3
  9. package/build/lib/compute.js +8 -8
  10. package/build/lib/load.js +5 -3
  11. package/build/lib/parameterize.d.ts +2 -1
  12. package/build/lib/parameterize.js +4 -4
  13. package/build/types/compute.d.ts +2 -2
  14. package/build/types/compute.js +1 -1
  15. package/build/util/aggregation-helper.js +4 -4
  16. package/build/util/errors.d.ts +1 -1
  17. package/build/util/errors.js +3 -3
  18. package/build/util/helpers.d.ts +2 -2
  19. package/build/util/helpers.js +12 -14
  20. package/examples/manifests/boavizta-pipeline.yml +13 -13
  21. package/examples/manifests/cloud-metadata-teads.yml +41 -0
  22. package/examples/manifests/cloud-metadata.yml +13 -34
  23. package/examples/manifests/e-net.yml +1 -1
  24. package/examples/manifests/generics.yml +14 -14
  25. package/examples/manifests/group-by.yml +21 -21
  26. package/examples/manifests/nesting.yml +16 -16
  27. package/examples/manifests/pipeline-demo-1.yml +4 -4
  28. package/examples/manifests/pipeline-demo-2.yml +16 -11
  29. package/examples/manifests/pipeline-demo.yml +10 -10
  30. package/examples/manifests/pipeline-teads-sci.yml +12 -12
  31. package/examples/manifests/pipeline-with-generics.yml +26 -21
  32. package/examples/manifests/pipeline-with-mocks.yml +23 -23
  33. package/examples/manifests/watt-time.yml +6 -13
  34. package/github-processes.md +158 -0
  35. package/package.json +1 -1
  36. package/src/builtins/README.md +40 -44
  37. package/examples/manifests/cim.yml +0 -20
  38. package/examples/manifests/teads-aws.yml +0 -22
@@ -0,0 +1,158 @@
1
+
2
+ ## IF Repositories
3
+
4
+ - [`if`](https://github.com/Green-Software-Foundation/if)
5
+ - source code for the IF
6
+ - [`if-plugins`](https://github.com/Green-Software-Foundation/if-plugins)
7
+ - source code for standard library of plugins
8
+ - IF core team commit to maintaining these plugins
9
+ - [`if-unofficial-plugins`](https://github.com/Green-Software-Foundation/if-unofficial-plugins)
10
+ - source code for plugins relying on third-party data/APIs
11
+ - intended to be deprecated and removed in mid-term future
12
+ - plugins in this repo should be handed over to relevant organizations to maintain
13
+ - [`if-plugin-template`](https://github.com/Green-Software-Foundation/if-plugin-template)
14
+ - template for new plugins
15
+ - intended for builders to bootstrap IF-compatible plugin development
16
+ - [`if-standards`](https://github.com/Green-Software-Foundation/if-standards)
17
+ - not currently used, but intended to be the home of params.ts
18
+ - will have a dedicated discussion board and governance to set IF standards
19
+ - [`if-exhaust plugins`](https://github.com/Green-Software-Foundation/if-exhaust-plugins)
20
+ - not currently used
21
+ - intended to become a separate repo just for exhaust plugins
22
+ - requires strict rules from if
23
+
24
+
25
+ ## Branch names and purposes
26
+
27
+ Our main repositories all have two branches: `main` and `release`.
28
+ Here are the rules applied to each branch:
29
+
30
+ ### `if`, `if-plugins`, `if-unofficial-plugins` and `if-exhaust-plugins`
31
+
32
+ #### `main`
33
+ - target branch for PRs
34
+ - PRs can be merged into `main` with two core team reviews, one being QA
35
+ - `main` regularly advances ahead of the `release` branch
36
+ - merged into `release` periodically, only after full QA approval
37
+ - pushing directly to `main` is forbidden - all changes are by PR
38
+ - PRs will not be merged if they do not pass CI/CD
39
+
40
+ #### `release`
41
+
42
+ - release is our stable branch
43
+ - it is protected and only merged into when we have a fully QA-approved `main` state that we want to release
44
+ - npm packages are released using `release` branch
45
+ - PRs into `release` are forbidden except to update tests, README, Github config, CI/CD or release config.
46
+ - Pushing directly to `release` is forbidden
47
+ - `release` should always satisfy a basic set of regression and scenario tests
48
+ - merging `main` into `release` requires that all automated tests pass and two core team members have approved, one being QA.
49
+
50
+ ### `if-plugin-template`
51
+
52
+ - we only maintain a single branch: `main`
53
+ - PRs to `main` can be merged after one approval from core team
54
+ - Pushing directly to `main` is possible but discouraged
55
+
56
+
57
+ ### `if-docs`
58
+
59
+ - we only maintain a single branch - `main`
60
+ - PRs to `main` can be merged after one approval from core team
61
+ - Pushing directly to `main` is possible but discouraged
62
+
63
+ ### When can we break our rules?
64
+
65
+ - `release` branches have the strictest rules. We should never override the process outlined above for `release` branches in any repository.
66
+ - On `main` we can be slightly more flexible. It is acceptable to skip QA for PRs that only change typos, documentation or comments. Any changes to source code or tests should be QA approved before merge.
67
+ - In emergency scenarios where an urgent hotfix is required it might be required to skip QA review on `main` branches - this should only happen with QA authorization so QA can retroactively test as soon as possible.
68
+
69
+ ## DCO
70
+
71
+ We require contributors to conform to the DCO agreement on our repositories. This means either signing commits or explicitly adding a DCO commit message. This ensures all contributors agree to the conditions imposed by our licenses and adhere to our expected practices. The DCO must be satisfied in order to PRs to be merged.
72
+
73
+ ## Commits
74
+
75
+ Commits are expected to conform to the [conventional-commits](https://www.conventionalcommits.org/en/v1.0.0/) syntax.
76
+ Commits are expected to be signed and have descriptive commit messages.
77
+ We might ask people to provide new messages in some circumstances or to break their PRs into smaller logical units.
78
+
79
+ ## PR triage
80
+
81
+ We run a weekly PR triage call on Thursdays. The most important outcome of this call is to examine open PRs and issues across all the IF repositories and determine which ones include changes that we might want to merge. This initial sift for changes that are or are not aligned with our goals for the IF should be prioritized above technical comments and fixes.
82
+
83
+ Some reasons why a PR might not pass triage:
84
+
85
+ - changes are not aligned with our vision for IF
86
+ - we do not see a strong reason for making a change
87
+ - changes are obviously technically incorrect
88
+ - changes are too large to properly review (e.g. covering too many files)
89
+ - too many changes are made in too few commits
90
+ - commit messages are ambiguous
91
+ - PR description is too short, vague or imprecise
92
+ - PR would for some other reason take too long for core team to assess
93
+ - PR makes changes that do not conform to our license
94
+ - PR makes use of a third-party API or dataset in an illegitimate way (e.g. exposing data that should be paywalled)
95
+
96
+ After a PR has passed triage, it can be assigned to a core team member to review. Developer review precedes QA review. Community PRs (PRs raised from outside the core team) will *always* go through a full QA vetting procedure before being merged.
97
+
98
+ We intend to respond to new PRs and issues within 3 days of the ticket being opened, even if only with a brief message thanking the OP and explaining the triage process.
99
+
100
+
101
+ ## Labels
102
+
103
+ ```
104
+ //review status labels
105
+ awaiting-triage
106
+ triage-pass
107
+ awaiting-review
108
+ review-pass
109
+ awaiting-qa
110
+ qa-pass
111
+ changes-needed
112
+
113
+ //change type labels
114
+ fix
115
+ feature
116
+ docs
117
+ package
118
+ other
119
+
120
+ // size labels
121
+ small
122
+ medium
123
+ large
124
+
125
+ // priority labels
126
+ high-priority
127
+ med-priority
128
+ low-priority
129
+
130
+ //delay explanation labels
131
+ abandoned
132
+ blocked
133
+ backlogged
134
+
135
+ // other labels
136
+ project-management
137
+ agenda
138
+ discussion
139
+ help-wanted
140
+ good-first-issue
141
+ ```
142
+
143
+ Each PR is expected to have one label from each category (except `other`) assigned to it at all times.
144
+
145
+
146
+ ## Releases
147
+
148
+ We aim to release fortnightly, every other Tuesday. We release npm packages for `if`, `if-plugins`, `if-unofficial-plugins`, and `if-plugin-template`.
149
+
150
+ ## Hotfixes
151
+
152
+ We will hotfix by raising PRs into `release` when necessary. These PRs require sign-off by a core developer and our QA engineer.
153
+
154
+ If more than two hotfixes are required on a particular release, the team will call a spike meeting to determine the causes of the bugs, identify any changes required to our QA process and determine next steps for fixing the release.
155
+
156
+ Hotfixes on release can be merged back into `main` when they have been fully QA tested.
157
+
158
+ We intend for hotfixes to be as infrequent as possible.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@grnsft/if",
3
3
  "description": "Impact Framework",
4
- "version": "v0.3.1",
4
+ "version": "v0.3.2",
5
5
  "author": {
6
6
  "name": "Green Software Foundation",
7
7
  "email": "info@gsf.com"
@@ -279,7 +279,6 @@ tree:
279
279
  carbon: 200
280
280
  energy: 200
281
281
  requests: 380
282
-
283
282
  ```
284
283
 
285
284
 
@@ -673,44 +672,43 @@ graph:
673
672
  - teads-curve
674
673
  config:
675
674
  group-by:
676
- - cloud-region
675
+ - cloud/region
677
676
  - instance-type
678
677
  inputs:
679
678
  - timestamp: 2023-07-06T00:00
680
- duration: 300
681
- instance-type: A1
682
- region: uk-west
679
+ duration: 300
680
+ instance-type: A1
681
+ cloud/region: uk-west
683
682
  cpu-util: 99
684
- - timestamp: 2023-07-06T05:00
685
- duration: 300
686
- instance-type: A1
687
- region: uk-west
688
- cpu-util: 23
683
+ - timestamp: 2023-07-06T05:00
684
+ duration: 300
685
+ instance-type: A1
686
+ cloud/region: uk-west
687
+ cpu-util: 23
689
688
  - timestamp: 2023-07-06T10:00
690
689
  duration: 300
691
- instance-type: A1
692
- region: uk-west
690
+ instance-type: A1
691
+ cloud/region: uk-west
693
692
  cpu-util: 12
694
693
  - timestamp: 2023-07-06T00:00 # note this time restarts at the start timstamp
695
694
  duration: 300
696
695
  instance-type: B1
697
- region: uk-west
696
+ cloud/region: uk-west
698
697
  cpu-util: 11
699
- - timestamp: 2023-07-06T05:00
700
- duration: 300
698
+ - timestamp: 2023-07-06T05:00
699
+ duration: 300
701
700
  instance-type: B1
702
- region: uk-west
701
+ cloud/region: uk-west
703
702
  cpu-util: 67
704
703
  - timestamp: 2023-07-06T10:00
705
704
  duration: 300
706
705
  instance-type: B1
707
- region: uk-west
708
- cpu-util: 1
706
+ cloud/region: uk-west
707
+ cpu-util: 1
709
708
  ```
710
709
 
711
710
  However, each observation contains an `instance-type` field that varies between observations. There are two instance types being represented in this array of observations. This means there are duplicate entries for the same timestamp in this array. This is the problem that `group-by` solves. You provide `instance-type` as a key to the `group-by` plugin and it extracts the data belonging to the different instances and separates them into independent arrays. The above example would be restructured so that instance types `A1` and `B1` have their own data, as follows:
712
711
 
713
-
714
712
  ```yaml
715
713
  graph:
716
714
  children:
@@ -721,7 +719,7 @@ graph:
721
719
  config:
722
720
  group-by:
723
721
  groups:
724
- - cloud-region
722
+ - cloud/region
725
723
  - instance-type
726
724
  children:
727
725
  A1:
@@ -729,35 +727,35 @@ graph:
729
727
  - timestamp: 2023-07-06T00:00
730
728
  duration: 300
731
729
  instance-type: A1
732
- region: uk-west
730
+ cloud/region: uk-west
733
731
  cpu-util: 99
734
732
  - timestamp: 2023-07-06T05:00
735
733
  duration: 300
736
734
  instance-type: A1
737
- region: uk-west
735
+ cloud/region: uk-west
738
736
  cpu-util: 23
739
737
  - timestamp: 2023-07-06T10:00
740
738
  duration: 300
741
739
  instance-type: A1
742
- region: uk-west
740
+ cloud/region: uk-west
743
741
  cpu-util: 12
744
742
  B1:
745
743
  inputs:
746
744
  - timestamp: 2023-07-06T00:00
747
745
  duration: 300
748
746
  instance-type: B1
749
- region: uk-east
747
+ cloud/region: uk-east
750
748
  cpu-util: 11
751
749
  - timestamp: 2023-07-06T05:00
752
750
  duration: 300
753
751
  instance-type: B1
754
- region: uk-east
752
+ cloud/region: uk-east
755
753
  cpu-util: 67
756
754
  - timestamp: 2023-07-06T10:00
757
755
  duration: 300
758
756
  instance-type: B1
759
- region: uk-east
760
- cpu-util: 1
757
+ cloud/region: uk-east
758
+ cpu-util: 1
761
759
  ```
762
760
 
763
761
  ### Using `group-by`
@@ -769,9 +767,9 @@ The initialization looks as follows:
769
767
  ```yaml
770
768
  initialize:
771
769
  plugins:
772
- group-by:
773
- path: 'builtin'
774
- method: GroupBy
770
+ group-by:
771
+ path: 'builtin'
772
+ method: GroupBy
775
773
  ```
776
774
 
777
775
  You then have to provide config defining which keys to group by in each component. This is done at the component level (i.e. not global config).
@@ -782,19 +780,18 @@ For example:
782
780
  tree:
783
781
  children:
784
782
  my-app:
785
- pipeline:
783
+ pipeline:
786
784
  - group-by
787
785
  config:
788
786
  group-by:
789
787
  group:
790
- - region
788
+ - cloud/region
791
789
  - instance-type
792
790
  ```
793
791
 
794
- In the example above, the plugin would regroup the input data for the specific component by `region` and by `instance-type`.
795
-
796
- Assuming the values `A1` and `B1` are found for `instance-type` and the values `uk-east` and `uk-west` are found for `region`, the result of `group-by` would look similar to the following:
792
+ In the example above, the plugin would regroup the input data for the specific component by `cloud/region` and by `instance-type`.
797
793
 
794
+ Assuming the values `A1` and `B1` are found for `instance-type` and the values `uk-east` and `uk-west` are found for `cloud/region`, the result of `group-by` would look similar to the following:
798
795
 
799
796
  ```yaml
800
797
  tree:
@@ -805,7 +802,7 @@ tree:
805
802
  config:
806
803
  group-by:
807
804
  groups:
808
- - region
805
+ - cloud/region
809
806
  - instance-type
810
807
  children:
811
808
  uk-west:
@@ -815,17 +812,17 @@ tree:
815
812
  - timestamp: 2023-07-06T00:00
816
813
  duration: 300
817
814
  instance-type: A1
818
- region: uk-west
815
+ cloud/region: uk-west
819
816
  cpu-util: 99
820
817
  - timestamp: 2023-07-06T05:00
821
818
  duration: 300
822
819
  instance-type: A1
823
- region: uk-west
820
+ cloud/region: uk-west
824
821
  cpu-util: 23
825
822
  - timestamp: 2023-07-06T10:00
826
823
  duration: 300
827
824
  instance-type: A1
828
- region: uk-west
825
+ cloud/region: uk-west
829
826
  cpu-util: 12
830
827
  uk-east:
831
828
  children:
@@ -834,19 +831,18 @@ tree:
834
831
  - timestamp: 2023-07-06T00:00
835
832
  duration: 300
836
833
  instance-type: B1
837
- region: uk-east
834
+ cloud/region: uk-east
838
835
  cpu-util: 11
839
836
  - timestamp: 2023-07-06T05:00
840
837
  duration: 300
841
838
  instance-type: B1
842
- region: uk-east
839
+ cloud/region: uk-east
843
840
  cpu-util: 67
844
841
  - timestamp: 2023-07-06T10:00
845
842
  duration: 300
846
843
  instance-type: B1
847
- region: uk-east
848
- cpu-util: 1
844
+ cloud/region: uk-east
845
+ cpu-util: 1
849
846
  ```
850
847
 
851
848
  This reorganized data can then be used to feed the rest of a computation pipeline.
852
-
@@ -1,20 +0,0 @@
1
- name: cloud-instance-metadata
2
- description: example impl invoking Cloud Instance Metadata plugin
3
- tags:
4
- initialize:
5
- plugins:
6
- cloud-metadata:
7
- method: CloudMetadata
8
- path: "@grnsft/if-plugins"
9
- tree:
10
- children:
11
- child:
12
- pipeline:
13
- - cloud-metadata
14
- config:
15
- inputs:
16
- - timestamp: 2023-07-06T00:00 # [KEYWORD] [NO-SUBFIELDS] time when measurement occurred
17
- cloud/vendor: aws
18
- cloud/instance-type: m5n.large
19
- duration: 100
20
- cpu/utilization: 10
@@ -1,22 +0,0 @@
1
- name: teads-aws
2
- description: simple demo invoking TeadsAWS model
3
- tags:
4
- initialize:
5
- plugins:
6
- teads-aws:
7
- method: TeadsAWS
8
- path: "@grnsft/if-unofficial-plugins"
9
- global-config:
10
- interpolation: linear
11
- tree:
12
- children:
13
- child:
14
- pipeline:
15
- - teads-aws # duration & config -> embodied
16
- defaults:
17
- cloud/instance-type: m5n.large
18
- cpu/expected-lifespan: 252288000
19
- inputs:
20
- - timestamp: 2023-07-06T00:00
21
- duration: 3600
22
- cpu/utilization: 10