Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Signals user_preload_options docs refer to non-existent celery.bin.base.Option #10026

@dc-strahlkraft

Description

@dc-strahlkraft

Checklist

  • I have checked the issues list
    for similar or identical bug reports.
  • I have checked the pull requests list
    for existing proposed fixes.
  • I have checked the commit log
    to find out if the bug was already fixed in the main branch.
  • I have included all related issues and possible duplicate issues in this issue
    (If there are none, check this box anyway).

Related Issues and Possible Duplicates

Related Issues

  • None

Possible Duplicates

  • None

Description

https://docs.celeryq.dev/en/latest/userguide/signals.html#user-preload-options refers to celery.bin.base.Option which doesn't exist. There's CeleryOption, but that has a different API, the param_decls should be a sequence of str, not a plain str.

Suggestions

from celery import Celery
from celery import signals
from click import option

app = Celery()
app.user_options['preload'].add(option(
    '--monitoring', action='store_true',
    help='Enable our external monitoring utility, blahblah',
))

@signals.user_preload_options.connect
def handle_preload_options(options, **kwargs):
    if options['monitoring']:
        enable_monitoring()

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions