Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.0.8

* Sensible logging config

## 0.0.7

* Minor version bump
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,13 @@ USER root
RUN ln -s /home/notebook-user/.local/bin/pip /usr/local/bin/pip
USER ${NB_USER}

COPY --chown=${NB_USER}:${NB_USER} logger_config.yaml logger_config.yaml
COPY --chown=${NB_USER}:${NB_USER} prepline_${PIPELINE_PACKAGE}/ prepline_${PIPELINE_PACKAGE}/
COPY --chown=${NB_USER}:${NB_USER} exploration-notebooks exploration-notebooks
COPY --chown=${NB_USER}:${NB_USER} pipeline-notebooks pipeline-notebooks

EXPOSE 5000

ENTRYPOINT ["uvicorn", "prepline_general.api.app:app", \
"--log-config", "logger_config.yaml", \
"--host", "0.0.0.0"]
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ docker-build:

.PHONY: docker-start-api
docker-start-api:
docker run -p 8000:8000 --mount type=bind,source=$(realpath .),target=/home/notebook-user/local -t --rm pipeline-family-${PIPELINE_FAMILY}-dev:latest
docker run -p 8000:8000 --mount type=bind,source=$(realpath .),target=/home/notebook-user/local -t --rm pipeline-family-${PIPELINE_FAMILY}-dev:latest --log-config logger_config.yaml --host 0.0.0.0 --port 8000

# Note(austin) we need to install the dev dependencies for this to work
# Do we want to build separate dev images?
Expand All @@ -100,7 +100,7 @@ run-jupyter:
## run-web-app: runs the FastAPI api with hot reloading
.PHONY: run-web-app
run-web-app:
PYTHONPATH=$(realpath .) uvicorn ${PACKAGE_NAME}.api.app:app --reload
PYTHONPATH=$(realpath .) uvicorn ${PACKAGE_NAME}.api.app:app --reload --log-config logger_config.yaml

#################
# Test and Lint #
Expand Down
42 changes: 42 additions & 0 deletions logger_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
version: 1
disable_existing_loggers: False
formatters:
default_format:
"()": uvicorn.logging.DefaultFormatter
format: '%(asctime)s %(name)s %(levelname)s %(message)s'
access:
"()": uvicorn.logging.AccessFormatter
format: '%(asctime)s %(client_addr)s %(request_line)s - %(status_code)s'
handlers:
access_handler:
formatter: access
class: logging.StreamHandler
stream: ext://sys.stderr
standard_handler:
formatter: default_format
class: logging.StreamHandler
stream: ext://sys.stderr
loggers:
uvicorn.error:
level: INFO
handlers:
- standard_handler
propagate: no
# disable logging for uvicorn.error by not having a handler
uvicorn.access:
level: INFO
handlers:
- access_handler
propagate: no
# disable logging for uvicorn.access by not having a handler
unstructured:
level: INFO
handlers:
- standard_handler
propagate: no
unstructured_inference:
level: DEBUG
handlers:
- standard_handler
propagate: no

2 changes: 1 addition & 1 deletion prepline_general/api/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ async def stream_response(self, send: Send) -> None:


@router.post("/general/v0/general")
@router.post("/general/v0.0.7/general")
@router.post("/general/v0.0.8/general")
def pipeline_1(
request: Request,
files: Union[List[UploadFile], None] = File(default=None),
Expand Down
2 changes: 1 addition & 1 deletion preprocessing-pipeline-family.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
name: general
version: 0.0.7
version: 0.0.8