@grnsft/if 0.0.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 (285) hide show
  1. package/.devcontainer/devcontainer.json +38 -0
  2. package/.editorconfig +8 -0
  3. package/.env.example +9 -0
  4. package/.eslintignore +4 -0
  5. package/.eslintrc.json +8 -0
  6. package/.github/ISSUE_TEMPLATE/agenda.md +36 -0
  7. package/.github/ISSUE_TEMPLATE/blank-issue.md +10 -0
  8. package/.github/ISSUE_TEMPLATE/feedback.md +42 -0
  9. package/.github/ISSUE_TEMPLATE/model-plugin.md +63 -0
  10. package/.github/ISSUE_TEMPLATE/user-story.md +10 -0
  11. package/.github/PULL_REQUEST_TEMPLATE.md +21 -0
  12. package/.github/workflows/nodejs-ci.yml +34 -0
  13. package/.gitmodules +3 -0
  14. package/.prettierrc.js +3 -0
  15. package/CONTRIBUTING.md +194 -0
  16. package/LICENSE +21 -0
  17. package/Makefile +16 -0
  18. package/README.md +67 -0
  19. package/build/__mocks__/azure/index.d.ts +11 -0
  20. package/build/__mocks__/azure/index.js +132 -0
  21. package/build/__mocks__/boavizta/countries.json +138 -0
  22. package/build/__mocks__/boavizta/instance_types.json +625 -0
  23. package/build/__mocks__/boavizta/providers.json +1 -0
  24. package/build/__mocks__/fs/index.d.ts +3 -0
  25. package/build/__mocks__/fs/index.js +56 -0
  26. package/build/__mocks__/model-universe/index.d.ts +33 -0
  27. package/build/__mocks__/model-universe/index.js +68 -0
  28. package/build/__mocks__/watt-time/data.json +119 -0
  29. package/build/__tests__/integration/ompl/index.test.d.ts +1 -0
  30. package/build/__tests__/integration/ompl/index.test.js +61 -0
  31. package/build/__tests__/unit/lib/azure-importer/index.test.d.ts +1 -0
  32. package/build/__tests__/unit/lib/azure-importer/index.test.js +152 -0
  33. package/build/__tests__/unit/lib/boavizta/index.test.d.ts +1 -0
  34. package/build/__tests__/unit/lib/boavizta/index.test.js +579 -0
  35. package/build/__tests__/unit/lib/case-studies/aveva.test.d.ts +1 -0
  36. package/build/__tests__/unit/lib/case-studies/aveva.test.js +36 -0
  37. package/build/__tests__/unit/lib/case-studies/emem.test.d.ts +1 -0
  38. package/build/__tests__/unit/lib/case-studies/emem.test.js +108 -0
  39. package/build/__tests__/unit/lib/case-studies/eshoppen.test.d.ts +1 -0
  40. package/build/__tests__/unit/lib/case-studies/eshoppen.test.js +53 -0
  41. package/build/__tests__/unit/lib/case-studies/sci-accenture.test.d.ts +1 -0
  42. package/build/__tests__/unit/lib/case-studies/sci-accenture.test.js +23 -0
  43. package/build/__tests__/unit/lib/ccf/index.test.d.ts +1 -0
  44. package/build/__tests__/unit/lib/ccf/index.test.js +223 -0
  45. package/build/__tests__/unit/lib/cloud-instance-metadata/index.test.d.ts +1 -0
  46. package/build/__tests__/unit/lib/cloud-instance-metadata/index.test.js +73 -0
  47. package/build/__tests__/unit/lib/sci/index.test.d.ts +1 -0
  48. package/build/__tests__/unit/lib/sci/index.test.js +106 -0
  49. package/build/__tests__/unit/lib/sci-e/index.test.d.ts +1 -0
  50. package/build/__tests__/unit/lib/sci-e/index.test.js +30 -0
  51. package/build/__tests__/unit/lib/sci-m/index.test.d.ts +1 -0
  52. package/build/__tests__/unit/lib/sci-m/index.test.js +58 -0
  53. package/build/__tests__/unit/lib/sci-o/index.test.d.ts +1 -0
  54. package/build/__tests__/unit/lib/sci-o/index.test.js +42 -0
  55. package/build/__tests__/unit/lib/shell-imp/index.test.d.ts +1 -0
  56. package/build/__tests__/unit/lib/shell-imp/index.test.js +21 -0
  57. package/build/__tests__/unit/lib/tdp-finder/index.test.d.ts +1 -0
  58. package/build/__tests__/unit/lib/tdp-finder/index.test.js +62 -0
  59. package/build/__tests__/unit/lib/teads-aws/index.test.d.ts +1 -0
  60. package/build/__tests__/unit/lib/teads-aws/index.test.js +170 -0
  61. package/build/__tests__/unit/lib/teads-curve/index.test.d.ts +1 -0
  62. package/build/__tests__/unit/lib/teads-curve/index.test.js +146 -0
  63. package/build/__tests__/unit/lib/watt-time/index.test.d.ts +1 -0
  64. package/build/__tests__/unit/lib/watt-time/index.test.js +106 -0
  65. package/build/__tests__/unit/util/args.test.d.ts +1 -0
  66. package/build/__tests__/unit/util/args.test.js +92 -0
  67. package/build/__tests__/unit/util/models-universe.test.d.ts +1 -0
  68. package/build/__tests__/unit/util/models-universe.test.js +211 -0
  69. package/build/__tests__/unit/util/observatory.test.d.ts +1 -0
  70. package/build/__tests__/unit/util/observatory.test.js +91 -0
  71. package/build/__tests__/unit/util/supercomputer.test.d.ts +1 -0
  72. package/build/__tests__/unit/util/supercomputer.test.js +231 -0
  73. package/build/__tests__/unit/util/yaml.test.d.ts +1 -0
  74. package/build/__tests__/unit/util/yaml.test.js +59 -0
  75. package/build/config/config.d.ts +32 -0
  76. package/build/config/config.js +74 -0
  77. package/build/config/index.d.ts +2 -0
  78. package/build/config/index.js +8 -0
  79. package/build/config/strings.d.ts +14 -0
  80. package/build/config/strings.js +30 -0
  81. package/build/index.d.ts +1 -0
  82. package/build/index.js +46 -0
  83. package/build/lib/azure-importer/index.d.ts +55 -0
  84. package/build/lib/azure-importer/index.js +314 -0
  85. package/build/lib/boavizta/index.d.ts +53 -0
  86. package/build/lib/boavizta/index.js +254 -0
  87. package/build/lib/case-studies/aveva-model.d.ts +29 -0
  88. package/build/lib/case-studies/aveva-model.js +53 -0
  89. package/build/lib/case-studies/emem-model.d.ts +42 -0
  90. package/build/lib/case-studies/emem-model.js +93 -0
  91. package/build/lib/case-studies/eshoppen-model.d.ts +24 -0
  92. package/build/lib/case-studies/eshoppen-model.js +123 -0
  93. package/build/lib/case-studies/index.d.ts +4 -0
  94. package/build/lib/case-studies/index.js +21 -0
  95. package/build/lib/case-studies/sci-accenture-model.d.ts +10 -0
  96. package/build/lib/case-studies/sci-accenture-model.js +37 -0
  97. package/build/lib/ccf/aws-embodied.json +5591 -0
  98. package/build/lib/ccf/aws-instances.json +21116 -0
  99. package/build/lib/ccf/aws-use.json +79 -0
  100. package/build/lib/ccf/azure-embodied.json +6547 -0
  101. package/build/lib/ccf/azure-instances.json +8332 -0
  102. package/build/lib/ccf/azure-use.json +58 -0
  103. package/build/lib/ccf/gcp-embodied.json +3049 -0
  104. package/build/lib/ccf/gcp-instances.json +3880 -0
  105. package/build/lib/ccf/gcp-use.json +58 -0
  106. package/build/lib/ccf/index.d.ts +63 -0
  107. package/build/lib/ccf/index.js +338 -0
  108. package/build/lib/cloud-instance-metadata/aws-instances.json +1 -0
  109. package/build/lib/cloud-instance-metadata/azure-instances.json +1 -0
  110. package/build/lib/cloud-instance-metadata/index.d.ts +15 -0
  111. package/build/lib/cloud-instance-metadata/index.js +104 -0
  112. package/build/lib/index.d.ts +15 -0
  113. package/build/lib/index.js +32 -0
  114. package/build/lib/interfaces/ccf.d.ts +19 -0
  115. package/build/lib/interfaces/ccf.js +3 -0
  116. package/build/lib/interfaces/index.d.ts +7 -0
  117. package/build/lib/interfaces/index.js +18 -0
  118. package/build/lib/sci/index.d.ts +13 -0
  119. package/build/lib/sci/index.js +131 -0
  120. package/build/lib/sci-e/index.d.ts +38 -0
  121. package/build/lib/sci-e/index.js +85 -0
  122. package/build/lib/sci-m/index.d.ts +10 -0
  123. package/build/lib/sci-m/index.js +124 -0
  124. package/build/lib/sci-o/index.d.ts +17 -0
  125. package/build/lib/sci-o/index.js +52 -0
  126. package/build/lib/shell-imp/index.d.ts +32 -0
  127. package/build/lib/shell-imp/index.js +82 -0
  128. package/build/lib/tdp-finder/index.d.ts +19 -0
  129. package/build/lib/tdp-finder/index.js +98 -0
  130. package/build/lib/teads-aws/aws-embodied.json +1 -0
  131. package/build/lib/teads-aws/aws-instances.json +1 -0
  132. package/build/lib/teads-aws/index.d.ts +58 -0
  133. package/build/lib/teads-aws/index.js +208 -0
  134. package/build/lib/teads-curve/index.d.ts +52 -0
  135. package/build/lib/teads-curve/index.js +158 -0
  136. package/build/lib/watt-time/index.d.ts +18 -0
  137. package/build/lib/watt-time/index.js +204 -0
  138. package/build/types/azure-importer.d.ts +29 -0
  139. package/build/types/azure-importer.js +3 -0
  140. package/build/types/boavizta.d.ts +7 -0
  141. package/build/types/boavizta.js +3 -0
  142. package/build/types/common.d.ts +7 -0
  143. package/build/types/common.js +9 -0
  144. package/build/types/impl.d.ts +40 -0
  145. package/build/types/impl.js +3 -0
  146. package/build/types/models-universe.d.ts +24 -0
  147. package/build/types/models-universe.js +3 -0
  148. package/build/types/process-args.d.ts +7 -0
  149. package/build/types/process-args.js +3 -0
  150. package/build/types/supercomputer.d.ts +4 -0
  151. package/build/types/supercomputer.js +3 -0
  152. package/build/util/args.d.ts +8 -0
  153. package/build/util/args.js +48 -0
  154. package/build/util/errors.d.ts +6 -0
  155. package/build/util/errors.js +22 -0
  156. package/build/util/helpers.d.ts +4 -0
  157. package/build/util/helpers.js +18 -0
  158. package/build/util/models-universe.d.ts +28 -0
  159. package/build/util/models-universe.js +95 -0
  160. package/build/util/observatory.d.ts +20 -0
  161. package/build/util/observatory.js +31 -0
  162. package/build/util/supercomputer.d.ts +30 -0
  163. package/build/util/supercomputer.js +109 -0
  164. package/build/util/validations.d.ts +25 -0
  165. package/build/util/validations.js +52 -0
  166. package/build/util/yaml.d.ts +13 -0
  167. package/build/util/yaml.js +36 -0
  168. package/coverage/clover.xml +1172 -0
  169. package/coverage/coverage-final.json +27 -0
  170. package/coverage/lcov-report/base.css +224 -0
  171. package/coverage/lcov-report/block-navigation.js +87 -0
  172. package/coverage/lcov-report/config/config.ts.html +310 -0
  173. package/coverage/lcov-report/config/index.html +146 -0
  174. package/coverage/lcov-report/config/index.ts.html +91 -0
  175. package/coverage/lcov-report/config/strings.ts.html +118 -0
  176. package/coverage/lcov-report/favicon.png +0 -0
  177. package/coverage/lcov-report/index.html +341 -0
  178. package/coverage/lcov-report/lib/boavizta/index.html +116 -0
  179. package/coverage/lcov-report/lib/boavizta/index.ts.html +1171 -0
  180. package/coverage/lcov-report/lib/case-studies/aveva-model.ts.html +277 -0
  181. package/coverage/lcov-report/lib/case-studies/emem-model.ts.html +439 -0
  182. package/coverage/lcov-report/lib/case-studies/eshoppen-model.ts.html +550 -0
  183. package/coverage/lcov-report/lib/case-studies/index.html +176 -0
  184. package/coverage/lcov-report/lib/case-studies/index.ts.html +97 -0
  185. package/coverage/lcov-report/lib/case-studies/sci-accenture-model.ts.html +232 -0
  186. package/coverage/lcov-report/lib/ccf/index.html +116 -0
  187. package/coverage/lcov-report/lib/ccf/index.ts.html +1339 -0
  188. package/coverage/lcov-report/lib/cloud-instance-metadata/index.html +116 -0
  189. package/coverage/lcov-report/lib/cloud-instance-metadata/index.ts.html +370 -0
  190. package/coverage/lcov-report/lib/index.html +116 -0
  191. package/coverage/lcov-report/lib/index.ts.html +121 -0
  192. package/coverage/lcov-report/lib/sci/index.html +116 -0
  193. package/coverage/lcov-report/lib/sci/index.ts.html +571 -0
  194. package/coverage/lcov-report/lib/sci-e/index.html +116 -0
  195. package/coverage/lcov-report/lib/sci-e/index.ts.html +403 -0
  196. package/coverage/lcov-report/lib/sci-m/index.html +116 -0
  197. package/coverage/lcov-report/lib/sci-m/index.ts.html +487 -0
  198. package/coverage/lcov-report/lib/sci-o/index.html +116 -0
  199. package/coverage/lcov-report/lib/sci-o/index.ts.html +265 -0
  200. package/coverage/lcov-report/lib/shell-imp/index.html +116 -0
  201. package/coverage/lcov-report/lib/shell-imp/index.ts.html +376 -0
  202. package/coverage/lcov-report/lib/teads-aws/index.html +116 -0
  203. package/coverage/lcov-report/lib/teads-aws/index.ts.html +823 -0
  204. package/coverage/lcov-report/lib/teads-curve/index.html +116 -0
  205. package/coverage/lcov-report/lib/teads-curve/index.ts.html +625 -0
  206. package/coverage/lcov-report/lib/watt-time/index.html +116 -0
  207. package/coverage/lcov-report/lib/watt-time/index.ts.html +829 -0
  208. package/coverage/lcov-report/prettify.css +1 -0
  209. package/coverage/lcov-report/prettify.js +2 -0
  210. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  211. package/coverage/lcov-report/sorter.js +196 -0
  212. package/coverage/lcov-report/types/common.ts.html +109 -0
  213. package/coverage/lcov-report/types/index.html +116 -0
  214. package/coverage/lcov-report/util/args.ts.html +244 -0
  215. package/coverage/lcov-report/util/index.html +176 -0
  216. package/coverage/lcov-report/util/models-universe.ts.html +679 -0
  217. package/coverage/lcov-report/util/observatory.ts.html +229 -0
  218. package/coverage/lcov-report/util/supercomputer.ts.html +466 -0
  219. package/coverage/lcov-report/util/yaml.ts.html +193 -0
  220. package/coverage/lcov.info +2094 -0
  221. package/docs/implementations/tdp-finder.md +36 -0
  222. package/examples/impls/case-studies/accenture.yml +155 -0
  223. package/examples/impls/case-studies/aveva.yaml +48 -0
  224. package/examples/impls/case-studies/azure-yassine.yaml +67 -0
  225. package/examples/impls/case-studies/boavizta.yml +26 -0
  226. package/examples/impls/case-studies/dow_msft.yml +173 -0
  227. package/examples/impls/case-studies/farm-insights.yaml +35 -0
  228. package/examples/impls/case-studies/gsf-website.yaml +93 -0
  229. package/examples/impls/case-studies/msft-eshoppen.yaml +162 -0
  230. package/examples/impls/case-studies/msft-green-ai.yaml +58 -0
  231. package/examples/impls/case-studies/ntt-data-on-premise.yaml +201 -0
  232. package/examples/impls/tdp-finder-test.yml +19 -0
  233. package/examples/impls/test/azure.yml +26 -0
  234. package/examples/impls/test/ccf.yml +19 -0
  235. package/examples/impls/test/complex-pipeline.yml +67 -0
  236. package/examples/impls/test/if-demo.yml +51 -0
  237. package/examples/impls/test/metadata.yml +20 -0
  238. package/examples/impls/test/nesting.yml +65 -0
  239. package/examples/impls/test/sci-e.yml +21 -0
  240. package/examples/impls/test/sci-m.yml +24 -0
  241. package/examples/impls/test/sci-o.yml +28 -0
  242. package/examples/impls/test/sci.yml +27 -0
  243. package/examples/impls/test/shell.yml +18 -0
  244. package/examples/impls/test/toto.yaml +22 -0
  245. package/examples/ompls/azure.yml +145 -0
  246. package/examples/ompls/ccf.yml +27 -0
  247. package/examples/ompls/complex-pipeline.yml +105 -0
  248. package/examples/ompls/full-sci.yml +64 -0
  249. package/examples/ompls/if-demo.yml +493 -0
  250. package/examples/ompls/metadata.yml +29 -0
  251. package/examples/ompls/nesting.yml +107 -0
  252. package/examples/ompls/sci-e.yml +23 -0
  253. package/examples/ompls/sci-m.yml +33 -0
  254. package/examples/ompls/sci-o.yml +29 -0
  255. package/examples/ompls/sci.yml +36 -0
  256. package/examples/ompls/shell.yml +23 -0
  257. package/jest.config.js +14 -0
  258. package/package.json +71 -0
  259. package/scripts/impact-test.sh +12 -0
  260. package/src/__mocks__/boavizta/countries.json +138 -0
  261. package/src/__mocks__/boavizta/instance_types.json +625 -0
  262. package/src/__mocks__/boavizta/providers.json +1 -0
  263. package/src/__mocks__/watt-time/data.json +119 -0
  264. package/src/config/units.yaml +125 -0
  265. package/src/lib/ccf/aws-embodied.json +5591 -0
  266. package/src/lib/ccf/aws-instances.json +21116 -0
  267. package/src/lib/ccf/aws-use.json +79 -0
  268. package/src/lib/ccf/azure-embodied.json +6547 -0
  269. package/src/lib/ccf/azure-instances.json +8332 -0
  270. package/src/lib/ccf/azure-use.json +58 -0
  271. package/src/lib/ccf/gcp-embodied.json +3049 -0
  272. package/src/lib/ccf/gcp-instances.json +3880 -0
  273. package/src/lib/ccf/gcp-use.json +58 -0
  274. package/src/lib/cloud-instance-metadata/aws-instances.json +1 -0
  275. package/src/lib/cloud-instance-metadata/azure-instances.json +1 -0
  276. package/src/lib/shell-imp/sampler +30 -0
  277. package/src/lib/tdp-finder/README.md +7 -0
  278. package/src/lib/tdp-finder/boavizta_data.csv +1768 -0
  279. package/src/lib/tdp-finder/data.csv +4460 -0
  280. package/src/lib/tdp-finder/data2.csv +2162 -0
  281. package/src/lib/teads-aws/aws-embodied.json +1 -0
  282. package/src/lib/teads-aws/aws-instances.json +1 -0
  283. package/tsconfig.test.json +39 -0
  284. package/tsconfig.tsbuildinfo +1 -0
  285. package/yarn-error.log +5854 -0
@@ -0,0 +1,38 @@
1
+ // For format details, see https://aka.ms/devcontainer.json. For config options, see the
2
+ // README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node
3
+ {
4
+ "name": "Node.js & TypeScript",
5
+ // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
6
+ "image": "mcr.microsoft.com/devcontainers/typescript-node:1-18",
7
+
8
+ // Features to add to the dev container. More info: https://containers.dev/features.
9
+ "features": {
10
+ "ghcr.io/devcontainers/features/node:1": {}
11
+ },
12
+
13
+ // Use 'forwardPorts' to make a list of ports inside the container available locally.
14
+ // "forwardPorts": [],
15
+
16
+ // Use 'postCreateCommand' to run commands after the container is created.
17
+ "postCreateCommand": ". ${NVM_DIR}/nvm.sh && nvm install --lts",
18
+
19
+ "postStartCommand": "yarn install",
20
+
21
+ // Configure tool-specific properties.
22
+ "customizations": {
23
+ // Configure properties specific to VS Code.
24
+ "vscode": {
25
+ // Set *default* container specific settings.json values on container create.
26
+ "settings": {
27
+ },
28
+
29
+ // Add the IDs of extensions you want installed when the container is created.
30
+ "extensions": [
31
+ "esbenp.prettier-vscode",
32
+ "ms-vscode.makefile-tools"
33
+ ]
34
+ }
35
+ },
36
+ // Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
37
+ // "remoteUser": "root"
38
+ }
package/.editorconfig ADDED
@@ -0,0 +1,8 @@
1
+ root = true
2
+
3
+ [*]
4
+ indent_style = space
5
+ indent_size = 2
6
+ end_of_line = lf
7
+ charset = utf-8
8
+ insert_final_newline = true
package/.env.example ADDED
@@ -0,0 +1,9 @@
1
+ AZURE_CLIENT_ID:
2
+ AZURE_TENANT_ID:
3
+ AZURE_CLIENT_SECRET:
4
+ AZURE_CLIENT_SECRET_ID:
5
+ AZURE_APPLICATION_ID:
6
+ AZURE_SUBSCRIPTION_ID:
7
+ AZURE_RESOURCE_ID: /subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.Compute/virtualMachines/<vm-name>
8
+ AZURE_RESOURCE_GROUP_NAME:
9
+ AZURE_VM_NAME:
package/.eslintignore ADDED
@@ -0,0 +1,4 @@
1
+ build/
2
+ dist/
3
+ src/**/**.d.ts
4
+ src/**/**.js
package/.eslintrc.json ADDED
@@ -0,0 +1,8 @@
1
+ {
2
+ "extends": "./node_modules/gts/",
3
+ "rules": {
4
+ "@typescript-eslint/no-explicit-any": [
5
+ "off"
6
+ ]
7
+ }
8
+ }
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: Agenda
3
+ about: The standard agenda template for carbon ql
4
+ title: "GSF IEF Meeting Agenda yyyy-mm-dd"
5
+ labels: agenda
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ Time 11:30am (GMT) / 4:00pm (IST) - See the time in your [timezone](https://everytimezone.com/s/e7e219dd)
11
+
12
+ - Lead – @srini1978 (Microsoft)
13
+ - Co-Lead @navveenb (Accenture)
14
+ - PM – @jawache (GSF)
15
+
16
+ ## Antitrust Policy
17
+ Joint Development Foundation meetings may involve participation by industry competitors, and it is the intention of the Joint Development Foundation to conduct all of its activities in accordance with applicable antitrust and competition laws. It is therefore extremely important that attendees adhere to meeting agendas, and be aware of, and not participate in, any activities that are prohibited under applicable US state, federal or foreign antitrust and competition laws.
18
+
19
+ If you have questions about these matters, please contact your company counsel or counsel to the Joint Development Foundation, DLA Piper.
20
+
21
+ ## Roll Call
22
+ Please add 'Attended' to this issue during the meeting to denote attendance.
23
+ Any untracked attendees will be added by the GSF team below:
24
+
25
+ ## Agenda
26
+ - [ ] Press Record!
27
+
28
+ ### PRs
29
+ - [ ]
30
+
31
+ ### Discussions
32
+ - [ ]
33
+
34
+ ### Issues
35
+ - [ ] Discuss in-progress/blocked issues on project board: https://github.com/orgs/Green-Software-Foundation/projects/26/views/1
36
+ - [ ] AOB
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: Blank issue
3
+ about: Blank issue
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: Feedback
3
+ about: Submiting feedback on the IEF implementation
4
+ title: "Feedback - "
5
+ labels: feedback
6
+ assignees: ''
7
+ ---
8
+
9
+ ## Scope
10
+
11
+ What does your feedback relate to?
12
+
13
+ - [] Project aims/objectives
14
+ - [] Repository structure
15
+ - [] Model plugin
16
+ - [] Rimpl code
17
+ - [] Documentation
18
+ - [] Tests
19
+ - [] Other
20
+
21
+ ## Details
22
+
23
+ Does your feedback relate to a specific problem that can be demonstrated and reproduced? If so, please provide details of how to repro below.
24
+ Include your platform config and the version of IEF you are using (e.g. Ubuntu 20.04, running latest dev branch on XX date).
25
+
26
+ ## Expected Behaviour
27
+
28
+ What do things look like if they are going right?
29
+ e.g. "the github issue board is cleared out every X days"
30
+
31
+ ## Actual behaviour
32
+
33
+ How are things actually working?
34
+ e.g. "issues are sitting on the board for over X days"
35
+
36
+ ## Proposed actions
37
+
38
+ What fixes do you propose?
39
+ e.g. "please define a response time of X days for issues and publish in the project README"
40
+
41
+
42
+ **Note: We will take all feedback seriously. Please be polite and constructive - aggressive or abusive feedback will simply be deleted.**
@@ -0,0 +1,63 @@
1
+ ---
2
+ name: Model Plugin
3
+ about: Submiting a request to create a model plugin
4
+ title: "Model Plugin - "
5
+ labels: model
6
+ assignees: ''
7
+ ---
8
+
9
+ - **What**:
10
+ - **Why**:
11
+ - **DoD**:
12
+ - [ ] Does the model meet the specification?
13
+ - [ ] Does the model have complete test coverage, including edge cases, happy path and error cases?
14
+ - [ ] Is the code documented?
15
+
16
+ ## Config
17
+ - `variable`: If this variable is present in the top level config what behaviour does it trigger? What is the default value if none is provided?
18
+
19
+ ## Inputs
20
+ _List the variables this model expects in an input input_
21
+ - `variable`: Description
22
+
23
+ ## Outputs
24
+ _List the variables this model exports out as an impact_
25
+ - `variable`: Description
26
+
27
+ ## Behavior
28
+ What does the model do to turn the inputs into outputs? List any important equations or references.
29
+
30
+ ## Assumptions
31
+ What are the core assumptions this model makes?
32
+
33
+ ## Limitations
34
+ In what situations is this model limited in it's function, behaviour, accuracy etc...
35
+
36
+ ## Example
37
+ Provide at least one example of some input config and inputs. This is in pimpl format not rimpl format, so the config is the global config and all parameters must be present on the input.
38
+
39
+ ### Input
40
+
41
+ ```yaml
42
+ config:
43
+ key: value
44
+ inputs:
45
+ - timestamp: 2023-07-06T00:00
46
+ duration: 3600
47
+ ```
48
+
49
+ ### Output
50
+
51
+ ```yaml
52
+ config:
53
+ key: value
54
+ inputs:
55
+ - timestamp: 2023-07-06T00:00
56
+ duration: 3600
57
+ yyyy: zzzz
58
+ outputs:
59
+ - timestamp: 2023-07-06T00:00
60
+ duration: 3600
61
+ yyyy: zzzz
62
+ aaaa: bbbb
63
+ ```
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: User story
3
+ about: This describes a user story for IEF
4
+ title: "[User story] ...."
5
+ labels: user-story
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ As a <type of user> I want <some goal> so that <some reason>.
@@ -0,0 +1,21 @@
1
+ ### Types of changes
2
+ <!--- What types of changes does your code introduce? Put an `x` in all the boxes that apply. -->
3
+ - [ ] Enhancement (project structure, spelling, grammar, formatting)
4
+ - [ ] Bug fix (non-breaking change which fixes an issue)
5
+ - [ ] New feature (non-breaking change which adds functionality)
6
+ - [ ] Breaking change (fix or feature that would cause existing functionality to change)
7
+ - [ ] My code follows the code style of this project.
8
+ - [ ] My change requires a change to the documentation.
9
+ - [ ] I have updated the documentation accordingly.
10
+ - [ ] I have added tests to cover my changes.
11
+ - [ ] All new and existing tests passed.
12
+
13
+
14
+ ### A description of the changes proposed in the Pull Request
15
+ <!--- Provide a small description of the changes. -->
16
+ -
17
+ -
18
+
19
+
20
+ <!-- Make sure tests and lint pass on CI. -->
21
+
@@ -0,0 +1,34 @@
1
+ name: Node.js CI
2
+
3
+ on: push
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+
9
+ steps:
10
+ - name: Checkout code
11
+ uses: actions/checkout@v3
12
+
13
+ - name: Set up Node.js
14
+ uses: actions/setup-node@v3
15
+ with:
16
+ node-version: 18
17
+ cache: 'yarn'
18
+
19
+ - name: 'setup python'
20
+ uses: actions/setup-python@v4
21
+ with:
22
+ python-version: '3.11'
23
+
24
+ - name: Install dependencies
25
+ run: yarn install
26
+
27
+ - name: Copy Sample CLI Mocker to bin folder
28
+ run: pip3 install pyyaml && cp src/lib/shell-imp/sampler /usr/local/bin/sampler && chmod +x /usr/local/bin/sampler
29
+
30
+ - name: Run lint
31
+ run: yarn lint
32
+
33
+ - name: Run tests
34
+ run: yarn test --silent
package/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "third-party/ccf-coefficients"]
2
+ path = third-party/ccf-coefficients
3
+ url = https://github.com/cloud-carbon-footprint/ccf-coefficients
package/.prettierrc.js ADDED
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ ...require('gts/.prettierrc.json')
3
+ }
@@ -0,0 +1,194 @@
1
+ # Contributing to IEF <!-- omit from toc -->
2
+
3
+ First off, thanks for taking the time to contribute! 🎉
4
+
5
+ The following document is a rule set of guidelines for contributing.
6
+
7
+ ## Table of Contents <!-- omit from toc -->
8
+
9
+ - [Code Contributions](#code-contributions)
10
+ - [Step 1: Clone](#step-1-clone)
11
+ - [Step 2: Branch](#step-2-branch)
12
+ - [Step 3: Commit](#step-3-commit)
13
+ - [Step 4: Sync](#step-4-sync)
14
+ - [Step 5: Push](#step-5-push)
15
+ - [Step 6: Pull Request](#step-6-pull-request)
16
+ - [Commit message guidelines](#commit-message-guidelines)
17
+ - [Coding guidelines](#coding-guidelines)
18
+ - [Code structuring patterns](#code-structuring-patterns)
19
+ - [Object Oriented Programming](#object-oriented-programming)
20
+ - [Functional Programming](#functional-programming)
21
+ - [Naming patterns](#naming-patterns)
22
+ - [Documentation](#documentation)
23
+ - [Writing tests](#writing-tests)
24
+
25
+ ## Code Contributions
26
+
27
+ #### Step 1: Clone
28
+
29
+ Clone the project on [GitHub](git@github.com:Green-Software-Foundation/ief.git)
30
+
31
+ ```bash
32
+ $ git clone git@github.com:Green-Software-Foundation/ief.git
33
+ $ cd ief
34
+ ```
35
+
36
+ For developing new features and bug fixes, the development branch should be pulled and built upon.
37
+
38
+ #### Step 2: Branch
39
+
40
+ Create new branch from main (`staging` or `master`), which will contain your new feature, fix or change.
41
+
42
+ ```bash
43
+ $ git checkout -b <topic-branch-name>
44
+ ```
45
+
46
+ #### Step 3: Commit
47
+
48
+ Make sure git knows your name and email address:
49
+
50
+ ```bash
51
+ $ git config --global user.name "Example User"
52
+ $ git config --global user.email "user@example.com"
53
+ ```
54
+
55
+ Commiting multiple files with changes on multiple resources is not allowed.
56
+ Commit message should clearly describe on which resource changes are made.
57
+
58
+ Add and commit:
59
+
60
+ ```bash
61
+ $ git add my/changed/files
62
+ $ git commit
63
+ ```
64
+
65
+ Commit your changes in logical chunks. Please do not push all changes in one commit.
66
+
67
+ > Run `yarn fix` before commiting for not having conflict with CI linter.
68
+
69
+ Please adhere to these [Commit message guidelines](#commit-message-guidelines)
70
+ or your code is unlikely be merged into the main project.
71
+
72
+ #### Step 4: Sync
73
+
74
+ Use git pull/merge to synchronize your work with the main repository.
75
+
76
+ ```bash
77
+ $ git pull origin dev
78
+ ```
79
+
80
+ #### Step 5: Push
81
+
82
+ Push your topic branch:
83
+
84
+ ```bash
85
+ $ git push origin <topic-branch-name>
86
+ ```
87
+
88
+ #### Step 6: Pull Request
89
+
90
+ Open a Pull Request with a clear title and description according to [template](.github/PULL_REQUEST_TEMPLATE.md).
91
+
92
+ Pull request should pass all CI which are defined, should have at least one approve. It should adher to the specification for getting approved.
93
+
94
+ CI included lint checks, running tests, and etc.
95
+
96
+ ## Commit message guidelines
97
+
98
+ The commit message should describe what changed and why.
99
+
100
+ 1. The first line should:
101
+ * contain a short description of the change
102
+ * be 60 characters or less
103
+ * be prefixed with the name of the changed subsystem
104
+ * be entirely in lowercase with the exception of proper nouns, acronyms, and the words that refer to code,
105
+ like function/variable names
106
+
107
+ Examples:
108
+
109
+ ```
110
+ util: add getInitializedModel method to models.
111
+ deps: add express package to dependencies.
112
+ service: refactor get user.
113
+ ```
114
+ 2. Keep the second line blank.
115
+
116
+ 3. Wrap all other lines at 72 columns:
117
+ * describe each line in logical chunks
118
+ * start each line with: space hyphen space ( - ...)
119
+ * be entirely in lowercase with the exception of proper nouns, acronyms, and the words that refer to code,
120
+ like function/variable names
121
+
122
+ Examples:
123
+
124
+ ```
125
+ - remove deprecated logger
126
+ - refactor some method
127
+ - add JSDoc on existing function
128
+ ```
129
+ ## Coding guidelines
130
+
131
+ #### Code structuring patterns
132
+
133
+ Avoid having functions which are responsible to do multiple things at the same time. Make sure one function/method does one thing, and does it well.
134
+
135
+ ###### Object Oriented Programming
136
+
137
+ While following `Object Oriented Programming` paradigm, it's important to follow [SOLID](https://en.wikipedia.org/wiki/SOLID) principles.
138
+
139
+ ###### Functional Programming
140
+
141
+ When designing module of the application in `Functional Programming` paradigm, the key to follow [basic](https://dev.to/jamesrweb/principles-of-functional-programming-4b7c) principles.
142
+
143
+ #### Naming patterns
144
+
145
+ Make sure your `class/function/variable` describes exactly what it does. Avoid using shortened words like txt, arr while doing naming decision. As a naming pattern `camel case` should be used.
146
+
147
+ ```ts
148
+ ❌ const a = "<MOCK_VALUE_HERE>"
149
+ ✅ const mockValue = "<MOCK_VALUE_HERE>"
150
+
151
+ ❌ const a = (txt: string) => console.log(txt)
152
+ ✅ const logMessage = (message: string) => console.log(message)
153
+ ```
154
+
155
+ #### Documentation
156
+
157
+ Every logical unit (`Class, function, method`) should be covered with appropriate documentation. For documenting such, multi-line comment style is used.
158
+
159
+ ```ts
160
+ ❌ const a = (message: string) => console.log(message)
161
+
162
+
163
+ /**
164
+ * Logs given `message` to console.
165
+ **/
166
+ const logMessage = (message: string) => console.log(message)
167
+ ```
168
+
169
+ For documenting variable, expression, single line comments can be used after declaration.
170
+
171
+ ```ts
172
+ class MockClass {
173
+ // this is a mock field
174
+ ❌ private mockField: string = "mock-field"
175
+ ✅ private mockField: string = "mock-field" // Single line documenting style is used.
176
+ }
177
+ ```
178
+
179
+ #### Writing tests
180
+
181
+ One test file should be responsible for one module. `describe` blocks should be used for module and function/method description. First `describe` should follow `resource/module: ` pattern. Second describe title should follow `method(): ` pattern. Test units can use either `test` or `it`, title should exactly describe behaviour and input argument. Make sure each test case covers one branch.
182
+
183
+ See example:
184
+ ```ts
185
+ describe('util/args: ', () => {
186
+ describe('parseProcessArgument(): ', () => {
187
+ it('logs help message if property present in env.', () => {
188
+ ...
189
+ })
190
+ })
191
+ })
192
+ ```
193
+
194
+ *[⬅️ back to the root](/README.md#ief)*
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Green Software Foundation
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/Makefile ADDED
@@ -0,0 +1,16 @@
1
+
2
+
3
+ #Converts the CSV files from CCF Coefficients Database to JSON.
4
+ ccf-data:
5
+ cat third-party/ccf-coefficients/data/aws-instances.csv | python -c 'import csv, json, sys; print(json.dumps([dict(r) for r in csv.DictReader(sys.stdin)]))' > lib/ccf/aws-instances.json
6
+ cat third-party/ccf-coefficients/output/coefficients-aws-use.csv | python -c 'import csv, json, sys; print(json.dumps([dict(r) for r in csv.DictReader(sys.stdin)]))' > lib/ccf/aws-use.json
7
+ cat third-party/ccf-coefficients/output/coefficients-aws-embodied.csv | python -c 'import csv, json, sys; print(json.dumps([dict(r) for r in csv.DictReader(sys.stdin)]))' > lib/ccf/aws-embodied.json
8
+ cat third-party/ccf-coefficients/data/gcp-instances.csv | python -c 'import csv, json, sys; print(json.dumps([dict(r) for r in csv.DictReader(sys.stdin)]))' > lib/ccf/gcp-instances.json
9
+ cat third-party/ccf-coefficients/output/coefficients-gcp-use.csv | python -c 'import csv, json, sys; print(json.dumps([dict(r) for r in csv.DictReader(sys.stdin)]))' > lib/ccf/gcp-use.json
10
+ cat third-party/ccf-coefficients/output/coefficients-gcp-embodied.csv | python -c 'import csv, json, sys; print(json.dumps([dict(r) for r in csv.DictReader(sys.stdin)]))' > lib/ccf/gcp-embodied.json
11
+ cat third-party/ccf-coefficients/data/azure-instances.csv | python -c 'import csv, json, sys; print(json.dumps([dict(r) for r in csv.DictReader(sys.stdin)]))' > lib/ccf/azure-instances.json
12
+ cat third-party/ccf-coefficients/output/coefficients-azure-use.csv | python -c 'import csv, json, sys; print(json.dumps([dict(r) for r in csv.DictReader(sys.stdin)]))' > lib/ccf/azure-use.json
13
+ cat third-party/ccf-coefficients/output/coefficients-azure-embodied.csv | python -c 'import csv, json, sys; print(json.dumps([dict(r) for r in csv.DictReader(sys.stdin)]))' > lib/ccf/azure-embodied.json
14
+
15
+ install-shell-imp:
16
+ cp src/lib/shell-imp/sampler /usr/local/bin/sampler
package/README.md ADDED
@@ -0,0 +1,67 @@
1
+ # Impact Engine Framework
2
+
3
+ [Impact Engine Framework](https://greensoftwarefoundation.atlassian.net/wiki/spaces/~612dd45e45cd76006a84071a/pages/17072136/Opensource+Impact+Engine+Framework) is an [Incubation](https://oc.greensoftware.foundation/project-lifecycle.html#incubation) project from the [Open Source Working Group](https://greensoftwarefoundation.atlassian.net/wiki/spaces/~612dd45e45cd76006a84071a/pages/852049/Open+Source+Working+Group) in the [Green Software Foundation](https://greensoftware.foundation/).
4
+
5
+ **IEF** is a framework to **M**odel, **M**easure, si**M**ulate and **M**onitor the environmental impacts of software
6
+
7
+ Modern applications are composed of many smaller pieces of software (components) running on many different environments, for example, private cloud, public cloud, bare-metal, virtualized, containerized, mobile, laptops, and desktops.
8
+
9
+ Every environment requires a different model of measurement, and there is no single solution you can use to calculate the environmental impacts for all components across all environments.
10
+
11
+ The friction to measuring software emissions isn't that we need to know how, it's that we run software on many things and each thing has several different ways to measure.
12
+
13
+ Read the [specification and design docs](https://github.com/Green-Software-Foundation/if-docs) to begin.
14
+
15
+
16
+ ## Get started
17
+
18
+ The first thing to understand is that IF is a framework for running model plugins. This means that in order to do some calculations, you need to load some models from some external resource. We provide a [standard library of models](https://github.com/Green-Software-Foundation/if-models) and a repository of [community models](https://github.com/Green-Software-Foundation/if-community-models) to get you started.
19
+
20
+ Start by installing some models:
21
+
22
+ ```sh
23
+ yarn add https://github.com/Green-Software-Foundation/if-models
24
+ ```
25
+
26
+ Then create an `impl` file that describes your application (see our docs for a detailed explanation).
27
+
28
+ Then, run `impact-engine` using the following command:
29
+
30
+ ```sh
31
+ npx ts-node impact-engine.ts --impl <path-to-your-impl-file>
32
+ ```
33
+
34
+ You can also add an optional savepath for your output yaml (if you do not provide one, the output will be printed to the console):
35
+
36
+ ```sh
37
+ npx ts-node impact-engine.ts --impl <path-to-your-impl-file> --ompl <your-savepath>
38
+ ```
39
+
40
+ The `impact-engine` CLI tool will configure and run the models defined in your input `yaml` (`impl`) and return the results as an output `yaml` (`ompl`).
41
+
42
+ ## Video walk-through
43
+
44
+ Watch this video to learn how to create and run an `impl`.
45
+
46
+ [![Watch the walk-through video](https://i3.ytimg.com/vi/R-6eDM8AsvY/maxresdefault.jpg)](https://youtu.be/R-6eDM8AsvY)
47
+
48
+
49
+ ## Run tests
50
+
51
+ To run the complete set of tests simply run
52
+
53
+ ```sh
54
+ yarn test
55
+ ```
56
+
57
+ To refresh the set of `ompl`s used for validating the output files, run the `scripts/impact-test.sh` bash script (for unix only) as follows:
58
+
59
+ ```sh
60
+ ./scripts/impact-test.sh
61
+ ```
62
+
63
+ Then run
64
+
65
+ ```sh
66
+ yarn test
67
+ ```
@@ -0,0 +1,11 @@
1
+ export declare class MockAzureCredentials {
2
+ }
3
+ export declare class MockMonitorClient {
4
+ metrics: any;
5
+ constructor();
6
+ }
7
+ export declare class MockComputeManagementClient {
8
+ virtualMachines: any;
9
+ resourceSkus: any;
10
+ constructor();
11
+ }