Skip to main content

start_filter

Filter tasks.

def start_filter(
app: Celery,
conn: kombu.Connection,
filter: callable,
limit: int = None,
timeout: float = 1.0,
ack_messages: bool = False,
tasks: list = None,
queues: list = None,
callback: callable = None,
forever: bool = False,
on_declare_queue: callable = None,
consume_from: list = None,
state: Any = None,
accept: list = None,
**kwargs: dict
) - > Any

Filter tasks.

Parameters

NameTypeDescription
appCeleryThe Celery application instance used to access configuration and task registries.
connkombu.ConnectionThe broker connection used to consume messages for filtering.
filtercallableA predicate function used to determine which tasks should be processed or matched.
limitint = NoneThe maximum number of tasks to process before stopping.
timeoutfloat = 1.0The maximum time in seconds to wait for new messages from the broker.
ack_messagesbool = FalseWhether to acknowledge messages to the broker after they have been filtered.
taskslist = NoneA list of specific task names to include in the filtering process.
queueslist = NoneA list of queue names to consume from during the filtering operation.
callbackcallable = NoneA function to be executed for every task that matches the filter criteria.
foreverbool = FalseIf true, the filterer will continue to run indefinitely until manually stopped.
on_declare_queuecallable = NoneAn optional callback triggered when a queue is declared by the consumer.
consume_fromlist = NoneSpecific queue instances or names to bind the consumer to.
stateAny = NoneAn optional state object used to track the progress or results of the filtering.
acceptlist = NoneA list of content types to accept (e.g., ['json', 'pickle']).
**kwargsdictAdditional keyword arguments passed directly to the Filterer constructor.

Returns

TypeDescription
AnyThe result of the Filterer.start() execution, typically initiating the task filtering process.