Skip to content

Accept both 0 and 'off' as inputs to interpolate builtin #1044

@jmcook1186

Description

@jmcook1186

What

  1. accept zero as an input to interpolate - this should be treated as a valid point to interpolate.
  2. accept a string, off, as an input to interpolate that causes the builtin to return zero for the cpu power, rather than the value that assumes the server is idle.

Why
There are two aspects to this - one is that there is no reason to throw an error on x=0 in the interpolation code - 0 is a valid interpolation point. Even in the canonical IF example (Teads) there is a given y value for x=0 which we cannot retrieve because the builtin throws an exception on x=0.

Secondly, we can't model a server that periodically shuts down and spins up within a time series - the best we can do is provide cpu-util: 0 but the power drawn by an idling server is ~50-70% of full utilization. For servers that are actually totally turned off, we still assign power to them as if they were idling. To model, for example a monthly conference call in a 30 day, 1-day resolution time series,, we are forced to include an idling server for the full month, even though we only really want to capture 30 mins of activity.

Context
as above

Prerequisites/resources
n/a

SoW (scope of work)

  • accept 0 as valid input to interpolate
  • accept the string 'off' as a valid input - it always returns 0.
  • documentation updated
  • test cases added

Acceptance criteria

  • Scenario 1

Given the builtin accepts 0 as an input:
When I run the following manifest:

name: interpolation-demo
description: simple demo of interpolation plugin
tags:
initialize:
  plugins:
    interpolation:
      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: "result"
tree:
  children:
    child:
      pipeline:
        compute:
          - interpolation
      inputs:
        - timestamp: 2023-07-06T00:00
          duration: 3600
          cpu/utilization: 0

Then I get the following result:

name: interpolation-demo
description: simple demo of interpolation plugin
tags:
initialize:
  plugins:
    interpolation:
      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: "result"
tree:
  children:
    child:
      pipeline:
        compute:
          - interpolation
      inputs:
        - timestamp: 2023-07-06T00:00
          duration: 3600
          cpu/utilization: 0
      outputs:
        - timestamp: 2023-07-06T00:00
          duration: 3600
          cpu/utilization: 0
          result: 0.12
  • Scenario 2

Given the builtin accepts 'off' as an input:
When I run the following manifest:

name: interpolation-demo
description: simple demo of interpolation plugin
tags:
initialize:
  plugins:
    interpolation:
      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: "result"
tree:
  children:
    child:
      pipeline:
        compute:
          - interpolation
      inputs:
        - timestamp: 2023-07-06T00:00
          duration: 3600
          cpu/utilization: off

Then I will get the following result:

name: interpolation-demo
description: simple demo of interpolation plugin
tags:
initialize:
  plugins:
    interpolation:
      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: "result"
tree:
  children:
    child:
      pipeline:
        compute:
          - interpolation
      inputs:
        - timestamp: 2023-07-06T00:00
          duration: 3600
          cpu/utilization: off
      outputs:
        - timestamp: 2023-07-06T00:00
          duration: 3600
          cpu/utilization: 0
          result: 0

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions