ネコと和解せよ

celeryのシグナル調査ログ

celeryのシグナルのログ

from celery.signals import *
import os

@eventlet_pool_started.connect
def eventlet_pool_started(sender=None, headers=None, body=None, **kwargs):
    print("accept eventlet_pool_started %d"%(os.getpid(),))

@eventlet_pool_apply.connect
def eventlet_pool_apply(sender=None, headers=None, body=None, **kwargs):
    print("accept eventlet_pool_apply %d"%(os.getpid(),))

@worker_shutting_down.connect
def worker_shutting_down(sender=None, headers=None, body=None, **kwargs):
    print("accept worker_shutting_down %d"%(os.getpid(),))

@worker_ready.connect
def worker_ready(sender=None, headers=None, body=None, **kwargs):
    print("accept worker_ready %d"%(os.getpid(),))

@worker_init.connect
def worker_init(sender=None, headers=None, body=None, **kwargs):
    print("accept worker_init %d"%(os.getpid(),))
@worker_process_init.connect
def worker_process_init(sender=None, headers=None, body=None, **kwargs):
    print("accept worker_process_init %d"%(os.getpid(),))
@worker_process_shutdown.connect
def worker_process_shutdown(sender=None, headers=None, body=None, **kwargs):
    print("accept worker_process_shutdown %d"%(os.getpid(),))
@worker_shutdown.connect
def worker_shutdown(sender=None, headers=None, body=None, **kwargs):
    print("accept worker_shutdown %d"%(os.getpid(),))

# @eventlet_pool_started.connect
# def eventlet_pool_started(sender=None, headers=None, body=None, **kwargs):
#     print("accept eventlet_pool_started %d"%(os.getpid(),))
# @eventlet_pool_preshutdown.connect
# def eventlet_pool_preshutdown(sender=None, headers=None, body=None, **kwargs):
#     print("accept eventlet_pool_preshutdown %d"%(os.getpid(),))
# @eventlet_pool_postshutdown.connect
# def eventlet_pool_postshutdown(sender=None, headers=None, body=None, **kwargs):
#     print("accept eventlet_pool_postshutdown %d"%(os.getpid(),))
# @eventlet_pool_apply.connect
# def eventlet_pool_apply(sender=None, headers=None, body=None, **kwargs):
#     print("accept eventlet_pool_apply %d"%(os.getpid(),))
@celeryd_init.connect
def celeryd_init(sender=None, headers=None, body=None, **kwargs):
    print("accept celeryd_init %d"%(os.getpid(),))
@celeryd_after_setup.connect
def celeryd_after_setup(sender=None, headers=None, body=None, **kwargs):
    print("accept celeryd_after_setup %d"%(os.getpid(),))

@before_task_publish.connect
def before_task_publish(sender=None, headers=None, body=None, **kwargs):
    print("accept before_task_publish %d"%(os.getpid(),))
@after_task_publish.connect
def after_task_publish(sender=None, headers=None, body=None, **kwargs):
    print("accept after_task_publish %d"%(os.getpid(),))
@task_prerun.connect
def task_prerun(sender=None, headers=None, body=None, **kwargs):
    print("accept task_prerun %d"%(os.getpid(),))
@task_postrun.connect
def task_postrun(sender=None, headers=None, body=None, **kwargs):
    print("accept task_postrun %d"%(os.getpid(),))
@task_retry.connect
def task_retry(sender=None, headers=None, body=None, **kwargs):
    print("accept task_retry %d"%(os.getpid(),))
# @task_received.connect
# def task_received(sender=None, headers=None, body=None, **kwargs):
#     print("accept task_received %d"%(os.getpid(),))
@task_revoked.connect
def task_revoked(sender=None, headers=None, body=None, **kwargs):
    print("accept task_revoked %d"%(os.getpid(),))
accept celeryd_init 10938
accept worker_init 10938
accept celeryd_after_setup 10938

 -------------- celery@LAPTOP-EHTVJ4P3 v4.4.2 (cliffs)
--- ***** -----
-- ******* ---- Linux-4.4.0-18362-Microsoft-x86_64-with-Ubuntu-18.04-bionic 2020-05-29 18:51:09
- *** --- * ---
- ** ---------- [config]
- ** ---------- .> app:         task:0x7fdd4fbd8790
- ** ---------- .> transport:   redis://192.168.128.11:6379/0
- ** ---------- .> results:     redis://192.168.128.11:6379/1
- *** --- * --- .> concurrency: 2 (prefork)
-- ******* ---- .> task events: OFF (enable -E to monitor tasks in this worker)
--- ***** -----
 -------------- [queues]
                .> celery           exchange=celery(direct) key=celery


[2020-05-29 18:51:09,908: WARNING/ForkPoolWorker-1] accept worker_process_init 10942
[2020-05-29 18:51:09,995: WARNING/ForkPoolWorker-2] accept worker_process_init 10943
[2020-05-29 18:51:11,771: WARNING/MainProcess] accept worker_ready 10938
[2020-05-29 18:51:41,304: WARNING/ForkPoolWorker-1] accept task_prerun 10942
[2020-05-29 18:51:41,323: WARNING/ForkPoolWorker-2] accept task_prerun 10943
[2020-05-29 18:51:41,666: WARNING/ForkPoolWorker-2] optimizeStdMap started ff78f2ca-a191-11ea-a909-002b67044a6c
[2020-05-29 18:51:41,693: WARNING/ForkPoolWorker-1] optimizeStdMap started ff7cf5dc-a191-11ea-ad17-002b67044a6c
[2020-05-29 18:51:42,199: WARNING/ForkPoolWorker-1] Finisied ff7cf5dc-a191-11ea-ad17-002b67044a6c
[2020-05-29 18:51:42,207: WARNING/ForkPoolWorker-2] Finisied ff78f2ca-a191-11ea-a909-002b67044a6c
[2020-05-29 18:51:42,283: WARNING/ForkPoolWorker-1] accept task_postrun 10942
[2020-05-29 18:51:42,291: WARNING/ForkPoolWorker-2] accept task_postrun 10943
[2020-05-29 18:51:42,884: WARNING/ForkPoolWorker-2] accept task_prerun 10943
[2020-05-29 18:51:42,884: WARNING/ForkPoolWorker-1] accept task_prerun 10942
[2020-05-29 18:51:43,144: WARNING/ForkPoolWorker-1] optimizeStdMap started 005a6c00-a192-11ea-ad17-002b67044a6c
[2020-05-29 18:51:43,143: WARNING/ForkPoolWorker-2] optimizeStdMap started 005a4978-a192-11ea-a909-002b67044a6c
[2020-05-29 18:51:43,304: WARNING/ForkPoolWorker-2] Finisied 005a4978-a192-11ea-a909-002b67044a6c
[2020-05-29 18:51:43,370: WARNING/ForkPoolWorker-2] accept task_postrun 10943
[2020-05-29 18:51:43,659: WARNING/ForkPoolWorker-1] Finisied 005a6c00-a192-11ea-ad17-002b67044a6c
[2020-05-29 18:51:43,730: WARNING/ForkPoolWorker-1] accept task_postrun 10942
[2020-05-29 18:51:44,234: WARNING/ForkPoolWorker-2] accept task_prerun 10943
[2020-05-29 18:51:44,239: WARNING/ForkPoolWorker-1] accept task_prerun 10942
[2020-05-29 18:51:44,467: WARNING/ForkPoolWorker-2] optimizeStdMap started 01243706-a192-11ea-a909-002b67044a6c
[2020-05-29 18:51:44,488: WARNING/ForkPoolWorker-1] optimizeStdMap started 012771e6-a192-11ea-ad17-002b67044a6c
[2020-05-29 18:51:44,627: WARNING/ForkPoolWorker-1] Finisied 012771e6-a192-11ea-ad17-002b67044a6c
[2020-05-29 18:51:44,692: WARNING/ForkPoolWorker-2] Finisied 01243706-a192-11ea-a909-002b67044a6c
[2020-05-29 18:51:44,698: WARNING/ForkPoolWorker-1] accept task_postrun 10942
[2020-05-29 18:51:44,753: WARNING/ForkPoolWorker-2] accept task_postrun 10943
[2020-05-29 18:51:45,257: WARNING/ForkPoolWorker-1] accept task_prerun 10942
[2020-05-29 18:51:45,258: WARNING/ForkPoolWorker-2] accept task_prerun 10943
[2020-05-29 18:51:45,532: WARNING/ForkPoolWorker-1] optimizeStdMap started 01c6bc56-a192-11ea-ad17-002b67044a6c
[2020-05-29 18:51:45,536: WARNING/ForkPoolWorker-2] optimizeStdMap started 01c77786-a192-11ea-a909-002b67044a6c
[2020-05-29 18:51:45,712: WARNING/ForkPoolWorker-2] Finisied 01c77786-a192-11ea-a909-002b67044a6c
[2020-05-29 18:51:45,743: WARNING/ForkPoolWorker-1] Finisied 01c6bc56-a192-11ea-ad17-002b67044a6c
[2020-05-29 18:51:45,780: WARNING/ForkPoolWorker-2] accept task_postrun 10943
[2020-05-29 18:51:45,807: WARNING/ForkPoolWorker-1] accept task_postrun 10942
[2020-05-29 18:51:46,599: WARNING/ForkPoolWorker-1] accept task_prerun 10942
[2020-05-29 18:51:46,615: WARNING/ForkPoolWorker-2] accept task_prerun 10943
[2020-05-29 18:51:46,846: WARNING/ForkPoolWorker-1] optimizeStdMap started 028f5648-a192-11ea-ad17-002b67044a6c
[2020-05-29 18:51:46,872: WARNING/ForkPoolWorker-2] optimizeStdMap started 029335ce-a192-11ea-a909-002b67044a6c
[2020-05-29 18:51:46,971: WARNING/ForkPoolWorker-1] Finisied 028f5648-a192-11ea-ad17-002b67044a6c
[2020-05-29 18:51:46,999: WARNING/ForkPoolWorker-2] Finisied 029335ce-a192-11ea-a909-002b67044a6c
[2020-05-29 18:51:47,032: WARNING/ForkPoolWorker-1] accept task_postrun 10942
[2020-05-29 18:51:47,061: WARNING/ForkPoolWorker-2] accept task_postrun 10943
^C
worker: Hitting Ctrl+C again will terminate all running tasks!

worker: Warm shutdown (MainProcess)
accept worker_shutting_down 10938


[2020-05-29 18:52:10,109: WARNING/ForkPoolWorker-2] accept worker_process_shutdown 10943
[2020-05-29 18:52:10,109: WARNING/ForkPoolWorker-1] accept worker_process_shutdown 10942
[2020-05-29 18:52:11,116: WARNING/MainProcess] accept worker_shutdown 10938

クライアント側

Compressed TLS len 2144155
 10->  0 {}->  0 {}
accept before_task_publish 10944
  9->  1 {'PENDING': 1}->  0 {}
accept before_task_publish 10944
  8->  2 {'PENDING': 2}->  0 {}
accept before_task_publish 10944
  7->  3 {'PENDING': 3}->  0 {}
accept before_task_publish 10944
  6->  4 {'PENDING': 4}->  0 {}
accept before_task_publish 10944
  5->  5 {'PENDING': 5}->  0 {}
accept before_task_publish 10944
  4->  6 {'PENDING': 6}->  0 {}
accept before_task_publish 10944
  3->  7 {'PENDING': 7}->  0 {}
accept before_task_publish 10944
  2->  8 {'PENDING': 8}->  0 {}
accept before_task_publish 10944
  1->  9 {'PENDING': 9}->  0 {}
accept before_task_publish 10944
  0->  2 {'PENDING': 2}->  8 {'SUCCESS': 8}
TOTAL :10/10
  WAITING :0(0.00%)
  RUNNING :0(0.00%)
  DONE    :10(100.00%)
{'SUCCESS': 10}