monasca-analytics/monasca_analytics/banana/eval
Daisuke Fujita 6c7316ebbd Support python3.5 for monasca-analytics
This patch implements followings for py35 support using six(er) and 2to3.

- Python 3 map/filter returns iterator, must be converted to list
- use six.string_types instead of basestring
- use six.iteritems instead of iteritems
- use six.moves for using cPickle and SocketServer packages
- use six.assertCountEqual instead of assertItemsEqual
- remove relative imports
- update BytecodeAssembler(monasca_analytics/
  banana/bytecode/assembler.py) for python3

Can be tested with:
  tox -e py35

Change-Id: If1b92d0ffc56492950f6a02ebdbe1596d0dce368
2019-01-28 09:47:45 +00: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 Support python3.5 for monasca-analytics 2019-01-28 09:47:45 +00:00
ctx.py This commit introduces the first version of Banana configuration language. 2016-08-22 14:29:26 +01:00
old_style.py Support python3.5 for monasca-analytics 2019-01-28 09:47:45 +00: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.