Skip to content

Flask contexts not available inside background callback #2235

Closed
@ArtsiomAntropau

Description

Describe your context

dash                              2.6.1
dash-core-components              2.0.0
dash-html-components              2.0.0
dash-table                        5.0.0

Describe the bug

Background callbacks don't have flask's app and request contexts inside.

Expected behavior

Background callbacks have flask's app and request contexts inside.

So, after creating callback function and before providing them to the Celery, we should provide flask contexts inside this function to imitate the default callback behaviour

with flask_app.app_context():
    return (copy_current_request_context(job_fn) if has_request_context() else job_fn)(*args, **kwargs)

Any recommendations for now?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    P3backlogbugsomething broken

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions