Release Beta 5 (#1009)

This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-10-04 12:51:07 -03:00 committed by GitHub
commit 3604db72f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 9 deletions

View file

@ -1,6 +1,6 @@
[tool.poetry]
name = "langflow"
version = "0.5.0b3"
version = "0.5.0b4"
description = "A Python package with a built-in web application"
authors = ["Logspace <contact@logspace.ai>"]
maintainers = [

View file

@ -52,6 +52,18 @@ def display_results(results):
console.print() # Print a new line
def set_var_for_macos_issue():
# OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
# we need to set this var is we are running on MacOS
# otherwise we get an error when running gunicorn
if platform.system() in ["Darwin"]:
import os
os.environ["OBJC_DISABLE_INITIALIZE_FORK_SAFETY"] = "YES"
logger.debug("Set OBJC_DISABLE_INITIALIZE_FORK_SAFETY to YES to avoid error")
def update_settings(
config: str,
cache: Optional[str] = None,
@ -143,7 +155,10 @@ def run(
"""
Run the Langflow.
"""
set_var_for_macos_issue()
# override env variables with .env file
if env_file:
load_dotenv(env_file, override=True)
@ -165,7 +180,6 @@ def run(
options = {
"bind": f"{host}:{port}",
"workers": get_number_of_workers(workers),
"worker_class": "uvicorn.workers.UvicornWorker",
"timeout": timeout,
}

View file

@ -4,6 +4,8 @@ from gunicorn.app.base import BaseApplication # type: ignore
class LangflowApplication(BaseApplication):
def __init__(self, app, options=None):
self.options = options or {}
self.options["worker_class"] = "uvicorn.workers.UvicornWorker"
self.application = app
super().__init__()

View file

@ -90,7 +90,10 @@ class ServiceManager:
if service is None:
continue
logger.debug(f"Teardown service {service.name}")
service.teardown()
try:
service.teardown()
except Exception as exc:
logger.exception(exc)
self.services = {}
self.factories = {}
self.dependencies = {}
@ -150,9 +153,3 @@ def initialize_session_service():
dependencies=[ServiceType.CACHE_SERVICE],
)
def teardown_services():
"""
Teardown all the services.
"""
service_manager.teardown()

View file

@ -153,6 +153,9 @@ def teardown_services():
"""
try:
teardown_superuser(get_settings_service(), next(get_session()))
except Exception as exc:
logger.exception(exc)
try:
service_manager.teardown()
except Exception as exc:
logger.exception(exc)