filtering of callback results, such that only results remain, where at least of of data and metadata is not empty

This commit is contained in:
Matthias Bisping 2022-06-22 16:17:09 +02:00
parent 4a0bd216a4
commit 99e7f059a7

View File

@ -3,7 +3,7 @@ from typing import Callable
from funcy import lflatten, compose from funcy import lflatten, compose
from pyinfra.storage.storage import Storage from pyinfra.storage.storage import Storage
from pyinfra.utils.func import lift from pyinfra.utils.func import lift, flift
from pyinfra.visitor.response_formatter.formatter import ResponseFormatter from pyinfra.visitor.response_formatter.formatter import ResponseFormatter
from pyinfra.visitor.response_formatter.formatters.identity import IdentityResponseFormatter from pyinfra.visitor.response_formatter.formatters.identity import IdentityResponseFormatter
from pyinfra.visitor.strategies.blob_parsing.blob_parsing import BlobParsingStrategy from pyinfra.visitor.strategies.blob_parsing.blob_parsing import BlobParsingStrategy
@ -54,6 +54,7 @@ class QueueVisitor:
"""Bundles the result from processing a storage item with the body of the corresponding queue item.""" """Bundles the result from processing a storage item with the body of the corresponding queue item."""
callback_results = compose( callback_results = compose(
flift(any),
lflatten, lflatten,
lift(self.get_item_processor(queue_item_body)), lift(self.get_item_processor(queue_item_body)),
self.load_data, self.load_data,