Skip to content

Commit

Permalink
Fixing TeadsAWS naming and other variables
Browse files Browse the repository at this point in the history
Signed-off-by: Gnanakeethan Balasubramaniam <[email protected]>
  • Loading branch information
gnanakeethan committed Sep 1, 2023
1 parent 21d5f2d commit 57597d1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions docs/implementations/teads-aws.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ Resulting values are an approximation / estimation based on the testing done by

## Example
```typescript
import {TEADSEngineeringAWS} from 'ief';
import {TeadsAWS} from 'ief';

const teads = new TEADSEngineeringAWS();
const teads = new TeadsAWS();
teads.configure({
instance_type: 'c6i.large'
})
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"dependencies": {
"@cloud-carbon-footprint/core": "*",
"@cloud-carbon-footprint/aws": "^0.14.5",
"typescript-cubic-spline": "*",
"@types/node": "^20.4.5",
"axios": "^1.4.0",
"js-yaml": "^4.1.0",
Expand Down
14 changes: 10 additions & 4 deletions src/lib/teads-aws/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import * as AWS_INSTANCES from './aws-instances.json';
import * as AWS_EMBODIED from './aws-embodied.json';
import {KeyValuePair} from '../../types/boavizta';

export class TEADSEngineeringAWS implements IImpactModelInterface {
export enum Interpolation {
SPLINE = 'spline',
LINEAR = 'linear',
}

export class TeadsAWS implements IImpactModelInterface {
// Defined for compatibility. Not used in TEADS.
authParams: object | undefined;
// name of the data source
Expand All @@ -17,6 +22,7 @@ export class TEADSEngineeringAWS implements IImpactModelInterface {
// list of all the by Architecture
private instanceType = '';
private expectedLifespan = 4;
private interpolation = Interpolation.SPLINE;

Check failure on line 25 in src/lib/teads-aws/index.ts

View workflow job for this annotation

GitHub Actions / build

'interpolation' is declared but its value is never read.

constructor() {
this.standardizeInstanceMetrics();
Expand Down Expand Up @@ -91,8 +97,8 @@ export class TEADSEngineeringAWS implements IImpactModelInterface {
const m = this.embodiedEmissions(observation);

results.push({
e: e,
m: m,
energy: e,
embodied: m,
});
});
}
Expand All @@ -113,7 +119,7 @@ export class TEADSEngineeringAWS implements IImpactModelInterface {
private calculateEnergy(observation: KeyValuePair) {
if (
!('duration' in observation) ||
!('cpu' in observation) ||
!('cpu-util' in observation) ||
!('datetime' in observation)
) {
throw new Error(
Expand Down

0 comments on commit 57597d1

Please sign in to comment.