blacky
This commit is contained in:
parent
38fb073291
commit
48eb2bb792
@ -96,6 +96,7 @@ def queue_manager(queue_manager_name):
|
||||
def callback():
|
||||
def inner(request):
|
||||
return request["data"].decode() * 2
|
||||
|
||||
return inner
|
||||
|
||||
|
||||
|
||||
@ -22,7 +22,6 @@ def access_callback():
|
||||
|
||||
@pytest.fixture()
|
||||
def items():
|
||||
|
||||
def inner():
|
||||
for i in range(3):
|
||||
body = {
|
||||
@ -53,6 +52,7 @@ class TestConsumer:
|
||||
def mock_visitor(callback):
|
||||
def inner(data):
|
||||
return callback({"data": data.encode()})
|
||||
|
||||
return inner
|
||||
|
||||
callback = mock_visitor(callback)
|
||||
@ -94,9 +94,8 @@ class TestConsumer:
|
||||
|
||||
@pytest.mark.parametrize("queue_manager_name", ["pika"], scope="session")
|
||||
def test_message_is_republished_when_callback_raises_processing_failure_exception(
|
||||
self, consumer, queue_manager, bucket_name, items
|
||||
self, consumer, queue_manager, bucket_name, items
|
||||
):
|
||||
|
||||
class DebugError(Exception):
|
||||
pass
|
||||
|
||||
|
||||
@ -29,9 +29,7 @@ def parse_args():
|
||||
|
||||
def add_file_compressed(storage, bucket_name, dossier_id, path) -> None:
|
||||
|
||||
path_gz = combine_dossier_id_and_file_id_and_extension(
|
||||
dossier_id, Path(path).stem, ".ORIGIN.pdf.gz"
|
||||
)
|
||||
path_gz = combine_dossier_id_and_file_id_and_extension(dossier_id, Path(path).stem, ".ORIGIN.pdf.gz")
|
||||
|
||||
with open(path, "rb") as f:
|
||||
data = gzip.compress(f.read())
|
||||
|
||||
@ -10,7 +10,14 @@ def build_message_bodies():
|
||||
for bucket_name, pdf_name in storage.get_all_object_names(CONFIG.storage.bucket):
|
||||
file_id = pdf_name.split(".")[0]
|
||||
dossier_id, file_id = file_id.split("/")
|
||||
yield json.dumps({"dossierId": dossier_id, "fileId": file_id, "targetFileExtension": "ORIGIN.pdf.gz", "responseFileExtension": "detr.json.gz"}).encode()
|
||||
yield json.dumps(
|
||||
{
|
||||
"dossierId": dossier_id,
|
||||
"fileId": file_id,
|
||||
"targetFileExtension": "ORIGIN.pdf.gz",
|
||||
"responseFileExtension": "detr.json.gz",
|
||||
}
|
||||
).encode()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@ -16,7 +16,6 @@ from pyinfra.visitor import QueueVisitor, StorageStrategy
|
||||
|
||||
def make_callback(analysis_endpoint):
|
||||
def callback(message):
|
||||
|
||||
def perform_operation(operation):
|
||||
endpoint = f"{analysis_endpoint}/{operation}"
|
||||
try:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user