Gerador de Relatorios de Contagem

ID d9612271-e183-4f8c-9ec7-b72c9de80458
Status Falhou
Criado em 25/05/2026 18:10:46
Finalizado em 25/05/2026 18:10:47
Progresso 0,0%
Etapa atual Iniciando...

Mensagem de erro

You cannot call this from an async context - use a thread or sync_to_async.

Configuracao

{'chapter': 1, 'starting_point': 1, 'num_points': 4, 'starting_figure': 1, 'starting_table': 1, 'figure_template': '1', 'table_template': '1'}

Log Detalhado

[2026-05-25 21:10:46] [INFO] Job criado. session_key=97z5gbob21yvl2vv6qjrgp0hhjdprlqv
[2026-05-25 21:10:46] [INFO] Config: {'chapter': 1, 'starting_point': 1, 'num_points': 4, 'starting_figure': 1, 'starting_table': 1, 'figure_template': '1', 'table_template': '1'}
[2026-05-25 21:10:46] [INFO] Thread de geracao iniciada
[2026-05-25 21:10:46] [INFO] Output dir: /app/outputs/d9612271-e183-4f8c-9ec7-b72c9de80458
[2026-05-25 21:10:46] [INFO] Pontos a processar: [1, 2, 3, 4]
[2026-05-25 21:10:47] [INFO] Croquis encontrados: 15 arquivos em 14 pontos
[2026-05-25 21:10:47] [INFO] Planilhas encontradas: 14
[2026-05-25 21:10:47] [ERROR] ERRO FATAL: You cannot call this from an async context - use a thread or sync_to_async.
[2026-05-25 21:10:47] [ERROR] Traceback (most recent call last):
  File "/app/reports/views.py", line 413, in _run_generation_background
    job.save(update_fields=['current_step', 'progress'])
  File "/usr/local/lib/python3.12/site-packages/django/db/models/base.py", line 874, in save
    self.save_base(
  File "/usr/local/lib/python3.12/site-packages/django/db/models/base.py", line 966, in save_base
    updated = self._save_table(
              ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/db/models/base.py", line 1110, in _save_table
    results = self._do_update(
              ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/db/models/base.py", line 1213, in _do_update
    return filtered._update(values, returning_fields)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/db/models/query.py", line 1327, in _update
    return query.get_compiler(self.db).execute_returning_sql(returning_fields)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 2140, in execute_returning_sql
    row_count = self.execute_sql(ROW_COUNT)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 2111, in execute_sql
    row_count = super().execute_sql(result_type)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/db/models/sql/compiler.py", line 1622, in execute_sql
    cursor = self.connection.cursor()
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/django/utils/asyncio.py", line 24, in inner
    raise SynchronousOnlyOperation(message)
django.core.exceptions.SynchronousOnlyOperation: You cannot call this from an async context - use a thread or sync_to_async.