Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there a way to use shadow_name as the result task name? #379

Open
marcio0 opened this issue Mar 29, 2023 · 0 comments
Open

Is there a way to use shadow_name as the result task name? #379

marcio0 opened this issue Mar 29, 2023 · 0 comments

Comments

@marcio0
Copy link

marcio0 commented Mar 29, 2023

I have a generic command to run any django management command by informing on args which command is to be run:

@app.task(name="run_management_command")
def run_management_command(command, *args, **kwargs):
    print(f"Running '{command}' with args='{args}' and kwargs='{kwargs}'")
    call_command(command, *args, **kwargs)

And on my schedule I set it up like this:

    "generate_reports": {
        "task": "run_management_command",
        "args": ("generate_reports",),
        # every day at 6pm
        "schedule": crontab(hour=18, minute=0),
        "options": {
            "shadow": "custom_name"
        },
    },

The "shadow" argument works for changing the name shown on the logs:

2023-03-29 18:32:15,729: INFO/ForkPoolWorker-4] Task custom_name[ea4bae5f-d482-4b01-90b0-7e6cc610bdc0] succeeded in 0.007948291007778607s: None

But on the task result it still shows as the actual task name:
image

Is there a way to make the task result respect the tasks's shadow name? I have tried other ways to configure it, but it's always ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant