Skip to content

Commit

Permalink
Merge branch 'langgenius:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
warren830 authored Dec 31, 2024
2 parents 152df98 + 634b382 commit 4701439
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 44 deletions.
22 changes: 13 additions & 9 deletions api/app.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
from libs import version_utils

# preparation before creating app
version_utils.check_supported_python_version()
import os
import sys


def is_db_command():
import sys

if len(sys.argv) > 1 and sys.argv[0].endswith("flask") and sys.argv[1] == "db":
return True
return False
Expand All @@ -18,10 +14,18 @@ def is_db_command():

app = create_migrations_app()
else:
from app_factory import create_app
from libs import threadings_utils
if os.environ.get("FLASK_DEBUG", "False") != "True":
from gevent import monkey # type: ignore

# gevent
monkey.patch_all()

threadings_utils.apply_gevent_threading_patch()
from grpc.experimental import gevent as grpc_gevent # type: ignore

# grpc gevent
grpc_gevent.init_gevent()

from app_factory import create_app

app = create_app()
celery = app.extensions["celery"]
Expand Down
6 changes: 3 additions & 3 deletions api/core/app/task_pipeline/workflow_cycle_manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def _handle_node_execution_start(
self, *, session: Session, workflow_run: WorkflowRun, event: QueueNodeStartedEvent
) -> WorkflowNodeExecution:
workflow_node_execution = WorkflowNodeExecution()
workflow_node_execution.id = event.node_execution_id
workflow_node_execution.id = str(uuid4())
workflow_node_execution.tenant_id = workflow_run.tenant_id
workflow_node_execution.app_id = workflow_run.app_id
workflow_node_execution.workflow_id = workflow_run.workflow_id
Expand Down Expand Up @@ -391,7 +391,7 @@ def _handle_workflow_node_execution_retried(
execution_metadata = json.dumps(merged_metadata)

workflow_node_execution = WorkflowNodeExecution()
workflow_node_execution.id = event.node_execution_id
workflow_node_execution.id = str(uuid4())
workflow_node_execution.tenant_id = workflow_run.tenant_id
workflow_node_execution.app_id = workflow_run.app_id
workflow_node_execution.workflow_id = workflow_run.workflow_id
Expand Down Expand Up @@ -824,7 +824,7 @@ def _get_workflow_run(self, *, session: Session, workflow_run_id: str) -> Workfl
return workflow_run

def _get_workflow_node_execution(self, session: Session, node_execution_id: str) -> WorkflowNodeExecution:
stmt = select(WorkflowNodeExecution).where(WorkflowNodeExecution.id == node_execution_id)
stmt = select(WorkflowNodeExecution).where(WorkflowNodeExecution.node_execution_id == node_execution_id)
workflow_node_execution = session.scalar(stmt)
if not workflow_node_execution:
raise WorkflowNodeExecutionNotFoundError(node_execution_id)
Expand Down
4 changes: 4 additions & 0 deletions api/core/tools/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ class ToolApiSchemaError(ValueError):

class ToolEngineInvokeError(Exception):
meta: ToolInvokeMeta

def __init__(self, meta, **kwargs):
self.meta = meta
super().__init__(**kwargs)
19 changes: 0 additions & 19 deletions api/libs/threadings_utils.py

This file was deleted.

12 changes: 0 additions & 12 deletions api/libs/version_utils.py

This file was deleted.

1 change: 0 additions & 1 deletion docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,6 @@ x-shared-env: &shared-api-worker-env
SSRF_COREDUMP_DIR: ${SSRF_COREDUMP_DIR:-/var/spool/squid}
SSRF_REVERSE_PROXY_PORT: ${SSRF_REVERSE_PROXY_PORT:-8194}
SSRF_SANDBOX_HOST: ${SSRF_SANDBOX_HOST:-sandbox}
COMPOSE_PROFILES: ${COMPOSE_PROFILES:-${VECTOR_STORE:-weaviate}}
EXPOSE_NGINX_PORT: ${EXPOSE_NGINX_PORT:-80}
EXPOSE_NGINX_SSL_PORT: ${EXPOSE_NGINX_SSL_PORT:-443}
POSITION_TOOL_PINS: ${POSITION_TOOL_PINS:-}
Expand Down
2 changes: 2 additions & 0 deletions docker/generate_docker_compose
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ def generate_shared_env_block(env_vars, anchor_name="shared-api-worker-env"):
"""
lines = [f"x-shared-env: &{anchor_name}"]
for key, default in env_vars.items():
if key == "COMPOSE_PROFILES":
continue
# If default value is empty, use ${KEY:-}
if default == "":
lines.append(f" {key}: ${{{key}:-}}")
Expand Down

0 comments on commit 4701439

Please sign in to comment.