django可重用的应用程序,使用芹菜检查命令通过django rest框架监视工人/任务
django-celery-inspect的Python项目详细描述
#Django Celery Inspect
Django可重用应用程序,使用Celery Inspect命令通过[Django Rest框架](https://github.com/tomchristie/django Rest框架)监视工作人员。
而不是使用芹菜自己的[检查api]
(http://docs.celleryproject.org/en/latest/userguide/workers.html检查工人)。
安装:
pip安装django芹菜检查
2.将“Celery_Inspect”添加到您的已安装_应用程序设置中,如下所示:
installed_Apps=[
…
“Celery_Inspect”,
]
3。在url.py中添加以下内容:
url(r'^api/v1/celeriy inspect/',include('celeriry_inspect.url',namespace='celeriry_inspect'),
4。如果您希望使用drf的身份验证来保护这些终结点(可选)。
“默认身份验证类”:(
“rest\u framework.authentication.tokenauthentication”,
“默认权限类”:(
“rest\u framework.permission s.isauthenticated”,
),
}
用法:
1。http://localhost:8000/api/v1/celeriy inspect/ping/
{
“worker2@localhost:8000”:{
“ok”:“pong”
},
“worker1@localhost:8000”:{
“ok”:“pong”
}
}
2。http://localhost:8000/api/v1/celeriy inspect/active/
{
“worker2@localhost:8000”:[],
“worker1@localhost:8000”:[]
}
3.http://localhost:8000/api/v1/celeriy inspect/registered/
{
“worker2@localhost:8000”:[
“core.tasks.db廑backup”,
“core.tasks.send廑u queued廑email”,
“yy.tasks.assign廑to廑mongo”,
“xx.tasks.check廑u new registered”,
“xx.tasks.create_and_associate_manager”、
“qq.celeriy.debug_task”
]、
“worker1@localhost:8000”:[
“core.tasks.db_backup”、
“core.tasks.send_queued_email”、
“yy.tasks.assign_to_mongo”,
“xx.tasks.check_for_new_registered”、
“xx.tasks.create_and_associate_manager”、
“qq.celeriy.debug_task”
]
}
4。http://localhost:8000/api/v1/cellery-inspect/scheduled/
{
“worker2@localhost:8000”:[],
“worker1@localhost:8000”:[]
}
http://localhost:8000/api/v1/celeriy inspect/active status/
-如果WorkerState中的所有工人都在上,则返回200;如果工人在下,则返回404(WorkerState!=然后检查())。
-如果未安装django芹菜,则返回501。
Django可重用应用程序,使用Celery Inspect命令通过[Django Rest框架](https://github.com/tomchristie/django Rest框架)监视工作人员。
而不是使用芹菜自己的[检查api]
(http://docs.celleryproject.org/en/latest/userguide/workers.html检查工人)。
安装:
pip安装django芹菜检查
2.将“Celery_Inspect”添加到您的已安装_应用程序设置中,如下所示:
installed_Apps=[
…
“Celery_Inspect”,
]
3。在url.py中添加以下内容:
url(r'^api/v1/celeriy inspect/',include('celeriry_inspect.url',namespace='celeriry_inspect'),
4。如果您希望使用drf的身份验证来保护这些终结点(可选)。
“rest\u framework.authentication.tokenauthentication”,
“默认权限类”:(
“rest\u framework.permission s.isauthenticated”,
),
}
用法:
1。http://localhost:8000/api/v1/celeriy inspect/ping/
{
“worker2@localhost:8000”:{
“ok”:“pong”
},
“worker1@localhost:8000”:{
“ok”:“pong”
}
}
2。http://localhost:8000/api/v1/celeriy inspect/active/
{
“worker2@localhost:8000”:[],
“worker1@localhost:8000”:[]
}
3.http://localhost:8000/api/v1/celeriy inspect/registered/
{
“worker2@localhost:8000”:[
“core.tasks.db廑backup”,
“core.tasks.send廑u queued廑email”,
“yy.tasks.assign廑to廑mongo”,
“xx.tasks.check廑u new registered”,
“xx.tasks.create_and_associate_manager”、
“qq.celeriy.debug_task”
]、
“worker1@localhost:8000”:[
“core.tasks.db_backup”、
“core.tasks.send_queued_email”、
“yy.tasks.assign_to_mongo”,
“xx.tasks.check_for_new_registered”、
“xx.tasks.create_and_associate_manager”、
“qq.celeriy.debug_task”
]
}
4。http://localhost:8000/api/v1/cellery-inspect/scheduled/
{
“worker2@localhost:8000”:[],
“worker1@localhost:8000”:[]
}
http://localhost:8000/api/v1/celeriy inspect/active status/
-如果WorkerState中的所有工人都在上,则返回200;如果工人在下,则返回404(WorkerState!=然后检查())。
-如果未安装django芹菜,则返回501。