当 Django 处理的请求中使用 .apply_async() 或 .delay() 时,Celery 任务挂起,但在



调用以下任务:

task__determine_order_details_processing_or_created_status.apply_async(
    args=[order_record.Order_ID], 
    eta=datetime.now(GMT_timezone)+timedelta(minutes=1)
)

最终在工作人员超时。看起来该方法永远不会释放工人继续其工作

web_1               | [2019-11-21 05:43:43 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:1559)
web_1               | [2019-11-21 05:43:43 +0000] [1559] [INFO] Worker exiting (pid: 1559)
web_1               | [2019-11-21 05:43:43 +0000] [1636] [INFO] Booting worker with pid: 1636

然而,使用 Django shell 调用的相同命令创建了一个完全工作的 celerty 任务:

celery_1            | [2019-11-21 05:47:06,500: INFO/MainProcess] Received task: task__determine_order_details_processing_or_created_status[f94708be-a0ab-4853-8785-a11c8c7ca9f1]  ETA:[2019-11-21 05:48:06.304924+00:00] 

docker-compose.yml:

  web:
    build: ./server
    command: gunicorn server.wsgi:application --reload --limit-request-line 16376 --bind 0.0.0.0:8001 
    volumes:
      - ./server:/usr/src
    expose:
      - 8001
    env_file: .env.dev
    links:
      - memcached
    depends_on:
      - db_development_2
      - redis
  db_development_2:
    restart: always
    image: postgres:latest
    volumes:
        - postgres_development3:/var/lib/postgresql/volume/
    env_file: .env.dev
    logging:
      driver: none
  redis:
    image: "redis:alpine"
    restart: always
    logging:
      driver: none
celery:
    build: ./server
    command: celery -A server.celery worker -l info
    env_file: .env.dev
    volumes:
      - ./server:/usr/src
    depends_on:
      - db_development_2
      - redis
    restart: always
  celery-beat:
    build: ./server
    command: celery -A server.celery beat -l info
    env_file: .env.dev
    volumes:
      - ./server:/usr/src
    depends_on:
      - db_development_2
      - redis
    restart: always
    logging:
      driver: none

你能分享更多细节吗?

错误来自古尼角兽吧?

您是否在 docker 环境中运行此功能?不同容器上的芹菜?

WSGI<-->YOUR_APP命令是什么样的?

例:

gunicorn app.wsgi:tour_application -w 6 -b :8000 --timeout 120

您可以尝试使用更多超时,例如上面的 120 吗?

相关内容

  • 没有找到相关文章

最新更新