monasca-analytics/monasca_analytics/banana/eval
Joan Varvenne 5812bd8429 This commit introduces the first version of Banana configuration language.
As of this commit, to change the configuration using Banana, we
need to make an HTTP POST request to `/banana` REST API. This API is
temporary and is likely to be changed later.

The implementation is done entirely in the `banana` module. Under this
module there are:

 * `typeck` module contains the type checker,
 * `grammar` module contains the parser and the AST and,
 * `eval` module contains the interpreter.

Additionally, a test framework has been created to ease the test of
particular conditions of the language.

Within the banana module, there is a README.md file for each associated
sub-module explaining further the details of the language.

Once this commit is merged, there's still a lot that can be improved:

 - All components should be tested in Banana.
 - The 'deadpathck' pass could be improved (see TODO)
 - We don't support generated JSON ingestors yet.
 - Imports will be key for reusability (not implemented).

Change-Id: I1305bdfa0606f30619b31404afbe0acf111c029f
2016-08-22 14:29:26 +01:00
..
README.md This commit introduces the first version of Banana configuration language. 2016-08-22 14:29:26 +01:00
__init__.py This commit introduces the first version of Banana configuration language. 2016-08-22 14:29:26 +01:00
config.py This commit introduces the first version of Banana configuration language. 2016-08-22 14:29:26 +01:00
ctx.py This commit introduces the first version of Banana configuration language. 2016-08-22 14:29:26 +01:00
old_style.py This commit introduces the first version of Banana configuration language. 2016-08-22 14:29:26 +01:00

README.md

Interpreter / Evaluator

This folder contains everything related to the evaluation of banana files.

This pass makes some assumptions: it is valid to create all the components and connecting them won't throw any errors.

Some components might need to be created in order to check if they are valid. For instance, when a DNS lookup is involved. In such cases, an error will be thrown during the interpretation. However, the general intention is to move the checks out of the evaluation as much as possible. We want to avoid at all cost an half-working pipeline as it could have side-effects on external data sources by corrupting them or feeding them with incorrect data.

The execution environment (e.g Spark) might also reject the pipeline during an evaluation for some reason. However, this is less likely to happen as the deadpathck pass removes components and paths that would lead to errors.

This is the last step of the pipeline:

       +---------------------+
       |                     |
 --->  |   AST & TypeTable   | ---- interpret --->     Done
       |                     |
       +---------------------+

Current status

  • Evaluate expressions
  • Create components
  • Connect components
  • Restart the pipeline

Tests

All tests are located in test/banana/eval. We only try to evaluate valid files, so for this pass there's only a should_pass directory.

Available instruction

  • # LHS_EQ <string-version-of-the-value>: This instruction compares the evaluation of the left hand side of the previous expression with the provided string. If they are not equal, the test will fail.