Skip to content

Commit 777163b

Browse files
committed
feat: Refactor load_graph_from_path to support async execution
- Changed `load_graph_from_path` to an async function, enabling non-blocking graph loading. - Updated the call to `load_graph_from_script` to use await, improving performance during graph retrieval. - Enhanced the overall async handling in the CLI for better integration with async workflows.
1 parent 8162458 commit 777163b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lfx/src/lfx/cli/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def validate_script_path(script_path: Path | str, verbose_print) -> tuple[str, P
224224
return file_extension, script_path
225225

226226

227-
def load_graph_from_path(script_path: Path, file_extension: str, verbose_print, *, verbose: bool = False):
227+
async def load_graph_from_path(script_path: Path, file_extension: str, verbose_print, *, verbose: bool = False):
228228
"""Load a graph from a Python script or JSON file.
229229
230230
Args:
@@ -259,7 +259,7 @@ def load_graph_from_path(script_path: Path, file_extension: str, verbose_print,
259259
raise ValueError(error_msg)
260260

261261
verbose_print("Loading graph...")
262-
graph = load_graph_from_script(script_path)
262+
graph = await load_graph_from_script(script_path)
263263
else: # .json
264264
verbose_print("Loading JSON flow...")
265265
graph = load_flow_from_json(script_path, disable_logs=not verbose)

0 commit comments

Comments
 (0)