pull/20050/merge^2
liangxin 7 months ago
parent 2f7dc7a58a
commit d882f73dfd

@ -125,7 +125,7 @@ class CeleryWorkflowExecutionRepository(WorkflowExecutionRepository):
logger.debug(f"Queued async save for workflow execution: {execution.id_}")
except Exception as e:
logger.exception(f"Failed to queue save operation for execution {execution.id_}: {e}")
logger.exception(f"Failed to queue save operation for execution {execution.id_}")
# In case of Celery failure, we could implement a fallback to synchronous save
# For now, we'll re-raise the exception
raise
@ -150,7 +150,7 @@ class CeleryWorkflowExecutionRepository(WorkflowExecutionRepository):
# Remove completed task
del self._pending_saves[execution_id]
except Exception as e:
logger.exception(f"Failed to wait for save operation {execution_id}: {e}")
logger.exception(f"Failed to wait for save operation {execution_id}")
def get_pending_save_count(self) -> int:
"""

@ -137,7 +137,7 @@ class CeleryWorkflowNodeExecutionRepository(WorkflowNodeExecutionRepository):
logger.debug(f"Queued async save for workflow node execution: {execution.id}")
except Exception as e:
logger.exception(f"Failed to queue save operation for node execution {execution.id}: {e}")
logger.exception(f"Failed to queue save operation for node execution {execution.id}")
# In case of Celery failure, we could implement a fallback to synchronous save
# For now, we'll re-raise the exception
raise
@ -186,7 +186,7 @@ class CeleryWorkflowNodeExecutionRepository(WorkflowNodeExecutionRepository):
return result
except Exception as e:
logger.exception(f"Failed to get workflow node executions for run {workflow_run_id}: {e}")
logger.exception(f"Failed to get workflow node executions for run {workflow_run_id}")
# Could implement fallback to direct database access here
return []
@ -215,7 +215,7 @@ class CeleryWorkflowNodeExecutionRepository(WorkflowNodeExecutionRepository):
logger.debug(f"Waiting for pending save to complete before read: {execution_id}")
task_result.get(timeout=self._async_timeout)
except Exception as e:
logger.exception(f"Failed to wait for pending save {execution_id}: {e}")
logger.exception(f"Failed to wait for pending save {execution_id}")
# Clean up completed tasks from both caches
if task_result and task_result.ready():
@ -243,7 +243,7 @@ class CeleryWorkflowNodeExecutionRepository(WorkflowNodeExecutionRepository):
del self._pending_saves[execution_id]
self._workflow_execution_mapping.pop(execution_id, None)
except Exception as e:
logger.exception(f"Failed to wait for save operation {execution_id}: {e}")
logger.exception(f"Failed to wait for save operation {execution_id}")
def get_pending_save_count(self) -> int:
"""

@ -77,7 +77,7 @@ def save_workflow_execution_task(
return True
except Exception as e:
logger.exception(f"Failed to save workflow execution {execution_data.get('id_', 'unknown')}: {e}")
logger.exception(f"Failed to save workflow execution {execution_data.get('id_', 'unknown')}")
# Retry the task with exponential backoff
raise self.retry(exc=e, countdown=60 * (2**self.request.retries))

@ -86,7 +86,7 @@ def save_workflow_node_execution_task(
return True
except Exception as e:
logger.exception(f"Failed to save workflow node execution {execution_data.get('id', 'unknown')}: {e}")
logger.exception(f"Failed to save workflow node execution {execution_data.get('id', 'unknown')}")
# Retry the task with exponential backoff
raise self.retry(exc=e, countdown=60 * (2**self.request.retries))
@ -145,7 +145,7 @@ def get_workflow_node_executions_by_workflow_run_task(
return result
except Exception as e:
logger.exception(f"Failed to get workflow node executions for run {workflow_run_id}: {e}")
logger.exception(f"Failed to get workflow node executions for run {workflow_run_id}")
# Retry the task with exponential backoff
raise self.retry(exc=e, countdown=60 * (2**self.request.retries))

@ -109,9 +109,10 @@ class TestCeleryWorkflowExecutionRepository:
def test_init_without_tenant_id_raises_error(self, mock_session_factory):
"""Test that initialization fails without tenant_id."""
user = Mock()
# Create a mock Account with no tenant_id
user = Mock(spec=Account)
user.current_tenant_id = None
user.tenant_id = None
user.id = str(uuid4())
with pytest.raises(ValueError, match="User must have a tenant_id"):
CeleryWorkflowExecutionRepository(

@ -118,9 +118,10 @@ class TestCeleryWorkflowNodeExecutionRepository:
def test_init_without_tenant_id_raises_error(self, mock_session_factory):
"""Test that initialization fails without tenant_id."""
user = Mock()
# Create a mock Account with no tenant_id
user = Mock(spec=Account)
user.current_tenant_id = None
user.tenant_id = None
user.id = str(uuid4())
with pytest.raises(ValueError, match="User must have a tenant_id"):
CeleryWorkflowNodeExecutionRepository(

File diff suppressed because it is too large Load Diff

@ -0,0 +1,3 @@
use conda voice environment when you are dealing with python. you could source ~/.zshrc to activate conda.
you can make file edits, run commands, as long as there is no security concern.
Loading…
Cancel
Save