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

Shell plugin outputs are double indented and timestamp is not first element #694

Closed
Tracked by #656
jmcook1186 opened this issue May 2, 2024 · 1 comment · Fixed by Green-Software-Foundation/if-plugins#92
Assignees
Labels
bug Error, flaw or fault
Milestone

Comments

@jmcook1186
Copy link
Contributor

Description of the Error

Running the shell plugin with the default sampler demo Python script in the if repository returns incorrectly formatted output data. Specifically, the outputs are double-indented and in the wrong order.

Expected Behaviour

After downloading and installing if and if-plugins and running npm run ie -- --manifest manifests/plugins/shell/success.yml --output manifests/outputs/test should yield an output yaml that looks as follows:

name: shell
description: successful path
tags: null
initialize:
  plugins:
    shell:
      path: '@grnsft/if-plugins'
      method: Shell
      global-config:
        command: python3 /usr/local/bin/sampler
  outputs:
    - yaml
if-version: v0.3.2
tree:
  children:
    child:
      pipeline:
        - shell
      inputs:
        - timestamp: '2023-11-02T10:35:31.820Z'
          duration: 3600
          cpu/energy: 0.002
          memory/energy: 0.000005
      outputs:
        - timestamp: '2023-11-02T10:35:31.820Z'
          duration: 3600
          cpu/energy: 0.002
          energy: 1
          memory/energy: 0.000005  

Notice that the output array has one additional field: energy: 1. The other fields are identical to what is found in inputs.

Actual Behaviour

After downloading and installing if and if-plugins and running npm run ie -- --manifest manifests/plugins/shell/success.yml --output manifests/outputs/test yields an output yaml that looks as follows:

name: shell
description: successful path
tags: null
initialize:
  plugins:
    shell:
      path: '@grnsft/if-plugins'
      method: Shell
      global-config:
        command: python3 /usr/local/bin/sampler
  outputs:
    - yaml
if-version: v0.3.2
tree:
  children:
    child:
      pipeline:
        - shell
      inputs:
        - timestamp: '2023-11-02T10:35:31.820Z'
          duration: 3600
          cpu/energy: 0.002
          memory/energy: 0.000005
      outputs:
        - - cpu/energy: 0.002
            duration: 3600
            energy: 1
            memory/energy: 0.000005
            timestamp: '2023-11-02T10:35:31.820Z'

Notice the double indented first element of outputs and the reordering of the output data that moves timestamp and duration out of indexes 0 and 1. timestamp should always be the zeroth element in each block of output data.

Steps to Reproduce

Download and install if:

git clone https://github.com/Green-Software-Foundation/if.git
npm i && npm i @grnsft/if-plugins

Run using the bundled example manifest manifests/plugins/shell/success.yml

npm run ie -- --manifest manifests/plugins/shell/success.yml -- output manifests/output/test

Examine contents of manifests/output/test.yml

Link to online environment

I am not providing an online environment because it was awkward to configure a remote IDE to spawn a shell and execute python code. I'll provide manifest details instead.

Manifest File That Generated the Error

name: shell
description: successful path
tags: null
initialize:
  plugins:
    shell:
      path: '@grnsft/if-plugins'
      method: Shell
      global-config:
        command: python3 /usr/local/bin/sampler
  outputs:
    - yaml
if-version: v0.3.2
tree:
  children:
    child:
      pipeline:
        - shell
      inputs:
        - timestamp: '2023-11-02T10:35:31.820Z'
          duration: 3600
          cpu/energy: 0.002
          memory/energy: 0.000005

Links to Any Additional Code

Runtime Info

Linux
Ubuntu 20.04.5 LTS
Node 21.4.0

@jmcook1186 jmcook1186 added the bug Error, flaw or fault label May 2, 2024
@jmcook1186 jmcook1186 added this to IF May 2, 2024
@jmcook1186 jmcook1186 moved this to Backlog in IF May 2, 2024
@zanete zanete moved this from Backlog to Ready in IF May 7, 2024
@manushak manushak moved this from Ready to In Progress in IF May 15, 2024
@manushak manushak moved this from In Progress to Pending Review in IF May 15, 2024
@manushak manushak linked a pull request May 15, 2024 that will close this issue
9 tasks
@zanete
Copy link

zanete commented May 20, 2024

@narekhovhannisyan please review

@zanete zanete moved this from Pending Review to Testing in IF May 20, 2024
@github-project-automation github-project-automation bot moved this from Testing to Done in IF May 22, 2024
@zanete zanete added this to the Improve Trust milestone Jun 5, 2024
@zanete zanete mentioned this issue Jun 5, 2024
28 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Error, flaw or fault
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

5 participants