Green-Software-Foundation / if

Impact Framework
https://if.greensoftware.foundation/
MIT License
150 stars 40 forks source link

solution for if-alias for shortcutting pipelines #924

Open zanete opened 3 months ago

zanete commented 3 months ago

Why: TBC What: Decide on the solution / implementation of if-alias

Scope of work:

narekhovhannisyan commented 2 months ago

Story: Since moving to generic plugins, some of the old plugins became difficult pipelines consisting of 6-7 generic plugins which makes UX complicated.

One of the ideas of implementation is to save it as a YAML file and import it in the initialize section. F.ex. here us the preconfigured pipeline of teads curve (we need to think on how to configure it from the outside).

    interpolate:
      path: builtin
      method: Interpolation
      global-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
    cpu-factor-to-wattage:
      path: builtin
      method: Multiply
      global-config:
        input-parameters:
          - cpu-factor
          - thermal-design-power
        output-parameter: cpu-wattage
    wattage-times-duration:
      path: builtin
      method: Multiply
      global-config:
        input-parameters:
          - cpu-wattage
          - duration
        output-parameter: cpu-wattage-times-duration
    wattage-to-energy-kwh:
      path: builtin
      method: Divide
      global-config:
        numerator: cpu-wattage-times-duration
        denominator: 3600000
        output: cpu-energy-raw
    calculate-vcpu-ratio:
      path: builtin
      method: Divide
      global-config:
        numerator: vcpus-total
        denominator: vcpus-allocated
        output: vcpu-ratio
    correct-cpu-energy-for-vcpu-ratio:
      path: builtin
      method: Divide
      global-config:
        numerator: cpu-energy-raw
        denominator: vcpu-ratio
        output: cpu-energy-kwh

Then in the main manifest:

name: alias
description: uses teads curve alias
...
initialize:
  aliases:
    - name: treads-curve
       path: '<path to the alias file>'
       config: <values to be passed to aliased pipeline>
  plugins:
    ....
jmcook1186 commented 2 months ago

so in this example would the config for each plugin be configurable from the manifest, or you are expected to hard code the config in the yaml file for the pipeline?

narekhovhannisyan commented 2 months ago

as an initial version we can hardcode it in yaml, and then see if config from manifest will be convenient

zanete commented 2 months ago

As I understood from @jawache this one can be backlogged for the time being until we have more experience making real life manifests and better awareness of the related frictions