skip to Main Content

I’m using django with celery, celery beat, and redis to run periodic tasks.

The problem I’m having is that tasks registered in celery are received but not executed.

Also, the task stops in the middle even though I have not specified a stop setting.

The environment is as follows.

windows10
python = 3.7.9
PostgreSQL 13.3
Redis server v=3.0.504 sha=00000000:0 malloc=jemalloc-3.6.0 bits=64 build=a4f7a6e86f2d60b3
[requirements]
celery==5.0.5
Django==3.2.4
django-celery-beat==2.2.0
django-celery-results==2.0.1
django-redis==5.0.0
redis==3.5.3

I built the environment by referring to the following site.

https://docs.celeryproject.org/en/stable/django/first-steps-with-django.html

project
|
+-app
|   +-__init__.py
|   +-tasks.py
|
+-project
|   +-__init__.py
|   +-celery.py
|   +-settings.py
|
+-.env
+-manage.py
+-requirements.txt

settings are configured as follows.

settings.py

INSTALLED_APPS = [ 
    # Add your apps here to enable them 
.
.
.
    'django_celery_results',
    'django_celery_beat', 
.
.
]

# Database 
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases 
load_dotenv(find_dotenv()) 
DATABASES = { 
    'default': dj_database_url.config(conn_max_age=600), 
}

CELERY_BROKER_URL = "redis://127.0.0.1:6379/1" 
CELERY_RESULT_BACKEND = "django-db" 
#CELERY_RESULT_BACKEND = "redis://127.0.0.1:6379/" 
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField' 
CELERY_BEAT_SCHEDULER = 'django_celery_beat.schedulers:DatabaseScheduler'

.env

DATABASE_URL=postgres://postgres:pass@localhost/project

celery.py

import os 
from celery import Celery 
# set the default Django settings module for the 'celery' program. 
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 
                      'Project.settings') 
app = Celery('Project') 
# Using a string here means the worker doesn't have to serialize 
# the configuration object to child processes. 
# - namespace='CELERY' means all celery-related configuration keys 
#   should have a `CELERY_` prefix. 
app.config_from_object('django.conf:settings', namespace='CELERY') 
# Load task modules from all registere 
app.autodiscover_tasks() 
@app.task(bind=True) 
def debug_task(self): 
    print(f'Request: {self.request!r}')

project/project/init.py

# This will make sure the app is always imported when
# Django starts so that shared_task will use this app.
from celery import app as celery_app


__all__ = ('celery_app',)

project/app/tasks.py

from celery import shared_task


@shared_task 
def hello(): 
    print("hello")

project/app/init.py
this is empty

(1) What we did

In the browser, in the admin settings, set the hello() task to run once every 5 seconds permanently.

(2) What I did

Running the redis server at the command prompt: redis-server

In this environment, use PowerShell to run the following command in the project root location to run the celery worker

celery -A StreamerMonitoringWebsite worker -l info

Also, run the following command in another Powershell to run celery beat

celery -A StreamerMonitoringWebsite beat --scheduler django_celery_beat.schedulers:DatabaseScheduler

(Result)

redis and celery beat were still running and did not output any logs.

No logs were left in the results of the administration site either.

The celery worker output the following logs.

[tasks]
  . project.tasks.add
  . project.tasks.check_and_start
  . project.tasks.hello
  . project.tasks.test_create
  . project.celery.debug_task

[2021-06-14 16:18:03,278: INFO/MainProcess] Connected to redis://127.0.0.1:6379/1
[2021-06-14 16:18:03,294: INFO/MainProcess] mingle: searching for neighbors
[2021-06-14 16:18:04,047: INFO/SpawnPoolWorker-2] child process 26228 calling self.run()
[2021-06-14 16:18:04,057: INFO/SpawnPoolWorker-5] child process 18080 calling self.run()
[2021-06-14 16:18:04,058: INFO/SpawnPoolWorker-3] child process 10872 calling self.run()
[2021-06-14 16:18:04,059: INFO/SpawnPoolWorker-4] child process 18800 calling self.run()
[2021-06-14 16:18:04,066: INFO/SpawnPoolWorker-7] child process 21012 calling self.run()
[2021-06-14 16:18:04,075: INFO/SpawnPoolWorker-8] child process 3448 calling self.run()
[2021-06-14 16:18:04,101: INFO/SpawnPoolWorker-6] child process 19616 calling self.run()
[2021-06-14 16:18:04,122: INFO/SpawnPoolWorker-1] child process 13080 calling self.run()
[2021-06-14 16:18:04,342: INFO/MainProcess] mingle: all alone
[2021-06-14 16:18:04,390: WARNING/MainProcess] d:sourcereposprojectherokulibsite-packagesceleryfixupsdjango.py:204: UserWarning: Using settings.DEBUG leads to a memory
            leak, never use this setting in production environments!
  leak, never use this setting in production environments!''')

[2021-06-14 16:18:04,390: INFO/MainProcess] celery@kt-PC ready.
[2021-06-14 16:18:04,478: INFO/MainProcess] Received task: project.tasks.hello[dcc8a06c-e619-4b02-9730-9c13a7859a9e]
[2021-06-14 16:18:04,480: INFO/MainProcess] Received task: project.tasks.hello[bbd755c9-f60c-4b22-bf90-8497c57a2f05]
[2021-06-14 16:18:04,482: INFO/MainProcess] Received task: project.tasks.hello[df9d7206-7aef-4ce1-bd2a-fbc859d7593e]
[2021-06-14 16:18:04,484: INFO/MainProcess] Received task: project.tasks.hello[21917b77-f0c2-4a44-89a5-8372d6fffbc8]
[2021-06-14 16:18:04,486: INFO/MainProcess] Received task: project.tasks.hello[7990df91-776c-44eb-a427-01710a1f4dfc]
[2021-06-14 16:18:04,489: INFO/MainProcess] Received task: project.tasks.hello[96eb8749-eaac-4be9-9e75-54954677b41c]
[2021-06-14 16:18:04,492: INFO/MainProcess] Received task: project.tasks.hello[49ddcfc9-779c-430d-abd4-4df30813b400]
[2021-06-14 16:18:04,493: INFO/MainProcess] Received task: project.tasks.hello[98c68ae9-1358-45d2-b2ed-fa30de3cbed2]
[2021-06-14 16:18:04,495: INFO/MainProcess] Received task: project.tasks.hello[e1685d2e-fa5f-43c6-86e8-270c07f17e53]
2021-06-14 16:18:06,857 DEBUG Using selector: SelectSelector
2021-06-14 16:18:06,862 DEBUG Using selector: SelectSelector
2021-06-14 16:18:06,904 DEBUG Using selector: SelectSelector
2021-06-14 16:18:06,999 DEBUG Using selector: SelectSelector
2021-06-14 16:18:07,008 DEBUG Using selector: SelectSelector
2021-06-14 16:18:07,021 DEBUG Using selector: SelectSelector
2021-06-14 16:18:07,041 DEBUG Using selector: SelectSelector
2021-06-14 16:18:07,069 DEBUG Using selector: SelectSelector
[2021-06-14 16:18:10,009: INFO/MainProcess] Received task: project.tasks.check_and_start[dd4e9fc3-42c5-435e-806f-794b2d3a318a]
[2021-06-14 16:18:10,781: INFO/SpawnPoolWorker-9] child process 24872 calling self.run()
[2021-06-14 16:18:10,824: INFO/MainProcess] Received task: project.tasks.hello[da94c19f-ce2e-4f83-8328-fd96683c4fab]
[2021-06-14 16:18:10,827: INFO/MainProcess] Received task: project.tasks.hello[212cb71c-abc9-429c-a6e4-62bf798440fc]
[2021-06-14 16:18:10,829: INFO/MainProcess] Received task: project.tasks.hello[2b3b5887-77dc-475c-a4d8-c4517d568002]
[2021-06-14 16:18:10,832: INFO/MainProcess] Received task: project.tasks.hello[73178e44-55f7-4ce6-8646-de6e4bb4b1c4]
[2021-06-14 16:18:11,526: INFO/SpawnPoolWorker-10] child process 6312 calling self.run()
[2021-06-14 16:18:11,527: INFO/SpawnPoolWorker-11] child process 22884 calling self.run()
[2021-06-14 16:18:11,530: INFO/SpawnPoolWorker-12] child process 252 calling self.run()
[2021-06-14 16:18:11,545: INFO/SpawnPoolWorker-13] child process 24364 calling self.run()
2021-06-14 16:18:13,204 DEBUG Using selector: SelectSelector
2021-06-14 16:18:13,881 DEBUG Using selector: SelectSelector
2021-06-14 16:18:13,903 DEBUG Using selector: SelectSelector
2021-06-14 16:18:13,906 DEBUG Using selector: SelectSelector
2021-06-14 16:18:13,957 DEBUG Using selector: SelectSelector
[2021-06-14 16:18:16,450: INFO/MainProcess] Received task: project.tasks.hello[58e0241d-7b9c-45cd-8aa9-8b78e854c7aa]
[2021-06-14 16:18:17,117: INFO/SpawnPoolWorker-14] child process 18276 calling self.run()
[2021-06-14 16:18:17,258: INFO/MainProcess] Received task: project.tasks.hello[1574a9fe-d161-4512-9c3a-ffc61f2436bf]
[2021-06-14 16:18:17,260: INFO/MainProcess] Received task: project.tasks.hello[0fe6d59b-d6dd-472a-aa0f-a75ebd021257]
[2021-06-14 16:18:17,925: INFO/SpawnPoolWorker-16] child process 2676 calling self.run()
[2021-06-14 16:18:17,926: INFO/SpawnPoolWorker-15] child process 25712 calling self.run()
2021-06-14 16:18:19,390 DEBUG Using selector: SelectSelector
2021-06-14 16:18:20,239 DEBUG Using selector: SelectSelector
2021-06-14 16:18:20,243 DEBUG Using selector: SelectSelector
[2021-06-14 16:18:22,071: INFO/MainProcess] Received task: project.tasks.hello[78bb7603-fa56-4a64-9e22-32b2dec718f4]
[2021-06-14 16:18:22,818: INFO/SpawnPoolWorker-17] child process 18992 calling self.run()
2021-06-14 16:18:24,822 DEBUG Using selector: SelectSelector
[2021-06-14 16:18:26,878: INFO/MainProcess] Received task: project.tasks.hello[3b8f16ba-3925-4ebe-b674-9244f41565f5]
[2021-06-14 16:18:27,456: INFO/SpawnPoolWorker-18] child process 26772 calling self.run()
2021-06-14 16:18:29,440 DEBUG Using selector: SelectSelector
[2021-06-14 16:20:33,381: INFO/MainProcess] Received task: project.tasks.hello[2578c47b-e2df-4ab8-a7e2-5740da433f6d]
[2021-06-14 16:20:33,384: INFO/MainProcess] Received task: project.tasks.hello[62f3ef08-9c0c-4e5f-a854-3ace2190ace1]
[2021-06-14 16:20:34,447: INFO/SpawnPoolWorker-20] child process 19312 calling self.run()
[2021-06-14 16:20:34,449: INFO/SpawnPoolWorker-19] child process 11836 calling self.run()
2021-06-14 16:20:36,359 DEBUG Using selector: SelectSelector
2021-06-14 16:20:36,373 DEBUG Using selector: SelectSelector
[2021-06-14 16:20:38,186: INFO/MainProcess] Received task: project.tasks.hello[4752729a-f221-407e-b494-23c2a92e73c2]
[2021-06-14 16:20:38,773: INFO/SpawnPoolWorker-21] child process 25796 calling self.run()
[2021-06-14 16:20:38,990: INFO/MainProcess] Received task: project.tasks.check_and_start[b8533af3-665b-4806-bb09-2640b139f863]
[2021-06-14 16:20:39,560: INFO/SpawnPoolWorker-22] child process 24868 calling self.run()
2021-06-14 16:20:40,641 DEBUG Using selector: SelectSelector
2021-06-14 16:20:41,492 DEBUG Using selector: SelectSelector
[2021-06-14 16:20:42,999: INFO/MainProcess] Received task: project.tasks.hello[d6bc8d29-a23f-414e-9070-53a83af3ca44]
[2021-06-14 16:20:43,569: INFO/SpawnPoolWorker-23] child process 26904 calling self.run()
2021-06-14 16:20:45,254 DEBUG Using selector: SelectSelector
[2021-06-14 16:20:47,005: INFO/MainProcess] Received task: project.tasks.hello[30179401-2c33-43c8-b88d-0c7e7461a1bf]
[2021-06-14 16:20:47,531: INFO/SpawnPoolWorker-24] child process 23592 calling self.run()
2021-06-14 16:20:49,234 DEBUG Using selector: SelectSelector
[2021-06-14 16:37:14,127: ERROR/MainProcess] Process 'SpawnPoolWorker-24' pid:11128 exited with 'exitcode 3221225786'
[2021-06-14 16:37:14,127: ERROR/MainProcess] Process 'SpawnPoolWorker-22' pid:3364 exited with 'exitcode 3221225786'
[2021-06-14 16:37:14,127: ERROR/MainProcess] Process 'SpawnPoolWorker-16' pid:5808 exited with 'exitcode 3221225786'
[2021-06-14 16:37:14,127: ERROR/MainProcess] Process 'SpawnPoolWorker-12' pid:24600 exited with 'exitcode 3221225786'
[2021-06-14 16:37:14,128: ERROR/MainProcess] Process 'SpawnPoolWorker-11' pid:20532 exited with 'exitcode 3221225786'

worker: Hitting Ctrl+C again will terminate all running tasks!

worker: Warm shutdown (MainProcess)
[2021-06-14 16:37:14,833: INFO/SpawnPoolWorker-27] child process 25792 calling self.run()
[2021-06-14 16:37:14,834: INFO/SpawnPoolWorker-26] child process 26160 calling self.run()
[2021-06-14 16:37:14,839: INFO/SpawnPoolWorker-29] child process 10108 calling self.run()
[2021-06-14 16:37:14,842: INFO/SpawnPoolWorker-28] child process 9360 calling self.run()
[2021-06-14 16:37:14,855: INFO/SpawnPoolWorker-25] child process 3084 calling self.run()
2021-06-14 16:37:16,614 DEBUG Using selector: SelectSelector
2021-06-14 16:37:16,652 DEBUG Using selector: SelectSelector
2021-06-14 16:37:16,654 DEBUG Using selector: SelectSelector
2021-06-14 16:37:16,655 DEBUG Using selector: SelectSelector
2021-06-14 16:37:16,670 DEBUG Using selector: SelectSelector

Where and how do I rewrite it so that it can be run as a recurring task?

If you need more information than these to solve my problem, please let me know which information you want.

【Addendum】

When I dared to register a misspelled task in beat, I got a failed result in the administration screen.

Also, if you run beat with "–loglevel=INFO", you will see that tasks are being sent at the specified frequency.

On the other hand, the worker recived the deleted task as if it were cached.

[beat results]
LocalTime -> 2021-06-15 04:51:27
Configuration ->
    . broker -> redis://127.0.0.1:6379/1
    . loader -> celery.loaders.app.AppLoader
    . scheduler -> django_celery_beat.schedulers.DatabaseScheduler

    . logfile -> [stderr]@%INFO
    . maxinterval -> 5.00 seconds (5s)
[2021-06-15 04:51:27,257: INFO/MainProcess] beat: Starting...
[2021-06-15 04:51:27,347: INFO/MainProcess] Scheduler: Sending due task check (app.tasks.check_and_start)
[2021-06-15 04:52:27,339: INFO/MainProcess] Scheduler: Sending due task check (app.tasks.check_and_start)
[2021-06-15 04:53:27,341: INFO/MainProcess] Scheduler: Sending due task check (app.tasks.check_and_start)
[2021-06-15 04:54:27,341: INFO/MainProcess] Scheduler: Sending due task check (app.tasks.check_and_start)
[2021-06-15 04:55:27,342: INFO/MainProcess] Scheduler: Sending due task check (app.tasks.check_and_start)
[2021-06-15 04:56:27,342: INFO/MainProcess] Scheduler: Sending due task check (app.tasks.check_and_start)
[2021-06-15 04:57:27,343: INFO/MainProcess] Scheduler: Sending due task check (app.tasks.check_and_start)
[2021-06-15 04:58:27,344: INFO/MainProcess] Scheduler: Sending due task check (app.tasks.check_and_start)
[2021-06-15 04:59:27,344: INFO/MainProcess] Scheduler: Sending due task check (app.tasks.check_and_start)
[2021-06-15 05:00:27,346: INFO/MainProcess] Scheduler: Sending due task check (app.tasks.check_and_start)
[2021-06-15 05:01:27,377: INFO/MainProcess] Scheduler: Sending due task check (app.tasks.check_and_start)
[2021-06-15 05:02:27,378: INFO/MainProcess] Scheduler: Sending due task check (app.tasks.check_and_start)
[2021-06-15 05:03:27,378: INFO/MainProcess] Scheduler: Sending due task check (app.tasks.check_and_start)
[2021-06-15 05:04:27,378: INFO/MainProcess] Scheduler: Sending due task check (app.tasks.check_and_start)
[2021-06-15 05:05:27,379: INFO/MainProcess] Scheduler: Sending due task check (app.tasks.check_and_start)
[worker results]:I hadn’t registered this as a task[app.tasks.hello[].

[tasks]
  . app.tasks.add
  . app.tasks.check_and_start__all
  . app.tasks.hello
  . app.tasks.test_create_AD_

[2021-06-15 04:53:14,741: INFO/MainProcess] Connected to redis://127.0.0.1:6379/1
[2021-06-15 04:53:14,761: WARNING/MainProcess] d:sourcereposprojectherokulibsite-packagesceleryfixupsdjango.py:204: UserWarning: Using settings.DEBUG leads to a memory
            leak, never use this setting in production environments!
  leak, never use this setting in production environments!''')

[2021-06-15 04:53:14,762: INFO/MainProcess] celery@kt-PC ready.
[2021-06-15 04:53:14,766: INFO/MainProcess] Received task: app.tasks.hello[5ce909a5-48bf-443b-8ac8-774c69a44127]
[2021-06-15 04:53:14,768: INFO/MainProcess] Received task: app.tasks.hello[7f0d22f9-e9db-4882-9efc-0bc73518ffd8]
[2021-06-15 04:53:14,770: INFO/MainProcess] Received task: app.tasks.hello[bad2744b-3758-4507-8b4f-2cd00b91d4e5]
[2021-06-15 04:53:14,772: INFO/MainProcess] Received task: app.tasks.hello[4fafb056-dc30-4bd5-8f77-eff4d10e681f]
[2021-06-15 04:53:14,774: INFO/MainProcess] Received task: app.tasks.hello[610b24b5-30ac-4dde-ae9b-12a4027766a7]
[2021-06-15 04:53:14,776: INFO/MainProcess] Received task: app.tasks.hello[a5ad084d-ba85-4d6f-bba5-7462925de6bb]
[2021-06-15 04:53:14,779: INFO/MainProcess] Received task: app.tasks.hello[d5a89b48-f935-4390-909a-04a290009fb9]
[2021-06-15 04:53:14,781: INFO/MainProcess] Received task: app.tasks.hello[1b81a478-1505-4c02-bc3c-ca77c735c222]
[2021-06-15 04:53:14,784: INFO/MainProcess] Received task: app.tasks.hello[e6e5d7a4-7b75-4017-a89f-76f525209261]
[2021-06-15 04:53:15,471: INFO/SpawnPoolWorker-4] child process 16552 calling self.run()
[2021-06-15 04:53:15,525: INFO/SpawnPoolWorker-5] child process 3140 calling self.run()
[2021-06-15 04:53:15,535: INFO/SpawnPoolWorker-7] child process 28244 calling self.run()
[2021-06-15 04:53:15,540: INFO/SpawnPoolWorker-1] child process 21492 calling self.run()
[2021-06-15 04:53:15,546: INFO/SpawnPoolWorker-2] child process 29492 calling self.run()
[2021-06-15 04:53:15,554: INFO/SpawnPoolWorker-3] child process 2320 calling self.run()
[2021-06-15 04:53:15,563: INFO/SpawnPoolWorker-8] child process 15520 calling self.run()
[2021-06-15 04:53:15,564: INFO/SpawnPoolWorker-6] child process 25240 calling self.run()
2021-06-15 04:53:18,235 DEBUG Using selector: SelectSelector
2021-06-15 04:53:18,329 DEBUG Using selector: SelectSelector
2021-06-15 04:53:18,377 DEBUG Using selector: SelectSelector
2021-06-15 04:53:18,402 DEBUG Using selector: SelectSelector
2021-06-15 04:53:18,439 DEBUG Using selector: SelectSelector
2021-06-15 04:53:18,461 DEBUG Using selector: SelectSelector
2021-06-15 04:53:18,464 DEBUG Using selector: SelectSelector
2021-06-15 04:53:18,489 DEBUG Using selector: SelectSelector
[2021-06-15 04:53:21,481: INFO/MainProcess] Received task: app.tasks.hello[9d9ca55d-875f-406c-88a8-76f6cf105265]
[2021-06-15 04:53:21,483: INFO/MainProcess] Received task: app.tasks.hello[ee504fa4-afcd-455f-b90d-743a4bb1b56b]
[2021-06-15 04:53:22,287: INFO/MainProcess] Received task: app.tasks.hello[6f72cf5e-57f9-49b5-81c4-08ed6323bead]
[2021-06-15 04:53:22,297: INFO/SpawnPoolWorker-10] child process 136 calling self.run()
[2021-06-15 04:53:22,322: INFO/SpawnPoolWorker-9] child process 27660 calling self.run()
[2021-06-15 04:53:22,955: INFO/SpawnPoolWorker-11] child process 24452 calling self.run()
[2021-06-15 04:53:23,096: INFO/MainProcess] Received task: app.tasks.hello[174a376b-e8c8-4abc-8ff4-db6a4204fc25]
[2021-06-15 04:53:23,098: INFO/MainProcess] Received task: app.tasks.hello[6d8593e9-3512-4718-a170-601074a5704c]
[2021-06-15 04:53:23,862: INFO/SpawnPoolWorker-13] child process 23392 calling self.run()
[2021-06-15 04:53:23,874: INFO/SpawnPoolWorker-12] child process 26336 calling self.run()
2021-06-15 04:53:24,627 DEBUG Using selector: SelectSelector
2021-06-15 04:53:24,650 DEBUG Using selector: SelectSelector
2021-06-15 04:53:25,526 DEBUG Using selector: SelectSelector
2021-06-15 04:53:26,426 DEBUG Using selector: SelectSelector
2021-06-15 04:53:26,430 DEBUG Using selector: SelectSelector
[2021-06-15 04:53:27,928: INFO/MainProcess] Received task: app.tasks.hello[29acaf77-beae-4812-a7d4-34a686a76d3a]
[2021-06-15 04:53:27,931: INFO/MainProcess] Received task: app.tasks.hello[9e63945c-c602-41d2-af32-a5a10483b530]
[2021-06-15 04:53:28,661: INFO/SpawnPoolWorker-14] child process 24448 calling self.run()
[2021-06-15 04:53:28,679: INFO/SpawnPoolWorker-15] child process 12668 calling self.run()
[2021-06-15 04:53:28,733: INFO/MainProcess] Received task: app.tasks.hello[78792943-0b15-46af-90b3-6181856e2f17]
[2021-06-15 04:53:29,408: INFO/SpawnPoolWorker-16] child process 25816 calling self.run()
[2021-06-15 04:53:29,540: INFO/MainProcess] Received task: app.tasks.hello[86b6c266-31cb-44de-953e-fa4811609e5b]
[2021-06-15 04:53:30,248: INFO/SpawnPoolWorker-17] child process 11800 calling self.run()
2021-06-15 04:53:30,839 DEBUG Using selector: SelectSelector
2021-06-15 04:53:30,843 DEBUG Using selector: SelectSelector
2021-06-15 04:53:31,699 DEBUG Using selector: SelectSelector
2021-06-15 04:53:32,576 DEBUG Using selector: SelectSelector
[2021-06-15 04:53:33,550: INFO/MainProcess] Received task: app.tasks.hello[c01c7f06-8565-429c-abd1-cf7c05428c29]
[2021-06-15 04:53:34,225: INFO/SpawnPoolWorker-18] child process 11072 calling self.run()
[2021-06-15 04:53:34,354: INFO/MainProcess] Received task: app.tasks.hello[4c094e6d-9fd3-4fb4-a3d8-d11b9baa621c]
[2021-06-15 04:53:34,996: INFO/SpawnPoolWorker-19] child process 5456 calling self.run()
2021-06-15 04:53:36,221 DEBUG Using selector: SelectSelector
2021-06-15 04:53:37,051 DEBUG Using selector: SelectSelector
[2021-06-15 04:53:38,364: INFO/MainProcess] Received task: app.tasks.hello[69fbd25e-c919-4362-952f-ed2765ac2e44]
[2021-06-15 04:53:38,995: INFO/SpawnPoolWorker-20] child process 20572 calling self.run()
[2021-06-15 04:53:39,169: INFO/MainProcess] Received task: app.tasks.hello[4eae752d-2ea3-47eb-8622-3e17fbcd5299]
[2021-06-15 04:53:39,824: INFO/SpawnPoolWorker-21] child process 432 calling self.run()
2021-06-15 04:53:41,048 DEBUG Using selector: SelectSelector
2021-06-15 04:53:41,893 DEBUG Using selector: SelectSelector
[2021-06-15 04:53:43,177: INFO/MainProcess] Received task: app.tasks.hello[4bfcde57-3cc9-44a7-931b-472e74e5c966]
[2021-06-15 04:53:43,972: INFO/SpawnPoolWorker-22] child process 17924 calling self.run()
2021-06-15 04:53:45,861 DEBUG Using selector: SelectSelector
[2021-06-15 04:53:47,986: INFO/MainProcess] Received task: app.tasks.hello[188024b4-1103-4ce4-8d5b-2a243ab11169]
[2021-06-15 04:53:48,761: INFO/SpawnPoolWorker-23] child process 18924 calling self.run()
2021-06-15 04:53:50,700 DEBUG Using selector: SelectSelector
[2021-06-15 04:53:52,793: INFO/MainProcess] Received task: app.tasks.hello[f597c138-330c-40a4-849a-928df8fda6f4]
[2021-06-15 04:53:53,372: INFO/SpawnPoolWorker-24] child process 27028 calling self.run()
2021-06-15 04:53:55,117 DEBUG Using selector: SelectSelector

unclarified issue

1OK: I have checked the log that says it was sent from beat.

2OK :The wrong task has registered the result.

?1 :Is redis receiving the data properly?

?2&3 :Is the redis distributing the data properly?

?4 :Why is the task not executed by the worker?

2

Answers


  1. Chosen as BEST ANSWER

    celery -A project worker --loglevel=INFO --without-gossip --without-mingle --without-heartbeat -Ofair --pool=solo

    Source: https://github.com/QuickRelease/django-tenants-celery-beat#developer-setup


  2. Add the –pool=solo after the code to start the celery worker server

    celery -A tasks worker –loglevel=INFO –pool=solo

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search