-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update database file path handling and server shutdown message (#1686)
* Update database file path handling in base.py and version.py * Update server.py to handle SIGINT signal in LangflowUvicornWorker * Add shutdown message when shutting down Langflow in main.py * Update datetime type for created_at and updated_at fields in apikey and variable tables * Update package versions in pyproject.toml and poetry.lock files * Update package versions in pyproject.toml and poetry.lock files * Fix import error in base.py * Refactor database file path handling in base.py * Update unit test command in python_test.yml
- Loading branch information
1 parent
e38ab09
commit e73754b
Showing
12 changed files
with
490 additions
and
330 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,4 +41,4 @@ jobs: | |
poetry install | ||
- name: Run unit tests | ||
run: | | ||
make tests | ||
make tests args="-n auto" |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "langflow" | ||
version = "1.0.0a17" | ||
version = "1.0.0a18" | ||
description = "A Python package with a built-in web application" | ||
authors = ["Logspace <[email protected]>"] | ||
maintainers = [ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
99 changes: 99 additions & 0 deletions
99
src/backend/base/langflow/alembic/versions/79e675cb6752_change_datetime_type.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
"""Change datetime type | ||
Revision ID: 79e675cb6752 | ||
Revises: e3bc869fa272 | ||
Create Date: 2024-04-11 19:23:10.697335 | ||
""" | ||
from calendar import c | ||
from typing import Sequence, Union | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
from sqlalchemy.dialects import postgresql | ||
from sqlalchemy.engine.reflection import Inspector | ||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = "79e675cb6752" | ||
down_revision: Union[str, None] = "e3bc869fa272" | ||
branch_labels: Union[str, Sequence[str], None] = None | ||
depends_on: Union[str, Sequence[str], None] = None | ||
|
||
|
||
def upgrade() -> None: | ||
conn = op.get_bind() | ||
inspector = Inspector.from_engine(conn) # type: ignore | ||
table_names = inspector.get_table_names() | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
if "apikey" in table_names: | ||
columns = inspector.get_columns("apikey") | ||
created_at_column = next((column for column in columns if column["name"] == "created_at"), None) | ||
if created_at_column is not None and created_at_column["type"] == postgresql.TIMESTAMP(): | ||
with op.batch_alter_table("apikey", schema=None) as batch_op: | ||
batch_op.alter_column( | ||
"created_at", | ||
existing_type=postgresql.TIMESTAMP(), | ||
type_=sa.DateTime(timezone=True), | ||
existing_nullable=False, | ||
) | ||
if "variable" in table_names: | ||
columns = inspector.get_columns("variable") | ||
created_at_column = next((column for column in columns if column["name"] == "created_at"), None) | ||
updated_at_column = next((column for column in columns if column["name"] == "updated_at"), None) | ||
with op.batch_alter_table("variable", schema=None) as batch_op: | ||
if created_at_column is not None and created_at_column["type"] == postgresql.TIMESTAMP(): | ||
batch_op.alter_column( | ||
"created_at", | ||
existing_type=postgresql.TIMESTAMP(), | ||
type_=sa.DateTime(timezone=True), | ||
existing_nullable=True, | ||
) | ||
if updated_at_column is not None and updated_at_column["type"] == postgresql.TIMESTAMP(): | ||
batch_op.alter_column( | ||
"updated_at", | ||
existing_type=postgresql.TIMESTAMP(), | ||
type_=sa.DateTime(timezone=True), | ||
existing_nullable=True, | ||
) | ||
|
||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade() -> None: | ||
conn = op.get_bind() | ||
inspector = Inspector.from_engine(conn) # type: ignore | ||
table_names = inspector.get_table_names() | ||
# ### commands auto generated by Alembic - please adjust! ### | ||
if "variable" in table_names: | ||
columns = inspector.get_columns("variable") | ||
created_at_column = next((column for column in columns if column["name"] == "created_at"), None) | ||
updated_at_column = next((column for column in columns if column["name"] == "updated_at"), None) | ||
with op.batch_alter_table("variable", schema=None) as batch_op: | ||
if updated_at_column is not None and updated_at_column["type"] == sa.DateTime(timezone=True): | ||
batch_op.alter_column( | ||
"updated_at", | ||
existing_type=sa.DateTime(timezone=True), | ||
type_=postgresql.TIMESTAMP(), | ||
existing_nullable=True, | ||
) | ||
if created_at_column is not None and created_at_column["type"] == sa.DateTime(timezone=True): | ||
batch_op.alter_column( | ||
"created_at", | ||
existing_type=sa.DateTime(timezone=True), | ||
type_=postgresql.TIMESTAMP(), | ||
existing_nullable=True, | ||
) | ||
|
||
if "apikey" in table_names: | ||
columns = inspector.get_columns("apikey") | ||
created_at_column = next((column for column in columns if column["name"] == "created_at"), None) | ||
if created_at_column is not None and created_at_column["type"] == sa.DateTime(timezone=True): | ||
with op.batch_alter_table("apikey", schema=None) as batch_op: | ||
batch_op.alter_column( | ||
"created_at", | ||
existing_type=sa.DateTime(timezone=True), | ||
type_=postgresql.TIMESTAMP(), | ||
existing_nullable=False, | ||
) | ||
|
||
# ### end Alembic commands ### |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.