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

Design a generic exponent plugin #673

Closed
3 of 10 tasks
Tracked by #656
zanete opened this issue Apr 29, 2024 · 3 comments · Fixed by Green-Software-Foundation/if-plugins#91
Closed
3 of 10 tasks
Tracked by #656

Design a generic exponent plugin #673

zanete opened this issue Apr 29, 2024 · 3 comments · Fixed by Green-Software-Foundation/if-plugins#91
Assignees
Milestone

Comments

@zanete
Copy link

zanete commented Apr 29, 2024

Sub of: #656

What
Create a new generic exponent plugin in 'if-plugins`

Why
We want to support as many pipelines as possible using generic plugins that can be adapted to many use cases. We currently have sum, multiply, coefficient. We also need to support exponent (i.e. raising the value of a given parameter by a power).
As a user I want to be able to execute any arbitrary logic using if plugins.

Prerequisites/resources
None

SoW (scope of work)

  • plugin code is added to if-plugins repo
  • documentation updated to if-plugins repo
  • documentation is added to if.greensoftware.foundation
  • unit tests added, giving 100% coverage and passing
  • manifests are added to if repo demonstrating usage

Plugin details

  • Inputs:
    • input-parameter: the input parameter whose value will be used as the base. It must exist in the input data.
    • exponent: the power that the value of input-parameter should be raised to
    • output-parameter: a string to be used as the name of the output value

e.g. to grab the value of cpu-energy from each element in the input data array and raise it to the third power, and add it to the output data as cpu-energy-cubed you would set:

input parameter: cpu-energy
exponent: 3
output-parameter: cpu-energy-cubed
  • outputs
    The plugin should add a new field to the output data whose name is equal to output-parameter and whose value is equal to input-parameter ** exponent.

The sum and coefficient plugin code can be used as a template to accelerate the development of this plugin.

Acceptance criteria

  • A plugin called exponent exists in the if-plugins repository
    Given (Setup): the exponent plugin exists
    When (Action): a user has downloaded and installed if and if-plugins
    Then (Assertion): the user should be able to include exponent in a pipeline and raise the value of any parameter that exists in their input data to a given power.

  • Unit tests exists with 100% coverage over exponent
    Given (Setup): a user has downloaded and installed if-plugins
    When (Action): a user runs npx jest --coverage
    Then (Assertion): the coverage report should show that exponent is 100% covered and passing

  • Documentation exists in plugin readme
    Given (Setup): the user visits the if-plugins repository
    When the user navigates to src/lib/exponent
    Then the user sees a README containing documentation describing the exponent plugin, copying the format from the other plugin readmes.

  • Documentation exists in if.greensoftware.foundation
    Given: the user is on if.greensoftware.foundation
    When (Action): they navigate to reference/plugins and find the exponent plugin section
    Then (Assertion): they see a link to the plugin readme for the exponent plugin

  • Example manifests exists
    Given: the user has downloaded and installed if
    When (Action): the user navigates to if/manifests/plugins
    Then (Assertion): they see manifests that include the subtract plugin

@jmcook1186
Copy link
Contributor

@zanete @pazbardanl please take a look at the ticket - I consider this ready to work on

@zanete
Copy link
Author

zanete commented Apr 29, 2024

@jmcook1186 I feel my comment on the #672 here is also relevant on this issue.

@jmcook1186
Copy link
Contributor

assigning to @manushak again - we need a final approval on this PR

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.

4 participants