Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ DATABASE_NAME=baserow
# BASEROW_AUTOMATION_WORKFLOW_RATE_LIMIT_CACHE_EXPIRY_SECONDS=
# BASEROW_AUTOMATION_WORKFLOW_HISTORY_RATE_LIMIT_CACHE_EXPIRY_SECONDS=
# BASEROW_AUTOMATION_WORKFLOW_MAX_CONSECUTIVE_ERRORS=
# BASEROW_AUTOMATION_WORKFLOW_TIMEOUT_HOURS=
# BASEROW_AUTOMATION_WORKFLOW_HISTORY_MAX_DAYS=
# BASEROW_AUTOMATION_WORKFLOW_HISTORY_MAX_ENTRIES=
# BASEROW_EXTRA_ALLOWED_HOSTS=
Expand Down
3 changes: 3 additions & 0 deletions backend/justfile
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ venv_dir := env("UV_PROJECT_ENVIRONMENT", justfile_directory() / "../.venv")
# Export for uv to use
export UV_PROJECT_ENVIRONMENT := venv_dir

# Prevent stdout buffering
export PYTHONUNBUFFERED := "1"

# Use --active to respect VIRTUAL_ENV, since venv may be in parent dir
uv_run := "uv run --active"

Expand Down
3 changes: 3 additions & 0 deletions backend/src/baserow/config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -835,6 +835,9 @@ def __setitem__(self, key, value):
AUTOMATION_WORKFLOW_MAX_CONSECUTIVE_ERRORS = int(
os.getenv("BASEROW_AUTOMATION_WORKFLOW_MAX_CONSECUTIVE_ERRORS", 5)
)
AUTOMATION_WORKFLOW_TIMEOUT_HOURS = int(
os.getenv("BASEROW_AUTOMATION_WORKFLOW_TIMEOUT_HOURS", 24)
)
AUTOMATION_WORKFLOW_HISTORY_MAX_DAYS = int(
os.getenv("BASEROW_AUTOMATION_WORKFLOW_HISTORY_MAX_DAYS", 30)
)
Expand Down
21 changes: 8 additions & 13 deletions backend/src/baserow/contrib/automation/nodes/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,10 +396,6 @@ def dispatch_node(
dispatch, otherwise returns None.
"""

from baserow.contrib.automation.workflows.handler import (
AutomationWorkflowHandler,
)

history_handler = AutomationHistoryHandler()

try:
Expand Down Expand Up @@ -450,9 +446,8 @@ def dispatch_node(
self._handle_workflow_error(node_history, error)
return None
except Exception as e:
original_workflow = AutomationWorkflowHandler().get_original_workflow(
node.workflow
)
original_workflow = node.workflow.get_original()

error = (
f"Unexpected error while running workflow {original_workflow.id}. "
f"Error: {str(e)}"
Expand All @@ -467,12 +462,6 @@ def dispatch_node(
# Use the normalized iteration index from the context.
iteration_index = dispatch_context.current_iterations[parent_nodes[-1].id]

history_handler.create_node_result(
node_history=node_history,
result=dispatch_result.data,
iteration=iteration_index,
)

# Return early if this is a simulation as we've reached the
# simulated node.
if until_node := simulate_until_node:
Expand All @@ -481,6 +470,12 @@ def dispatch_node(
automation_node_updated.send(self, user=None, node=until_node)
return None

history_handler.create_node_result(
node_history=node_history,
result=dispatch_result.data,
iteration=iteration_index,
)

to_chain = []
if children := node.get_children():
node_data = dispatch_result.data["results"]
Expand Down
4 changes: 3 additions & 1 deletion backend/src/baserow/contrib/automation/nodes/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def dispatch_node_celery_task(
node_id: int,
history_id: int,
current_iterations: Optional[Dict[int, int]] = None,
):
) -> Signature | None:
from baserow.contrib.automation.nodes.handler import AutomationNodeHandler

# The atomic context should only wrap the dispatch_node() call. If
Expand All @@ -37,3 +37,5 @@ def _dispatch():
# by a worker (which again calls dispatch_node_celery_task).
if isinstance(result, Signature):
return self.replace(result)

return None
Loading
Loading