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
332 changes: 0 additions & 332 deletions backend/app/api/routes/events.py

This file was deleted.

10 changes: 0 additions & 10 deletions backend/app/api/routes/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
ExecutionResponse,
ExecutionResult,
ResourceLimits,
RetryExecutionRequest,
)
from app.services.event_service import EventService
from app.services.execution_service import ExecutionService
Expand Down Expand Up @@ -75,8 +74,6 @@ async def create_execution(
lang=execution.lang,
lang_version=execution.lang_version,
user_id=current_user.user_id,
client_ip=get_client_ip(request),
user_agent=request.headers.get("user-agent"),
idempotency_key=idempotency_key,
)
return ExecutionResponse.model_validate(exec_result)
Expand Down Expand Up @@ -129,25 +126,18 @@ async def cancel_execution(
async def retry_execution(
original_execution: Annotated[ExecutionInDB, Depends(get_execution_with_access)],
current_user: Annotated[User, Depends(current_user)],
retry_request: RetryExecutionRequest,
request: Request,
execution_service: FromDishka[ExecutionService],
) -> ExecutionResponse:
"""Retry a failed or completed execution."""

if original_execution.status in [ExecutionStatus.RUNNING, ExecutionStatus.QUEUED]:
raise HTTPException(status_code=400, detail=f"Cannot retry execution in {original_execution.status} state")

# Convert UserResponse to User object
client_ip = get_client_ip(request)
user_agent = request.headers.get("user-agent")
new_result = await execution_service.execute_script(
script=original_execution.script,
lang=original_execution.lang,
lang_version=original_execution.lang_version,
user_id=current_user.user_id,
client_ip=client_ip,
user_agent=user_agent,
)
return ExecutionResponse.model_validate(new_result)

Expand Down
5 changes: 2 additions & 3 deletions backend/app/domain/events/typed.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from pydantic import BaseModel, ConfigDict, Discriminator, Field, TypeAdapter

from app.core.correlation import CorrelationContext
from app.domain.enums import (
Environment,
EventType,
Expand Down Expand Up @@ -34,10 +35,8 @@ class EventMetadata(BaseModel):

service_name: str
service_version: str
correlation_id: str = Field(default_factory=lambda: str(uuid4()))
correlation_id: str = Field(default_factory=CorrelationContext.get_correlation_id)
user_id: str = Field(default_factory=lambda: str(uuid4()))
ip_address: str | None = None
user_agent: str | None = None
environment: Environment = Environment.PRODUCTION


Expand Down
Loading
Loading