Metadata-Version: 2.1
Name: titanfe
Version: 0.4.185
Summary: titan Data Flow Engine for Python
Home-page: http://www.industrial-devops.org/
Author: wobe-systems GmbH
Author-email: info@industrial-devops.org
License: Apache License, Version 2.0
Project-URL: Bug Tracker, https://tracker.industrial-devops.org
Project-URL: Documentation, https://readthedocs.org/projects/titanfe
Project-URL: Source Code, https://git.industrial-devops.org/titan/DataFlowEngine/flowengine-py
Platform: Windows
Platform: Linux
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.7
Description-Content-Type: text/markdown
Requires-Dist: ujotypes (>=0.1.2)
Requires-Dist: ujoschema (>=0.3.66)
Requires-Dist: ruamel.yaml
Requires-Dist: janus
Requires-Dist: aiokafka (==0.5.2)
Requires-Dist: kafka-python (==1.4.6)
Requires-Dist: elasticsearch (==7.8.*)
Requires-Dist: fastapi
Requires-Dist: uvicorn (==0.9.*)
Requires-Dist: aiohttp (>=3.6.2)
Requires-Dist: aiohttp-requests (>=0.1.3)
Requires-Dist: dataclasses-json
Requires-Dist: requests
Requires-Dist: docopt
Requires-Dist: pycryptodome
Requires-Dist: uvloop (==0.13.*); platform_system == "Linux"

# Titan Flow Engine

The Titan Flow Engine provides the backend services for running data flows
on a node.

The core flow engine is composed of two services:

- **Control Peer**: One peer per node that takes care of managing Brick Runners
  on that node.
- **Brick Runner**: Virtual Machine for executing the Bricks that the Control
  Peer has started on it's node. The Brick Runner is generic and can process all
  types of Bricks.
  Each runner will only execute one type of Brick at a time.

Additionally Version 0.1.3 and onward require [titan services](https://doc.industrial-devops.org/titanPlatform/)
([sources](https://git.industrial-devops.org/titan/DataFlowEngine/flowengine-go/))
to run a full deployment of the titan platform.

## Choose How to Install

Titan Flow Engine **requires Python 3.7** to be installed.

Depending on whether you want to contribute to the Titan Flow Engine source code
you want to choose one of the following options to install:

### Installing via PyPi

The flow engine is available on the Python Package Index (PyPi). It is available
for Linux and Windows x64 systems. To install it without having to build it
yourself open a command line and run:

```sh
pip install titanfe
```

### Building the Titan Flow Engine (Advanced Install)

Required packages for building or developing the project can be installed
via the `requirements_dev.txt` in the project's root folder:

```sh
pip install -r requirements_dev.txt
```

To build and install the Flow Engine open a command line and run:

```sh
python setup.py build
pip install .
```

For those who also want to work on the documentation and build it locally,
please use the `requirements_doc.txt` file to install the necessary python
packages.

```sh
pip install -r requirements_doc.txt
```

## Running the flow engine

The flow engine is being started by starting the Control Peer. The Control Peer
takes care of starting Brick Runners as needed.

Parameters for starting the Control Peer on the command line are:

| Name         |  Purpose                                                        |
| -------------|---------------------------------------------------------------- |
| brick_folder | Folder to store installed bricks in (default: ~/titanfe/bricks) |
| config_file  | Path to ControlPeer configuration file                          |

The ControlPeers configuration file contains the following parameters:

| Name                       | Type | Description                                               |
| ------------------------------- | --- | --------------------------------------------------------- |
| Kafka         | string    | Network address of Kafka instance for metrics and logging |
|                                 |  \<hostname:port\>    | (default: localhost:9092)                                 |
| GridManager   |   string  | Network address of the GridManager                        |
|                                 |\<hostname:port\>      | (default: localhost:8080)                                 |
| FlowManager  |  string   | Network address of the FlowManager                        |
|                                 |  \<hostname:port\>     | (default: localhost:9002)                                 |
| EndpointProvider  |  string   | Network address of the EndpointProvider         |  
|                                 |  \<hostname:port\>     | (default: "tcp://127.0.0.1:9021")                         |
| SecretKey    |  string   | secret key for brick parameter decryption                        |
|                                 |       | (default: None), alternatively use TITAN_SECRET_KEY environment variable   |

If no secret key is given, the ControlPeer will stop immediately. The secret key
needs to be identical to the one used in the FlowManager for encrypting
parameters.

To try out the flow engine first download and start the [services](https://git.industrial-devops.org/titan/DataFlowEngine/flowengine-go/tree/master)
GridManager, Repository service, User service, PackageManager, and FlowManager.
These services are needed for the flow engine to receive flows to process.

Adjust the ControlPeers configuration file
(titanfe/apps/control_peer/config.yaml) or create a new one.
Then, open a command line and run.

```sh
python -m titanfe.apps.control_peer -brick_folder ~/titanfe/bricks -config_file path_to_config_file/config.yaml
```

Or run it from the root directory of the flow engine by providing the path to the example:

```sh
python -m titanfe.apps.control_peer  -brick_folder ~/titanfe/bricks -config_file titanfe/apps/control_peer/config.yaml
```

## Code Quality

Code quality within the project is checked using pylint and flake8.

### pylint

Linting is performed with [pylint](https://www.pylint.org). To define the
intended checks `.pylintrc` is used to configure linting for this project.

Running pylint for the python code in this project the following commands are
used:

```sh
pylint --rcfile=.pylintrc titanfe
```

Linting the tests is done running the command:

```sh
pylint --rcfile=.pylintrc --disable=duplicate-code ./test
```

### flake8

To make sure the PEP8 standard is applied to the code flake8 can be added to
the static tests.

For this project we exclude various errors, warnings and notifications because
they do not make sense at this time. This may change while refactoring is
considered.

You can run flake 8 with:

```sh
flake8
```

It finds all the python files in this project.
The configuration for this project is read from `.flake8` in the project's
root directory.


