Merge remote-tracking branch 'origin/dev' into two_edges
This commit is contained in:
commit
47c0522c7b
7 changed files with 18 additions and 10 deletions
|
|
@ -167,7 +167,7 @@ def run(
|
||||||
else:
|
else:
|
||||||
# Run using gunicorn on Linux
|
# Run using gunicorn on Linux
|
||||||
process = run_on_mac_or_linux(host, port, log_level, options, app)
|
process = run_on_mac_or_linux(host, port, log_level, options, app)
|
||||||
if open_browser:
|
if open_browser and not backend_only:
|
||||||
click.launch(f"http://{host}:{port}")
|
click.launch(f"http://{host}:{port}")
|
||||||
if process:
|
if process:
|
||||||
process.join()
|
process.join()
|
||||||
|
|
|
||||||
|
|
@ -897,7 +897,7 @@ class Graph:
|
||||||
next_runnable_vertices = await self._execute_tasks(tasks, lock=lock)
|
next_runnable_vertices = await self._execute_tasks(tasks, lock=lock)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Error executing tasks in layer {layer_index}: {e}")
|
logger.error(f"Error executing tasks in layer {layer_index}: {e}")
|
||||||
break
|
raise e
|
||||||
if not next_runnable_vertices:
|
if not next_runnable_vertices:
|
||||||
break
|
break
|
||||||
to_process.extend(next_runnable_vertices)
|
to_process.extend(next_runnable_vertices)
|
||||||
|
|
|
||||||
|
|
@ -510,9 +510,9 @@ def load_flows_from_directory():
|
||||||
if existing:
|
if existing:
|
||||||
logger.info(f"Updating existing flow: {flow_id} with endpoint name {flow_endpoint_name}")
|
logger.info(f"Updating existing flow: {flow_id} with endpoint name {flow_endpoint_name}")
|
||||||
for key, value in flow.items():
|
for key, value in flow.items():
|
||||||
if key == "last_tested_version":
|
if hasattr(existing, key):
|
||||||
continue
|
# flow dict from json and db representation are not 100% the same
|
||||||
setattr(existing, key, value)
|
setattr(existing, key, value)
|
||||||
existing.updated_at = datetime.utcnow()
|
existing.updated_at = datetime.utcnow()
|
||||||
existing.user_id = user_id
|
existing.user_id = user_id
|
||||||
session.add(existing)
|
session.add(existing)
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,9 @@ load_dotenv()
|
||||||
|
|
||||||
def pytest_configure(config):
|
def pytest_configure(config):
|
||||||
config.addinivalue_line("markers", "noclient: don't create a client for this test")
|
config.addinivalue_line("markers", "noclient: don't create a client for this test")
|
||||||
data_path = Path(__file__).parent.absolute() / "data"
|
config.addinivalue_line("markers", "load_flows: load the flows for this test")
|
||||||
|
config.addinivalue_line("markers", "api_key_required: run only if the api key is set in the environment variables")
|
||||||
|
data_path = Path(__file__).parent.parent.absolute() / "data"
|
||||||
|
|
||||||
pytest.BASIC_EXAMPLE_PATH = data_path / "basic_example.json"
|
pytest.BASIC_EXAMPLE_PATH = data_path / "basic_example.json"
|
||||||
pytest.COMPLEX_EXAMPLE_PATH = data_path / "complex_example.json"
|
pytest.COMPLEX_EXAMPLE_PATH = data_path / "complex_example.json"
|
||||||
|
|
|
||||||
|
|
@ -505,5 +505,6 @@
|
||||||
"y": 0,
|
"y": 0,
|
||||||
"zoom": 0.5
|
"zoom": 0.5
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
"last_tested_version": "0.6.2"
|
||||||
}
|
}
|
||||||
|
|
@ -6,7 +6,7 @@ from fastapi.testclient import TestClient
|
||||||
from sqlmodel import Session
|
from sqlmodel import Session
|
||||||
|
|
||||||
from langflow.api.v1.schemas import FlowListCreate
|
from langflow.api.v1.schemas import FlowListCreate
|
||||||
from langflow.initial_setup.setup import load_starter_projects
|
from langflow.initial_setup.setup import load_starter_projects, load_flows_from_directory
|
||||||
from langflow.services.database.models.base import orjson_dumps
|
from langflow.services.database.models.base import orjson_dumps
|
||||||
from langflow.services.database.models.flow import Flow, FlowCreate, FlowUpdate
|
from langflow.services.database.models.flow import Flow, FlowCreate, FlowUpdate
|
||||||
from langflow.services.database.utils import session_getter
|
from langflow.services.database.utils import session_getter
|
||||||
|
|
@ -271,7 +271,11 @@ def test_read_only_starter_projects(client: TestClient, active_user, logged_in_h
|
||||||
|
|
||||||
@pytest.mark.load_flows
|
@pytest.mark.load_flows
|
||||||
def test_load_flows(client: TestClient, load_flows_dir):
|
def test_load_flows(client: TestClient, load_flows_dir):
|
||||||
client.get("/api/v1/auto_login")
|
response = client.get("api/v1/flows/c54f9130-f2fa-4a3e-b22a-3856d946351b")
|
||||||
|
assert response.status_code == 200
|
||||||
|
assert response.json()["name"] == "BasicExample"
|
||||||
|
# re-run to ensure updates work well
|
||||||
|
load_flows_from_directory()
|
||||||
response = client.get("api/v1/flows/c54f9130-f2fa-4a3e-b22a-3856d946351b")
|
response = client.get("api/v1/flows/c54f9130-f2fa-4a3e-b22a-3856d946351b")
|
||||||
assert response.status_code == 200
|
assert response.status_code == 200
|
||||||
assert response.json()["name"] == "BasicExample"
|
assert response.json()["name"] == "BasicExample"
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,7 @@ def test_load_flow_from_json_object():
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.noclient
|
@pytest.mark.noclient
|
||||||
|
@pytest.mark.api_key_required
|
||||||
def test_run_flow_from_json_object():
|
def test_run_flow_from_json_object():
|
||||||
"""Test loading a flow from a json file and applying tweaks"""
|
"""Test loading a flow from a json file and applying tweaks"""
|
||||||
_, projects = zip(*load_starter_projects())
|
_, projects = zip(*load_starter_projects())
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue