included rabbitmq as broker

This commit is contained in:
2026-11-10 07:01:17 +03:00
parent 0a70358829
commit 2b9fb3f375
49 changed files with 3072 additions and 287 deletions
+27
View File
@@ -1,3 +1,5 @@
import errno
from collections.abc import Mapping
from PIL import Image, UnidentifiedImageError
@@ -107,3 +109,28 @@ def image_validation_error(code: int) -> ApiError:
if code == 3 or code < 0:
error = payload_too_large("Превышен лимит пикселей или ресурсов изображения")
return error
class ProcessingError(Exception):
"""Постоянная ошибка pipeline с безопасным машинным кодом."""
def __init__(self, code: str) -> None:
super().__init__(code)
self.code = code
class JobOperationError(Exception):
"""Безопасный код отказа операторской команды."""
def __init__(self, code: str):
self.code = code
super().__init__(code)
def pipeline_worker_error_code(error: Exception) -> int:
"""Отделить ошибки файловой системы от ошибки декодирования изображения."""
if isinstance(error, OSError) and error.errno is not None:
if error.errno in {errno.EACCES, errno.EPERM, errno.EROFS, errno.ENOENT}:
return 5
return 4
return image_worker_error_code(error)