🔧 (build_and_push.Dockerfile): Add support for building and pushing frontend code in a separate node builder stage to improve build process efficiency
🔧 (build_and_push.Dockerfile): Update pip install command to force reinstall dependencies to ensure consistency 🐛 (code_parser.py): Change logger.exception to logger.debug to prevent logging full exception stack trace 🐛 (directory_reader.py): Change logger.error to logger.debug and log error message separately to improve error handling and logging clarity
This commit is contained in:
parent
c3a0e3d598
commit
c2b2e9a286
3 changed files with 14 additions and 6 deletions
|
|
@ -1,6 +1,14 @@
|
||||||
# syntax=docker/dockerfile:1
|
# syntax=docker/dockerfile:1
|
||||||
# Keep this syntax directive! It's used to enable Docker BuildKit
|
# Keep this syntax directive! It's used to enable Docker BuildKit
|
||||||
|
|
||||||
|
FROM node:20-bookworm-slim as builder-node
|
||||||
|
WORKDIR /app
|
||||||
|
COPY src/frontend/package.json src/frontend/package-lock.json ./
|
||||||
|
RUN npm install
|
||||||
|
COPY src/frontend/ ./
|
||||||
|
RUN npm run build
|
||||||
|
|
||||||
|
|
||||||
################################
|
################################
|
||||||
# BUILDER-BASE
|
# BUILDER-BASE
|
||||||
# Used to build deps + create our virtual environment
|
# Used to build deps + create our virtual environment
|
||||||
|
|
@ -48,10 +56,10 @@ COPY pyproject.toml poetry.lock README.md ./
|
||||||
COPY src/ ./src
|
COPY src/ ./src
|
||||||
COPY scripts/ ./scripts
|
COPY scripts/ ./scripts
|
||||||
RUN python -m pip install requests --user && cd ./scripts && python update_dependencies.py
|
RUN python -m pip install requests --user && cd ./scripts && python update_dependencies.py
|
||||||
|
COPY --from=builder-node /app/build ./src/backend/base/langflow/frontend
|
||||||
RUN $POETRY_HOME/bin/poetry lock --no-update \
|
RUN $POETRY_HOME/bin/poetry lock --no-update \
|
||||||
&& $POETRY_HOME/bin/poetry install --no-interaction --no-ansi -E deploy \
|
|
||||||
&& $POETRY_HOME/bin/poetry build -f wheel \
|
&& $POETRY_HOME/bin/poetry build -f wheel \
|
||||||
&& $POETRY_HOME/bin/poetry run pip install dist/*.whl
|
&& $POETRY_HOME/bin/poetry run pip install dist/*.whl --force-reinstall
|
||||||
|
|
||||||
################################
|
################################
|
||||||
# RUNTIME
|
# RUNTIME
|
||||||
|
|
|
||||||
|
|
@ -297,7 +297,7 @@ class CodeParser:
|
||||||
bases = self.execute_and_inspect_classes(self.code)
|
bases = self.execute_and_inspect_classes(self.code)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
# If the code cannot be executed, return an empty list
|
# If the code cannot be executed, return an empty list
|
||||||
logger.exception(e)
|
logger.debug(e)
|
||||||
bases = []
|
bases = []
|
||||||
raise e
|
raise e
|
||||||
return bases
|
return bases
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,8 @@ class DirectoryReader:
|
||||||
component_tuple = (*build_component(component), component)
|
component_tuple = (*build_component(component), component)
|
||||||
components.append(component_tuple)
|
components.append(component_tuple)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error while loading component { component['name']}: {e}")
|
logger.debug(f"Error while loading component { component['name']}")
|
||||||
|
logger.debug(e)
|
||||||
continue
|
continue
|
||||||
items.append({"name": menu["name"], "path": menu["path"], "components": components})
|
items.append({"name": menu["name"], "path": menu["path"], "components": components})
|
||||||
filtered = [menu for menu in items if menu["components"]]
|
filtered = [menu for menu in items if menu["components"]]
|
||||||
|
|
@ -266,8 +267,7 @@ class DirectoryReader:
|
||||||
if validation_result:
|
if validation_result:
|
||||||
try:
|
try:
|
||||||
output_types = self.get_output_types_from_code(result_content)
|
output_types = self.get_output_types_from_code(result_content)
|
||||||
except Exception as exc:
|
except Exception:
|
||||||
logger.exception(f"Error while getting output types from code: {str(exc)}")
|
|
||||||
output_types = [component_name_camelcase]
|
output_types = [component_name_camelcase]
|
||||||
else:
|
else:
|
||||||
output_types = [component_name_camelcase]
|
output_types = [component_name_camelcase]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue