Skip to content

Commit

Permalink
refactor(engine): Rename ActionExecutionError to ExecutorClientError (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
daryllimyt authored Jan 2, 2025
1 parent ba114d7 commit fe28387
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion tests/unit/test_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -1606,7 +1606,7 @@ async def test_pull_based_workflow_fetches_latest_version(temporal_client, test_
# f"Function: {run_action_on_ray_cluster.__name__}\n"
# f"Line: {run_action_on_ray_cluster.__code__.co_firstlineno}"
),
"type": "ActionExecutionError",
"type": "ExecutorClientError",
"expr_context": "ACTIONS",
"attempt": 1,
}
Expand Down
6 changes: 3 additions & 3 deletions tracecat/dsl/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from tracecat.logger import logger
from tracecat.registry.actions.models import RegistryActionValidateResponse
from tracecat.types.auth import Role
from tracecat.types.exceptions import ActionExecutionError
from tracecat.types.exceptions import ExecutorClientError


def contextualize_message(
Expand Down Expand Up @@ -106,8 +106,8 @@ async def run_action_activity(input: RunActionInput, role: Role) -> Any:
# Delegate to the registry client
client = ExecutorClient(role=role)
return await client.run_action_memory_backend(input)
except ActionExecutionError as e:
# We only expect ActionExecutionError to be raised from the executor client
except ExecutorClientError as e:
# We only expect ExecutorClientError to be raised from the executor client
kind = e.__class__.__name__
msg = str(e)
err_locator = contextualize_message(task, msg, attempt=attempt)
Expand Down
12 changes: 6 additions & 6 deletions tracecat/executor/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
RegistryActionValidateResponse,
)
from tracecat.types.auth import Role
from tracecat.types.exceptions import ActionExecutionError, RegistryError
from tracecat.types.exceptions import ExecutorClientError, RegistryError


class ExecutorHTTPClient(AuthenticatedServiceClient):
Expand Down Expand Up @@ -79,15 +79,15 @@ async def run_action_memory_backend(self, input: RunActionInput) -> Any:
except httpx.HTTPStatusError as e:
self._handle_http_status_error(e, action_type)
except httpx.ReadTimeout as e:
raise ActionExecutionError(
raise ExecutorClientError(
f"Timeout calling action {action_type!r} in executor: {e}"
) from e
except orjson.JSONDecodeError as e:
raise ActionExecutionError(
raise ExecutorClientError(
f"Error decoding JSON response for action {action_type!r}: {e}"
) from e
except Exception as e:
raise ActionExecutionError(
raise ExecutorClientError(
f"Unexpected error calling action {action_type!r} in executor: {e}"
) from e

Expand Down Expand Up @@ -197,10 +197,10 @@ def _handle_http_status_error(
detail = e.response.text
self.logger.error("Executor returned an error", error=e, detail=detail)
if e.response.status_code / 100 == 5:
raise ActionExecutionError(
raise ExecutorClientError(
f"There was an error in the executor when calling action {action_type!r} ({e.response.status_code}).\n\n{detail}"
) from e
else:
raise ActionExecutionError(
raise ExecutorClientError(
f"Unexpected executor error ({e.response.status_code}):\n\n{e}\n\n{detail}"
) from e
4 changes: 2 additions & 2 deletions tracecat/types/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ class TaskUnreachable(TracecatException):
"""Raised when a task is unreachable."""


class ActionExecutionError(TracecatException):
"""Exception raised when an action execution error occurs."""
class ExecutorClientError(TracecatException):
"""Exception raised when an error occurs in the executor client."""


class WrappedExecutionError(TracecatException):
Expand Down

0 comments on commit fe28387

Please sign in to comment.