feature: add filtering of instructions on the exec command#210
feature: add filtering of instructions on the exec command#210GregoryEssertel merged 6 commits intomasterfrom
Conversation
|
Works perfectly on local env. Include and exclude works just as intended. Great new feature that can go hand in hand with the new APR error message index feature |
matthewkuangga
left a comment
There was a problem hiding this comment.
LGTM, works perfectly when I tested
| invalid_filters.add(arg) | ||
| elif re.match(r"\d+-\d+", arg): | ||
| [s, e] = [int(v) for v in arg.split("-")] | ||
| if s > e or number_of_instructions <= e: |
There was a problem hiding this comment.
You should also check here that s is > 0
There was a problem hiding this comment.
I thought about it, I think '\d+' should enforce that right?
With not 0?
scottyantipa
left a comment
There was a problem hiding this comment.
This looks good. I think one nice addition would be to display the result of the filtering to the user, like:
Successfully submitted 10/13 instructions
To re-inforce to the user that their filter was applied as expected
|
@scottyantipa I didn't see your comments 😬 I will address them in another PRs. At first I did the filtering client side, and I was giving this info. But then I move it server side, I will update the message return by SCLE with this information! |
## Summary: - Add a `--exclude/-e` and `--include/-i` flags on the exec command to filter instructions. The filters are being validated then forwarded to SCLE where the filtering is done: https://github.com/strateos/lab/pull/1527 - Minor: use email address to specify who sent the payload. Require: https://github.com/strateos/lab/pull/1526 to be merged in lab as well ### Usage: ``` cat autoprotocol.json | \ transcriptic exec -a lab.core.strateos.com/haven/wctest -w wc4-mcx1 -e 1-9 -i 7 -e op:provision ``` This command will first filter out instruction from index 1 to 9 (`-e 1-9`) and the provisions (`-e op:provision`). Then add back the instruction at index 7 (`-i 7`). The order of `-i/-e` don't matter, it is first removing all the `-e`, then adding back all the `-i`. ### Filters Possible filter: - single index: 123 - range: 123-456 - key:value in the instruction: `op:provision`, or `x_human!:false`. The ! means that if the key (x_human) is not in the instruction, then the filter matches. Otherwise, without the '!' a missing key means that there is no match. Filter example: - { "op": "seal", "x_human": false } and { "op": "seal" } match `x_human!:false` - { "op": "seal" } does not match`x_human:true`, nor `x_human:false` ### Test plan Add unit tests #### Manual testing ``` internal_protocols/clients/sd2/current_protocols/growth_curve [master*]$ transcriptic preview GrowthCurve | \ transcriptic exec -a lab.core.strateos.com/haven/wctest -w wc4-mcx1 -e x_human:true Sending request to http://13.52.223.111:9000/testRun Success. View http://lab.core.strateos.com/haven/wctest/dashboard to see the scheduling outcome. ``` or ``` internal_protocols/clients/sd2/current_protocols/growth_curve [master*]$ transcriptic preview GrowthCurve | \ transcriptic exec -a lab.core.strateos.com/haven/wctest -w wc4-mcx1 -e op:provision Sending request to http://13.52.223.111:9000/testRun Success. View http://lab.core.strateos.com/haven/wctest/dashboard to see the scheduling outcome. ```
Summary:
--exclude/-eand--include/-iflags on the exec command to filter instructions. The filters are being validated then forwarded to SCLE where the filtering is done: https://github.com/strateos/lab/pull/1527Require: https://github.com/strateos/lab/pull/1526 to be merged in lab as well
Usage:
This command will first filter out instruction from index 1 to 9 (
-e 1-9) and the provisions (-e op:provision). Then add back the instruction at index 7 (-i 7).The order of
-i/-edon't matter, it is first removing all the-e, then adding back all the-i.Filters
Possible filter:
op:provision, orx_human!:false. The ! means that if the key (x_human) is not in the instruction, then the filter matches. Otherwise, without the '!' a missing key means that there is no match.Filter example:
x_human!:falsex_human:true, norx_human:falseTest plan
Add unit tests
Manual testing
or
Bonus with the newest features not yet merged: