mintproject / mic

Model Insertion Checker
https://mic-cli.readthedocs.io/en/latest/
5 stars 3 forks source link

Auto params #258

Closed Cmheidelberg closed 4 years ago

Cmheidelberg commented 4 years ago

Automatically detect parameters from invocation line given to trace. When parameters is run without any inputs it will automatically add these parameters to the mic file with the names param_1, param_2, ext. Then when the wrapper is run it will add these parameters to the wrapper invocation line.

For example, if user runs:

$ mic encapsulate trace ./myCode.py input.csv 10 32.5 "upwards"
.
.
$ mic encapsulate parameters
$ mic encapsulate wrapper

The mic file will look like:

.
.
inputs:
  input_csv:
    path: input.csv
    format: csv
code_files:
  myCode_py:
    path: myCode.py
    format: py
parameters:
  param_1:
    name: ''
    default_value: '10'
    type: int
    description: ''
  param_2:
    name: ''
    default_value: 32.5
    type: float
    description: ''
  param_3:
    name: ''
    default_value: upwards
    type: str
    description: ''

Note: I added the empty name field in the parameters data because we talked about prompting the user for a name when automatically adding the parameter, so for now is is blank as a placeholder.

The mic/src/run invocation line would look like this:

.
.
####### WRITE YOUR INVOCATION LINE AFTER THIS COMMENT
pushd .
/bin/sh ./myCode.py ${input_csv} ${param_1} ${param_2} ${param_3} 
popd

I have also made test cases for this and documentation.

codecov[bot] commented 4 years ago

Codecov Report

Merging #258 into develop will increase coverage by 0.38%. The diff coverage is 84.72%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #258      +/-   ##
===========================================
+ Coverage    61.19%   61.57%   +0.38%     
===========================================
  Files           49       50       +1     
  Lines         3275     3357      +82     
===========================================
+ Hits          2004     2067      +63     
- Misses        1271     1290      +19     
Impacted Files Coverage Δ
src/mic/click_encapsulate/commands.py 83.62% <62.96%> (-3.09%) :arrow_down:
src/mic/component/reprozip.py 88.02% <83.33%> (-2.89%) :arrow_down:
src/mic/_utils.py 46.47% <100.00%> (ø)
src/mic/cli_docs.py 75.67% <100.00%> (ø)
src/mic/tests/test_184.py 74.52% <100.00%> (ø)
src/mic/tests/test_commands.py 87.20% <100.00%> (+0.62%) :arrow_up:
src/mic/tests/test_parameters.py 100.00% <100.00%> (ø)
src/mic/tests/test_reprozip.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e8e379f...42ca103. Read the comment docs.