This document describes the current stable version of Celery (4.0). For development docs, go here.

celery.concurrency.base

Base Execution Pool.

class celery.concurrency.base.BasePool(limit=None, putlocks=True, forking_enable=True, callbacks_propagate=(), app=None, **options)[source]

Task pool.

CLOSE = 2
RUN = 1
TERMINATE = 3
class Timer(schedule=None, on_error=None, on_tick=None, on_start=None, max_interval=None, **kwargs)

Timer thread.

Note

This is only used for transports not supporting AsyncIO.

class Entry(fun, args=None, kwargs=None)

Schedule Entry.

args
cancel()
canceled
cancelled
fun
kwargs
tref
BasePool.Timer.Schedule

alias of Timer

BasePool.Timer.call_after(*args, **kwargs)
BasePool.Timer.call_at(*args, **kwargs)
BasePool.Timer.call_repeatedly(*args, **kwargs)
BasePool.Timer.cancel(tref)
BasePool.Timer.clear()
BasePool.Timer.empty()
BasePool.Timer.ensure_started()
BasePool.Timer.enter(entry, eta, priority=None)
BasePool.Timer.enter_after(*args, **kwargs)
BasePool.Timer.exit_after(secs, priority=10)
BasePool.Timer.next()
BasePool.Timer.on_tick = None
BasePool.Timer.queue
BasePool.Timer.run()
BasePool.Timer.running = False
BasePool.Timer.stop()
BasePool.active
BasePool.apply_async(target, args=[], kwargs={}, **options)[source]

Equivalent of the apply() built-in function.

Callbacks should optimally return as soon as possible since otherwise the thread which handles the result will get blocked.

BasePool.body_can_be_buffer = False
BasePool.close()[source]
BasePool.did_start_ok()[source]
BasePool.flush()[source]
BasePool.info
BasePool.is_green = False

set to true if pool uses greenlets.

BasePool.maintain_pool(*args, **kwargs)[source]
BasePool.num_processes
BasePool.on_apply(*args, **kwargs)[source]
BasePool.on_close()[source]
BasePool.on_hard_timeout(job)[source]
BasePool.on_soft_timeout(job)[source]
BasePool.on_start()[source]
BasePool.on_stop()[source]
BasePool.on_terminate()[source]
BasePool.register_with_event_loop(loop)[source]
BasePool.restart()[source]
BasePool.signal_safe = True

set to true if the pool can be shutdown from within a signal handler.

BasePool.start()[source]
BasePool.stop()[source]
BasePool.task_join_will_block = True
BasePool.terminate()[source]
BasePool.terminate_job(pid, signal=None)[source]
BasePool.uses_semaphore = False

only used by multiprocessing pool

celery.concurrency.base.apply_target(target, args=(), kwargs={}, callback=None, accept_callback=None, pid=None, getpid=<built-in function getpid>, propagate=(), monotonic=<function _monotonic>, **_)[source]

Apply function within pool context.