Skip to content

[Bug]: format_task not used #6912

@quertenmont

Description

@quertenmont

Describe the bug

Hello,

I am trying to use the format_task option by defining a flowerconfig.py as follow:

SENSITIVE_KEYS = {"secret", "password"}
REDACTED = "***"


def format_task(task):
    """Redact encryption keys from task kwargs displayed in the Flower UI."""
    kwargs = task.get("kwargs")
    print("debug format_task kwargs:", kwargs)  # Debug print to check kwargs content
    if kwargs and isinstance(kwargs, dict):
        for key in SENSITIVE_KEYS:
            if key in kwargs:
                kwargs[key] = REDACTED

    print("debug format_task redacted kwargs:", kwargs)  # Debug print to check redacted kwargs
    return task

but this seems to have no effect at all, I don't even see the printout when looking at the logs of my flower container.

I am starting flower like this (in case it may have any impact):
celery -A project flower --address=0.0.0.0 --port=5555 --logging=debug --url_prefix=flower
I also tried by adding the --conf argument in the command line (which in principle is not needed, as the flower config is in the current directory). But this has no impact neither

What am I missing ?

Thanks in avdance
Loic

Steps/Code to Reproduce

everything is in the description

Expected Results

I should not see the secrets anymore in the task kwargs of the flower UI.

Actual Results

still see the secrets

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions