Green-Software-Foundation / if

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

Create ShellCommand Imp #83

Closed jawache closed 1 year ago

jawache commented 1 year ago

What: An IMP in TS that calls a shell command to calculate the impacts from some observations. Why: So we can have a language agnostic way to interact with models written in any language. SoW:

NOTE: This is going to require some co-ordination between the person making the Python command line IMP caller here https://github.com/Green-Software-Foundation/ief/issues/84 please coordinate with them esp. if there are requirements for how to communicate back and forth between your two processes.

For example, in your calculate function.

create some YAML the represents the inputs to your ShellCommand, like so:

    config: 
      <key>: <value>
    observations:
        - timestamp: <timestamp>
          duration: <duration>
          <key>: <value>
        - timestamp: <timestamp>
          duration: <duration>
          <key>: <value>  

Spawn the Shell that is configured and pass the YAML as STDIN (see https://stackoverflow.com/questions/37685461/how-to-pass-stdin-to-node-js-child-process)

Parse the repones and pass the data out of your calculate function to the caller.

jmcook1186 commented 1 year ago

progress update:

done

next

gnanakeethan commented 1 year ago

@jmcook1186 Can we close this issue.

cc: @jawache