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

Implement GCD calculation and resampling resolution for time sync #1109

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

narekhovhannisyan
Copy link
Member

Types of changes

  • Enhancement (project structure, spelling, grammar, formatting)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • have updated the documentation accordingly.
  • I have added tests to cover my changes.

A description of the changes proposed in the Pull Request

@narekhovhannisyan
Copy link
Member Author

name: nesting
description: a manifest that includes nested child components
tags:
  kind: web
  complexity: moderate
  category: on-premise
aggregation:
  metrics:
    - carbon
  type: "both"
initialize:
  plugins:
    "interpolate":
      method: Interpolation
      path: "builtin"
      config:
        method: linear
        x: [0, 10, 50, 100]
        y: [0.12, 0.32, 0.75, 1.02]
        input-parameter: "cpu/utilization"
        output-parameter: "cpu-factor"
      parameter-metadata:
        inputs:
          cpu/utilization:
            unit: percentage
            description: refers to CPU utilization.
            aggregation-method:
              time: avg
              component: sum
        outputs:
          cpu-factor:
            unit: kWh
            description: result of interpolate
            aggregation-method:
              time: avg
              component: avg
    "cpu-factor-to-wattage":
      method: Multiply
      path: builtin
      config:
        input-parameters: ["cpu-factor", "cpu/thermal-design-power"]
        output-parameter: "cpu-wattage"
      parameter-metadata:
        inputs:
          cpu-factor:
            unit: kWh
            description: result of interpolate
            aggregation-method:
              time: avg
              component: avg
          cpu/thermal-design-power:
            unit: kWh
            description: thermal design power for a processor
            aggregation-method:
              time: avg
              component: avg
        outputs:
          cpu-wattage:
            unit: kWh
            description: the energy used by the CPU
            aggregation-method:
              time: sum
              component: sum
    "wattage-times-duration":
      method: Multiply
      path: builtin
      config:
        input-parameters: ["cpu-wattage", "duration"]
        output-parameter: "cpu-wattage-times-duration"
    "wattage-to-energy-kwh":
      method: Divide
      path: "builtin"
      config:
        numerator: cpu-wattage-times-duration
        denominator: 3600000
        output: cpu-energy-raw
      parameter-metadata:
        inputs:
          cpu-wattage-times-duration:
            unit: kWh
            description: CPU wattage multiplied by duration
            aggregation-method:
              time: sum
              component: sum
        outputs:
          cpu-energy-raw:
            unit: kWh
            description: Raw energy used by CPU in kWh
            aggregation-method:
              time: sum
              component: sum
    "calculate-vcpu-ratio":
      method: Divide
      path: "builtin"
      config:
        numerator: vcpus-total
        denominator: vcpus-allocated
        output: vcpu-ratio
      parameter-metadata:
        outputs:
          vcpu-ratio:
            unit: none
            description: Ratio of vCPUs
            aggregation-method:
              time: copy
              component: copy
    "correct-cpu-energy-for-vcpu-ratio":
      method: Divide
      path: "builtin"
      config:
        numerator: cpu-energy-raw
        denominator: vcpu-ratio
        output: cpu-energy-kwh
    sci-embodied:
      path: "builtin"
      method: SciEmbodied
    "operational-carbon":
      method: Multiply
      path: builtin
      config:
        input-parameters: ["cpu-energy-kwh", "grid/carbon-intensity"]
        output-parameter: "carbon-operational"
      parameter-metadata:
        inputs:
          cpu-energy-kwh:
            unit: kWh
            description: Corrected CPU energy in kWh
            aggregation-method:
              time: sum
              component: sum
          grid/carbon-intensity:
            unit: gCO2eq/kWh
            description: Carbon intensity for the grid
            aggregation-method:
              time: avg
              component: avg
        outputs:
          carbon-operational:
            unit: gCO2eq
            description: Operational carbon footprint
            aggregation-method:
              time: sum
              component: sum
    sci:
      path: "builtin"
      method: Sci
      config:
        functional-unit: "requests"
      parameter-metadata:
        inputs:
          requests:
            unit: none
            description: expressed the final SCI value
            aggregation-method:
              time: sum
              component: sum
    "sum-carbon":
      path: "builtin"
      method: Sum
      config:
        input-parameters:
          - carbon-operational
          - embodied-carbon
        output-parameter: carbon
      parameter-metadata:
        inputs:
          carbon-operational:
            description: Operational carbon footprint
            unit: gCO2eq
            aggregation-method:
              time: sum
              component: sum
          embodied-carbon:
            description: Embodied carbon footprint
            unit: gCO2eq
            aggregation-method:
              time: sum
              component: sum
        outputs:
          carbon:
            description: Total carbon footprint
            unit: gCO2eq
            aggregation-method:
              time: sum
              component: sum
    time-sync:
      method: TimeSync
      path: "builtin"
      config:
        start-time: '2023-01-01T00:00:00.000Z'
        end-time: '2024-01-01T00:00:00.000Z'
        interval: 100000000
        allow-padding: true
      parameter-metadata:
        inputs:
          timestamp:
            unit: RFC3339
            description: refers to the time of occurrence of the input
            aggregation-method:
              time: none
              component: none
          duration:
            unit: seconds
            description: refers to the duration of the input
            aggregation-method:
              time: sum
              component: sum
          cloud/instance-type:
            unit: none
            description: type of Cloud Instance name used in the cloud provider APIs
            aggregation-method:
              time: copy
              component: copy
          cloud/region:
            unit: none
            description: region cloud instance
            aggregation-method:
              time: copy
              component: copy
          time-reserved:
            unit: seconds
            description: time reserved for a component
            aggregation-method:
              time: avg
              component: avg
          network/energy:
            description: "Energy consumed by the Network of the component"
            unit: "kWh"
            aggregation-method:
              time: sum
              component: sum

tree:
  children:
    child-0:
      defaults:
        cpu/thermal-design-power: 100
        grid/carbon-intensity: 800
        device/emissions-embodied: 1533.120 # gCO2eq
        time-reserved: 3600 # 1hr in seconds
        device/expected-lifespan: 94608000 # 3 years in seconds
        vcpus-allocated: 1
        vcpus-total: 8
      pipeline:
        compute:
          - interpolate
          - cpu-factor-to-wattage
          - wattage-times-duration
          - wattage-to-energy-kwh
          - calculate-vcpu-ratio
          - correct-cpu-energy-for-vcpu-ratio
          - sci-embodied
          - operational-carbon
          - sum-carbon
          - time-sync
          - sci
      inputs:
        - timestamp: "2023-01-01T00:00:00.000Z"
          cloud/instance-type: A1
          cloud/region: uk-west
          duration: 2629800
          cpu/utilization: 50
          network/energy: 0.000001
          requests: 50
        - timestamp: "2023-02-01T00:00:00.000Z"
          duration: 2419200
          cpu/utilization: 20
          cloud/instance-type: A1
          cloud/region: uk-west
          network/energy: 0.000001
          requests: 60
        - timestamp: "2023-03-01T00:00:00.000Z"
          duration: 2629800
          cpu/utilization: 15
          cloud/instance-type: A1
          cloud/region: uk-west
          network/energy: 0.000001
          requests: 70
        - timestamp: "2023-04-01T00:00:00.000Z"
          duration: 2592000
          cloud/instance-type: A1
          cloud/region: uk-west
          cpu/utilization: 15
          network/energy: 0.000001
          requests: 55
        - timestamp: "2023-05-01T00:00:00.000Z"
          duration: 2629800
          cloud/instance-type: A1
          cloud/region: uk-west
          cpu/utilization: 15
          network/energy: 0.000001
          requests: 55
        - timestamp: "2023-06-01T00:00:00.000Z"
          duration: 2592000
          cloud/instance-type: A1
          cloud/region: uk-west
          cpu/utilization: 15
          network/energy: 0.000001
          requests: 55
        - timestamp: "2023-07-01T00:00:00.000Z"
          duration: 2629800
          cloud/instance-type: A1
          cloud/region: uk-west
          cpu/utilization: 15
          network/energy: 0.000001
          requests: 55
    child-1:
      defaults:
        cpu/thermal-design-power: 100
        grid/carbon-intensity: 800
        device/emissions-embodied: 1533.120 # gCO2eq
        time-reserved: 3600 # 1hr in seconds
        device/expected-lifespan: 94608000 # 3 years in seconds
        vcpus-allocated: 1
        vcpus-total: 8
      pipeline:
        compute:
          - interpolate
          - cpu-factor-to-wattage
          - wattage-times-duration
          - wattage-to-energy-kwh
          - calculate-vcpu-ratio
          - correct-cpu-energy-for-vcpu-ratio
          - sci-embodied
          - operational-carbon
          - sum-carbon
          - time-sync
          - sci
      inputs:
        - timestamp: "2023-01-01T00:00:00.000Z"
          cloud/instance-type: A1
          cloud/region: uk-west
          duration: 2629800
          cpu/utilization: 50
          network/energy: 0.000001
          requests: 50
        - timestamp: "2023-02-01T00:00:00.000Z"
          duration: 2419200
          cpu/utilization: 20
          cloud/instance-type: A1
          cloud/region: uk-west
          network/energy: 0.000001
          requests: 60
        - timestamp: "2023-03-01T00:00:00.000Z"
          duration: 2629800
          cpu/utilization: 15
          cloud/instance-type: A1
          cloud/region: uk-west
          network/energy: 0.000001
          requests: 70
        - timestamp: "2023-04-01T00:00:00.000Z"
          duration: 2592000
          cloud/instance-type: A1
          cloud/region: uk-west
          cpu/utilization: 15
          network/energy: 0.000001
          requests: 55
        - timestamp: "2023-05-01T00:00:00.000Z"
          duration: 2629800
          cloud/instance-type: A1
          cloud/region: uk-west
          cpu/utilization: 15
          network/energy: 0.000001
          requests: 55
        - timestamp: "2023-06-01T00:00:00.000Z"
          duration: 2592000
          cloud/instance-type: A1
          cloud/region: uk-west
          cpu/utilization: 15
          network/energy: 0.000001
          requests: 55
        - timestamp: "2023-07-01T00:00:00.000Z"
          duration: 2629800
          cloud/instance-type: A1
          cloud/region: uk-west
          cpu/utilization: 15
          network/energy: 0.000001
          requests: 55
    child-2:
      children:
        child-2-0:
          defaults:
            cpu/thermal-design-power: 100
            grid/carbon-intensity: 800
            device/emissions-embodied: 1533.120 # gCO2eq
            time-reserved: 3600 # 1hr in seconds
            device/expected-lifespan: 94608000 # 3 years in seconds
            vcpus-allocated: 1
            vcpus-total: 8
          pipeline:
            compute:
              - interpolate
              - cpu-factor-to-wattage
              - wattage-times-duration
              - wattage-to-energy-kwh
              - calculate-vcpu-ratio
              - correct-cpu-energy-for-vcpu-ratio
              - sci-embodied
              - operational-carbon
              - sum-carbon
              - time-sync
              - sci
          inputs:
            - timestamp: "2023-01-01T00:00:00.000Z"
              cloud/instance-type: A1
              cloud/region: uk-west
              duration: 2629800
              cpu/utilization: 50
              network/energy: 0.000001
              requests: 50
            - timestamp: "2023-02-01T00:00:00.000Z"
              duration: 2629800
              cpu/utilization: 20
              cloud/instance-type: A1
              cloud/region: uk-west
              network/energy: 0.000001
              requests: 60
            - timestamp: "2023-03-01T00:00:00.000Z"
              duration: 2629800
              cpu/utilization: 15
              cloud/instance-type: A1
              cloud/region: uk-west
              network/energy: 0.000001
              requests: 70
            - timestamp: "2023-04-01T00:00:00.000Z"
              duration: 2629800
              cloud/instance-type: A1
              cloud/region: uk-west
              cpu/utilization: 15
              network/energy: 0.000001
              requests: 55
            - timestamp: "2023-05-01T00:00:00.000Z"
              duration: 2629800
              cloud/instance-type: A1
              cloud/region: uk-west
              cpu/utilization: 15
              network/energy: 0.000001
              requests: 55
            - timestamp: "2023-06-01T00:00:00.000Z"
              duration: 2629800
              cloud/instance-type: A1
              cloud/region: uk-west
              cpu/utilization: 15
              network/energy: 0.000001
              requests: 55
            - timestamp: "2023-07-01T00:00:00.000Z"
              duration: 2629800
              cloud/instance-type: A1
              cloud/region: uk-west
              cpu/utilization: 15
              network/energy: 0.000001
              requests: 55
        child-2-1:
          defaults:
            cpu/thermal-design-power: 100
            grid/carbon-intensity: 800
            device/emissions-embodied: 1533.120 # gCO2eq
            time-reserved: 3600 # 1hr in seconds
            device/expected-lifespan: 94608000 # 3 years in seconds
            vcpus-allocated: 1
            vcpus-total: 8
          pipeline:
            compute:
              - interpolate
              - cpu-factor-to-wattage
              - wattage-times-duration
              - wattage-to-energy-kwh
              - calculate-vcpu-ratio
              - correct-cpu-energy-for-vcpu-ratio
              - sci-embodied
              - operational-carbon
              - sum-carbon
              - time-sync
              - sci
          inputs:
            - timestamp: "2023-01-01T00:00:00.000Z"
              cloud/instance-type: A1
              cloud/region: uk-west
              duration: 2629800
              cpu/utilization: 50
              network/energy: 0.000001
              requests: 50
            - timestamp: "2023-02-01T00:00:00.000Z"
              duration: 2629800
              cpu/utilization: 20
              cloud/instance-type: A1
              cloud/region: uk-west
              network/energy: 0.000001
              requests: 60
            - timestamp: "2023-03-01T00:00:00.000Z"
              duration: 2629800
              cpu/utilization: 15
              cloud/instance-type: A1
              cloud/region: uk-west
              network/energy: 0.000001
              requests: 70
            - timestamp: "2023-04-01T00:00:00.000Z"
              duration: 2629800
              cloud/instance-type: A1
              cloud/region: uk-west
              cpu/utilization: 15
              network/energy: 0.000001
              requests: 55
            - timestamp: "2023-05-01T00:00:00.000Z"
              duration: 2629800
              cloud/instance-type: A1
              cloud/region: uk-west
              cpu/utilization: 15
              network/energy: 0.000001
              requests: 55
            - timestamp: "2023-06-01T00:00:00.000Z"
              duration: 2629800
              cloud/instance-type: A1
              cloud/region: uk-west
              cpu/utilization: 15
              network/energy: 0.000001
              requests: 55
            - timestamp: "2023-07-01T00:00:00.000Z"
              duration: 2629800
              cloud/instance-type: A1
              cloud/region: uk-west
              cpu/utilization: 15
              network/energy: 0.000001
              requests: 55

here is yaml for playing along

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

1 participant