🐛 fix(base.py): handle ImportError when importing celery.result.AsyncResult to allow building the vertex locally when Celery is not installed
This commit is contained in:
parent
45c7656e57
commit
d393a66b2f
1 changed files with 6 additions and 1 deletions
|
|
@ -11,7 +11,7 @@ import inspect
|
||||||
import types
|
import types
|
||||||
from typing import Any, Dict, List, Optional
|
from typing import Any, Dict, List, Optional
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
from celery.result import AsyncResult
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from langflow.graph.edge.base import Edge
|
from langflow.graph.edge.base import Edge
|
||||||
|
|
@ -180,6 +180,11 @@ class Vertex:
|
||||||
return self._built_object
|
return self._built_object
|
||||||
|
|
||||||
# Check if there's a task_id, which means it was sent to a Celery worker
|
# Check if there's a task_id, which means it was sent to a Celery worker
|
||||||
|
try:
|
||||||
|
from celery.result import AsyncResult
|
||||||
|
except ImportError:
|
||||||
|
# If Celery is not installed, just build the vertex locally
|
||||||
|
return self.build()
|
||||||
if self.is_task and self.task_id is not None:
|
if self.is_task and self.task_id is not None:
|
||||||
result = AsyncResult(self.task_id).get(
|
result = AsyncResult(self.task_id).get(
|
||||||
timeout=timeout
|
timeout=timeout
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue