forked from nasa/ogma
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop-prefilters' into develop. Close nasa#197.
**Description** There is a need in Ogma to extend it with the ability to make the frontend more versatile, and to support languages unknown to Ogma without users having to modify the code of Ogma itself. For example, a user might want to support a formal language unknown to Ogma, or use an LLM to transform properties in English into monitors. To that end, we want to empower users with the ability to use a custom command to transform individual properties into a format that Ogma understands, and have Ogma call that external command on demand. **Type** - Feature: New capability. **Additional context** None. **Requester** - Ivan Perez. **Method to check presence of bug** Not applicable (not a bug). **Expected result** Ogma provides an argument to the standalone command that empowers users with the ability to specify a pre-filter or pre-processor to transform properties into a format understood by Ogma. The following Dockerfile uses the new flag to produce a Copilot monitor from a spec while replacing all expressions are replaced by the constantly true value / stream, and compiles the resulting Copilot specification, after which it prints the message "Success": ```Dockerfile FROM ubuntu:trusty RUN apt-get update RUN apt-get install --yes software-properties-common RUN add-apt-repository ppa:hvr/ghc RUN apt-get update RUN apt-get install --yes ghc-8.6.5 cabal-install-2.4 RUN apt-get install --yes libz-dev ENV PATH=/opt/ghc/8.6.5/bin:/opt/cabal/2.4/bin:$PWD/.cabal-sandbox/bin:$PATH RUN cabal update RUN cabal v1-sandbox init RUN cabal v1-install alex happy --constraint='happy < 2.0' RUN apt-get install --yes git RUN echo "#!/bin/bash" >> /tmp/alwaystrue RUN echo "echo TRUE" >> /tmp/alwaystrue RUN chmod a+x /tmp/alwaystrue CMD git clone $REPO && \ cd $NAME && \ git checkout $COMMIT && \ cd .. && \ cabal v1-install copilot-4.2 $NAME/$PAT**/ --enable-tests && \ ogma standalone --input-format fdb --file-name $NAME/ogma-cli/examples/DB.json --target-dir output --parse-prop-via /tmp/alwaystrue && \ cabal v1-exec -- runhaskell output/Copilot.hs && \ echo "Success" ``` Command (substitute variables based on new path after merge): ```sh $ docker run -e "REPO=https://github.com/NASA/ogma" -e "NAME=ogma" -e "PAT=ogma" -e "COMMIT=<HASH>" -it ogma-verify-197 ``` **Proposed solution** Modify JSON spec parser in `ogma-language-jsonspec` to be able to use an external command (e.g., `IO`) to parse individual properties. Modify existing backends in `ogma-core` to adapt to change in JSON spec parser. Modify standalone command in `ogma-core` to receive an additional argument with the name of a program to use to pre-process properties. Modify tests in `ogma-core` to provide the new arguments to the standalone backend so that tests keep working. Modify `ogma-cli` to give users the ability to pick a preprocessor via an optional input argument (exposing the corresponding argument from `ogma-core`). **Further notes** None.
- Loading branch information
Showing
11 changed files
with
83 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters