-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy path__init__.py
More file actions
28 lines (21 loc) · 914 Bytes
/
__init__.py
File metadata and controls
28 lines (21 loc) · 914 Bytes
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
# This module implements http api, which allows to communicate with Agent
from .api import init_app
from ..settings import (
TIME_LIMIT, OUTPUT_FORMATTER, DEBUG_OUTPUT_FORMATTER, DEBUG, RESPONSE_LOGGER, CORS
)
from ..setup_agent import setup_agent
from ..core.log import LocalResponseLogger
def app_factory(pipeline_configs=None, debug=None, response_time_limit=None, cors=None):
agent, session, workers = setup_agent(pipeline_configs)
response_logger = agent._response_logger
if DEBUG:
output_formatter = DEBUG_OUTPUT_FORMATTER
else:
output_formatter = OUTPUT_FORMATTER
app = init_app(
agent=agent, session=session, consumers=workers,
logger_stats=response_logger, output_formatter=output_formatter,
debug=debug or DEBUG, response_time_limit=response_time_limit or TIME_LIMIT,
cors=CORS if cors is None else cors
)
return app