Celery
Que es Celery?
Celery es un sistema simple, flexible y confiableto process vast amounts of messages, while providing operations with the tools required to maintain such a system.
Workers
Casos de Uso
Kaumer
Reportes
Eyeride
Procesamiento en BackGround
Generacion de Video
Canvas
Signature
Primitives
Signature
signature("name_function", *args, **kwargs, options)
signature("add", (2, 2), {'debug': True}, countdown=10)
add.s(2, 2), {'debug': True}, countdown=10)
Signature
Partials
Immutability
Callbacks
Primitives
Primitives
Chains
Permiten juntar tareas
s = sum_numbers.s(1,2)
s.link(mul_numbers.s(4))
s.link(sub_numbers.s(4)).delay()
chain(sum_numbers.s(1, 4), mul_numbers.s(4), sub_numbers.s(4)).delay()
Primitives
Groups
Permite que una serie de tareas sean ejecutadas una detras de otra
g = group(sum_numbers.s(i, i) for i in range(100))
g.delay()
Primitives
Chords
Es una tarea que solo se ejecuta cuando un grupo de tareas ha finalizado su ejecucion
chord(sum_numbers.s(i, i) for i in range(10))(pow_numbers.s()).delay()
Primitives
Chords
Es una tarea que solo se ejecuta cuando un grupo de tareas ha finalizado su ejecucion
chord(sum_numbers.s(i, i) for i in range(10))(pow_numbers.s()).delay()
Primitives
map y starmap
LLama la tarea secuenciamente
map envia los elementos como una variable
tasks.sum_numbers.map(list(zip(range(100), range(100)))).delay()
[counter.tasks.sum_numbers(x) for x in [(0, 0), (1, 1), (2, 2), (3, 3),
(4, 4), (5, 5), (6, 6), (7, 7), (8, 8), (9, 9), (10, 10), (11,...]
mientras que starmap los envia como parametros
tasks.sum_numbers.starmap(list(zip(range(100), range(100)))).delay()
[counter.tasks.sum_numbers(*x) for x in [(0, 0), (1, 1), (2, 2), (3, 3),
(4, 4), (5, 5), (6, 6), (7, 7), (8, 8), (9, 9), (10, 10), (11,...]
Primitives
Chunks
Permiten dividir una tarea iterable en grupos
sum_numbers.chunks(zip(range(100),
range(100)), 10).apply_async()
Celery
By Leonardo Fabio Orozco Padilla
Celery
- 1,386