logs
This commit is contained in:
@ -142,6 +142,7 @@ func (s *executionService) executeSync(ctx context.Context, execution *domain.Fu
|
||||
execution.Error = result.Error
|
||||
execution.Duration = result.Duration
|
||||
execution.MemoryUsed = result.MemoryUsed
|
||||
execution.Logs = result.Logs
|
||||
|
||||
// Check if the result indicates a timeout
|
||||
if result.Error != "" {
|
||||
@ -219,6 +220,7 @@ func (s *executionService) executeAsync(ctx context.Context, execution *domain.F
|
||||
execution.Error = result.Error
|
||||
execution.Duration = result.Duration
|
||||
execution.MemoryUsed = result.MemoryUsed
|
||||
execution.Logs = result.Logs
|
||||
|
||||
// Check if the result indicates a timeout
|
||||
if result.Error != "" {
|
||||
@ -327,31 +329,18 @@ func (s *executionService) Cancel(ctx context.Context, id uuid.UUID, userID stri
|
||||
}
|
||||
|
||||
func (s *executionService) GetLogs(ctx context.Context, id uuid.UUID) ([]string, error) {
|
||||
// Get execution
|
||||
// Get execution with logs from database
|
||||
execution, err := s.executionRepo.GetByID(ctx, id)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("execution not found: %w", err)
|
||||
}
|
||||
|
||||
// Get function to determine runtime
|
||||
function, err := s.functionRepo.GetByID(ctx, execution.FunctionID)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("function not found: %w", err)
|
||||
// Return logs from execution record
|
||||
if execution.Logs == nil {
|
||||
return []string{}, nil
|
||||
}
|
||||
|
||||
// Get runtime backend
|
||||
backend, err := s.runtimeService.GetBackend(ctx, string(function.Runtime))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get runtime backend: %w", err)
|
||||
}
|
||||
|
||||
// Get logs from runtime
|
||||
logs, err := backend.GetLogs(ctx, id)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to get logs: %w", err)
|
||||
}
|
||||
|
||||
return logs, nil
|
||||
|
||||
return execution.Logs, nil
|
||||
}
|
||||
|
||||
func (s *executionService) GetRunningExecutions(ctx context.Context) ([]*domain.FunctionExecution, error) {
|
||||
|
||||
Reference in New Issue
Block a user