-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
33 lines (25 loc) · 982 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# region Imports
# ==========================================================================
# Uncomment this patch if running the example within of the pipelayer project
# import app._path_patch # NOQA F401
import json
from logging import Logger
from typing import Any, Tuple
from pipelayer import Pipeline
from app.app_context import AppContext
from app.app_settings import AppSettings
from app.filter.create_response import create_response
from app.filter.hello_filter import HelloFilter
from app.filter.world_filter import WorldFilter
# endregion
def main() -> Tuple[Pipeline, Any]:
app_settings = AppSettings()
context = AppContext(app_settings, Logger("Logger"))
pipeline = Pipeline.create(context, "Hello World Pipeline")
filters = [
HelloFilter,
WorldFilter("Append ', World.'", post_process=create_response),
lambda context, data: json.dumps(data)
]
output = pipeline.run(filters, None)
return pipeline, output