Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix aggregation config #941

Closed
4 tasks
jmcook1186 opened this issue Aug 6, 2024 · 0 comments · Fixed by #943
Closed
4 tasks

Fix aggregation config #941

jmcook1186 opened this issue Aug 6, 2024 · 0 comments · Fixed by #943
Assignees

Comments

@jmcook1186
Copy link
Contributor

jmcook1186 commented Aug 6, 2024

What
After the recent refactoring where aggregation-method was moved into the parameter-metadata we have two conflicting ways to define the aggregation method - it is still an expected field in the to level aggregation config. We need to remove this field from the top level config to unblock the method definition in the metadata.

Why
We currently have two conflicting places to define aggregation method.

Context
part of parameter metadata upgrade

Currently the aggregation config looks as follows, with method being a required field:

aggregation:
  metrics:
    "cpu/utilization":
      method: avg
  type: both

It should be updated to the following:

aggregation:
  metrics: 
    - carbon
    - energy
  type: both

Prerequisites/resources
n/a

SoW (scope of work)

  • update config as described above
  • update manifests that use aggregate feature
  • documentation updated
  • test cases added if necessary

Acceptance criteria

Given (Setup): The requested changes have been made

When (Action): i run the following manifest

name: sci
description: successful path
tags:
explainer: true
aggregation:
  metrics: 
    - carbon
  type: both
initialize:
  plugins:
    mock-observations:
      kind: plugin
      method: MockObservations
      path: "builtin"
      global-config:
        timestamp-from: 2023-07-06T00:00
        timestamp-to: 2023-07-06T00:10
        duration: 60
        components:
          - cloud/instance-type: A1
          - cloud/instance-type: B1
        generators:
          common:
            region: uk-west
            # common-key: common-val
          randint:
            carbon:
              min: 1
              max: 50
            requests:
              min: 1
              max: 999
    sci:
      kind: plugin
      method: Sci
      path: "builtin"
      global-config:
        functional-unit: requests
      parameter-metadata:
        inputs:
          carbon:
            description: grams of CO2eq
            unit: gCO2eq
            aggregation-method: sum
          requests:
            description: number of requests made to API
            unit: requests
            aggregation-method: sum
tree:
  children:
    child:
      pipeline:
        observe:
          - mock-observations
        compute:
          - sci
      inputs:

Then (Assertion): I get the following result

name: sci
description: successful path
tags: null
explainer: true
aggregation:
  metrics:
    carbon:
      method: avg
  type: both
initialize:
  plugins:
    mock-observations:
      path: builtin
      method: MockObservations
      global-config:
        timestamp-from: 2023-07-06T00:00
        timestamp-to: 2023-07-06T00:10
        duration: 60
        components:
          - cloud/instance-type: A1
          - cloud/instance-type: B1
        generators:
          common:
            region: uk-west
          randint:
            carbon:
              min: 1
              max: 50
            requests:
              min: 1
              max: 999
    sci:
      path: builtin
      method: Sci
      global-config:
        functional-unit: requests
      parameter-metadata:
        inputs:
          carbon:
            unit: gCO2eq
            description: grams of CO2eq
            aggregation-method: sum
          requests:
            unit: requests
            description: number of requests made to API
            aggregation-method: sum
execution:
  command: >-
    /home/user/.npm/_npx/1bf7c3c15bf47d04/node_modules/.bin/ts-node
    /home/user/Code/if/src/if-run/index.ts --observe --compute -m
    manifests/examples/demo.yml
  environment:
    if-version: 0.5.0
    os: linux
    os-version: 5.15.0-117-generic
    node-version: 21.4.0
    date-time: 2024-08-06T15:10:59.803Z (UTC)
    dependencies:
      - '@babel/[email protected]'
      - '@babel/[email protected]'
      - '@commitlint/[email protected]'
      - '@commitlint/[email protected]'
      - '@grnsft/[email protected]'
      - '@jest/[email protected]'
      - '@types/[email protected]'
      - '@types/[email protected]'
      - '@types/[email protected]'
      - '@types/[email protected]'
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
      - [email protected]
  status: success
explain:
  mock-observations:
    method: MockObservations
    path: builtin
    inputs: undefined
    outputs: undefined
tree:
  children:
    child:
      pipeline:
        observe:
          - mock-observations
        compute:
          - sci
      inputs:
        - timestamp: '2023-07-06T00:00:00.000Z'
          duration: 60
          cloud/instance-type: A1
          region: uk-west
          carbon: 47
          requests: 980
        - timestamp: '2023-07-06T00:01:00.000Z'
          duration: 60
          cloud/instance-type: A1
          region: uk-west
          carbon: 47
          requests: 201
        - timestamp: '2023-07-06T00:02:00.000Z'
          duration: 60
          cloud/instance-type: A1
          region: uk-west
          carbon: 2
          requests: 813
        - timestamp: '2023-07-06T00:03:00.000Z'
          duration: 60
          cloud/instance-type: A1
          region: uk-west
          carbon: 34
          requests: 458
        - timestamp: '2023-07-06T00:04:00.000Z'
          duration: 60
          cloud/instance-type: A1
          region: uk-west
          carbon: 31
          requests: 285
        - timestamp: '2023-07-06T00:05:00.000Z'
          duration: 60
          cloud/instance-type: A1
          region: uk-west
          carbon: 13
          requests: 518
        - timestamp: '2023-07-06T00:06:00.000Z'
          duration: 60
          cloud/instance-type: A1
          region: uk-west
          carbon: 2
          requests: 897
        - timestamp: '2023-07-06T00:07:00.000Z'
          duration: 60
          cloud/instance-type: A1
          region: uk-west
          carbon: 22
          requests: 938
        - timestamp: '2023-07-06T00:08:00.000Z'
          duration: 60
          cloud/instance-type: A1
          region: uk-west
          carbon: 1
          requests: 185
        - timestamp: '2023-07-06T00:09:00.000Z'
          duration: 60
          cloud/instance-type: A1
          region: uk-west
          carbon: 45
          requests: 940
        - timestamp: '2023-07-06T00:00:00.000Z'
          duration: 60
          cloud/instance-type: B1
          region: uk-west
          carbon: 6
          requests: 18
        - timestamp: '2023-07-06T00:01:00.000Z'
          duration: 60
          cloud/instance-type: B1
          region: uk-west
          carbon: 19
          requests: 739
        - timestamp: '2023-07-06T00:02:00.000Z'
          duration: 60
          cloud/instance-type: B1
          region: uk-west
          carbon: 32
          requests: 273
        - timestamp: '2023-07-06T00:03:00.000Z'
          duration: 60
          cloud/instance-type: B1
          region: uk-west
          carbon: 18
          requests: 288
        - timestamp: '2023-07-06T00:04:00.000Z'
          duration: 60
          cloud/instance-type: B1
          region: uk-west
          carbon: 8
          requests: 109
        - timestamp: '2023-07-06T00:05:00.000Z'
          duration: 60
          cloud/instance-type: B1
          region: uk-west
          carbon: 35
          requests: 264
        - timestamp: '2023-07-06T00:06:00.000Z'
          duration: 60
          cloud/instance-type: B1
          region: uk-west
          carbon: 1
          requests: 364
        - timestamp: '2023-07-06T00:07:00.000Z'
          duration: 60
          cloud/instance-type: B1
          region: uk-west
          carbon: 13
          requests: 87
        - timestamp: '2023-07-06T00:08:00.000Z'
          duration: 60
          cloud/instance-type: B1
          region: uk-west
          carbon: 16
          requests: 282
        - timestamp: '2023-07-06T00:09:00.000Z'
          duration: 60
          cloud/instance-type: B1
          region: uk-west
          carbon: 8
          requests: 907
      outputs:
        - timestamp: '2023-07-06T00:00:00.000Z'
          duration: 60
          cloud/instance-type: A1
          region: uk-west
          carbon: 47
          requests: 980
          sci: 0.04795918367346939
        - timestamp: '2023-07-06T00:01:00.000Z'
          duration: 60
          cloud/instance-type: A1
          region: uk-west
          carbon: 47
          requests: 201
          sci: 0.23383084577114427
        - timestamp: '2023-07-06T00:02:00.000Z'
          duration: 60
          cloud/instance-type: A1
          region: uk-west
          carbon: 2
          requests: 813
          sci: 0.0024600246002460025
        - timestamp: '2023-07-06T00:03:00.000Z'
          duration: 60
          cloud/instance-type: A1
          region: uk-west
          carbon: 34
          requests: 458
          sci: 0.07423580786026202
        - timestamp: '2023-07-06T00:04:00.000Z'
          duration: 60
          cloud/instance-type: A1
          region: uk-west
          carbon: 31
          requests: 285
          sci: 0.10877192982456141
        - timestamp: '2023-07-06T00:05:00.000Z'
          duration: 60
          cloud/instance-type: A1
          region: uk-west
          carbon: 13
          requests: 518
          sci: 0.025096525096525095
        - timestamp: '2023-07-06T00:06:00.000Z'
          duration: 60
          cloud/instance-type: A1
          region: uk-west
          carbon: 2
          requests: 897
          sci: 0.002229654403567447
        - timestamp: '2023-07-06T00:07:00.000Z'
          duration: 60
          cloud/instance-type: A1
          region: uk-west
          carbon: 22
          requests: 938
          sci: 0.023454157782515993
        - timestamp: '2023-07-06T00:08:00.000Z'
          duration: 60
          cloud/instance-type: A1
          region: uk-west
          carbon: 1
          requests: 185
          sci: 0.005405405405405406
        - timestamp: '2023-07-06T00:09:00.000Z'
          duration: 60
          cloud/instance-type: A1
          region: uk-west
          carbon: 45
          requests: 940
          sci: 0.047872340425531915
        - timestamp: '2023-07-06T00:00:00.000Z'
          duration: 60
          cloud/instance-type: B1
          region: uk-west
          carbon: 6
          requests: 18
          sci: 0.3333333333333333
        - timestamp: '2023-07-06T00:01:00.000Z'
          duration: 60
          cloud/instance-type: B1
          region: uk-west
          carbon: 19
          requests: 739
          sci: 0.02571041948579161
        - timestamp: '2023-07-06T00:02:00.000Z'
          duration: 60
          cloud/instance-type: B1
          region: uk-west
          carbon: 32
          requests: 273
          sci: 0.11721611721611722
        - timestamp: '2023-07-06T00:03:00.000Z'
          duration: 60
          cloud/instance-type: B1
          region: uk-west
          carbon: 18
          requests: 288
          sci: 0.0625
        - timestamp: '2023-07-06T00:04:00.000Z'
          duration: 60
          cloud/instance-type: B1
          region: uk-west
          carbon: 8
          requests: 109
          sci: 0.07339449541284404
        - timestamp: '2023-07-06T00:05:00.000Z'
          duration: 60
          cloud/instance-type: B1
          region: uk-west
          carbon: 35
          requests: 264
          sci: 0.13257575757575757
        - timestamp: '2023-07-06T00:06:00.000Z'
          duration: 60
          cloud/instance-type: B1
          region: uk-west
          carbon: 1
          requests: 364
          sci: 0.0027472527472527475
        - timestamp: '2023-07-06T00:07:00.000Z'
          duration: 60
          cloud/instance-type: B1
          region: uk-west
          carbon: 13
          requests: 87
          sci: 0.14942528735632185
        - timestamp: '2023-07-06T00:08:00.000Z'
          duration: 60
          cloud/instance-type: B1
          region: uk-west
          carbon: 16
          requests: 282
          sci: 0.05673758865248227
        - timestamp: '2023-07-06T00:09:00.000Z'
          duration: 60
          cloud/instance-type: B1
          region: uk-west
          carbon: 8
          requests: 907
          sci: 0.008820286659316428
      aggregated:
        carbon: 400
  outputs:
    - carbon: 47
      timestamp: '2023-07-06T00:00:00.000Z'
      duration: 60
    - carbon: 47
      timestamp: '2023-07-06T00:01:00.000Z'
      duration: 60
    - carbon: 2
      timestamp: '2023-07-06T00:02:00.000Z'
      duration: 60
    - carbon: 34
      timestamp: '2023-07-06T00:03:00.000Z'
      duration: 60
    - carbon: 31
      timestamp: '2023-07-06T00:04:00.000Z'
      duration: 60
    - carbon: 13
      timestamp: '2023-07-06T00:05:00.000Z'
      duration: 60
    - carbon: 2
      timestamp: '2023-07-06T00:06:00.000Z'
      duration: 60
    - carbon: 22
      timestamp: '2023-07-06T00:07:00.000Z'
      duration: 60
    - carbon: 1
      timestamp: '2023-07-06T00:08:00.000Z'
      duration: 60
    - carbon: 45
      timestamp: '2023-07-06T00:09:00.000Z'
      duration: 60
    - carbon: 6
      timestamp: '2023-07-06T00:00:00.000Z'
      duration: 60
    - carbon: 19
      timestamp: '2023-07-06T00:01:00.000Z'
      duration: 60
    - carbon: 32
      timestamp: '2023-07-06T00:02:00.000Z'
      duration: 60
    - carbon: 18
      timestamp: '2023-07-06T00:03:00.000Z'
      duration: 60
    - carbon: 8
      timestamp: '2023-07-06T00:04:00.000Z'
      duration: 60
    - carbon: 35
      timestamp: '2023-07-06T00:05:00.000Z'
      duration: 60
    - carbon: 1
      timestamp: '2023-07-06T00:06:00.000Z'
      duration: 60
    - carbon: 13
      timestamp: '2023-07-06T00:07:00.000Z'
      duration: 60
    - carbon: 16
      timestamp: '2023-07-06T00:08:00.000Z'
      duration: 60
    - carbon: 8
      timestamp: '2023-07-06T00:09:00.000Z'
      duration: 60
  aggregated:
    carbon: 400
@jmcook1186 jmcook1186 added this to IF Aug 6, 2024
@zanete zanete moved this to Ready in IF Aug 6, 2024
@zanete zanete moved this from Ready to In Progress in IF Aug 6, 2024
@zanete zanete added this to the Inputs and Outputs milestone Aug 6, 2024
@manushak manushak moved this from In Progress to Pending Review in IF Aug 7, 2024
@manushak manushak linked a pull request Aug 7, 2024 that will close this issue
9 tasks
@github-project-automation github-project-automation bot moved this from Pending Review to Done in IF Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants