resolved mutually import

This commit is contained in:
Matthias Bisping 2022-02-17 16:44:17 +01:00
parent 2ff697c3a9
commit eb2686b027
2 changed files with 6 additions and 7 deletions

View File

@ -7,7 +7,6 @@ import requests
from pyinfra.callback import json_wrap
from pyinfra.exceptions import DataLoadingFailure, AnalysisFailure, ProcessingFailure
from pyinfra.utils.file import dossier_id_and_file_id_to_compressed_storage_pdf_object_name
from src.serve import get_storage
def make_storage_data_loader(storage):
@ -50,10 +49,7 @@ def make_analyzer(analysis_endpoint):
return analyze
def make_payload_processor(analysis_endpoint):
load_data = make_storage_data_loader(get_storage())
analyze_file = make_analyzer(analysis_endpoint)
def make_payload_processor(load_data, analyze_file):
@json_wrap
def process(payload: dict):

View File

@ -12,7 +12,7 @@ from pyinfra.callback import (
)
from pyinfra.config import CONFIG
from pyinfra.consume import consume, ConsumerError
from pyinfra.core import make_payload_processor
from pyinfra.core import make_payload_processor, make_storage_data_loader, make_analyzer
from pyinfra.exceptions import UnknownStorageBackend
from pyinfra.storage.azure_blob_storage import AzureBlobStorageHandle
from pyinfra.storage.minio import MinioHandle
@ -65,7 +65,10 @@ def republish(channel, body, n_current_attempts):
def make_callback():
json_wrapped_body_processor = make_payload_processor(CONFIG.service.analysis_endpoint)
load_data = make_storage_data_loader(get_storage())
analyze_file = make_analyzer(CONFIG.service.analysis_endpoint)
json_wrapped_body_processor = make_payload_processor(load_data, analyze_file)
if CONFIG.rabbitmq.retry.enabled:
retry_callback = make_retry_callback(republish, max_attempts=CONFIG.rabbitmq.retry.max_attempts)