Can background callback run with pattern matching ids?

I use background callback with Celery + Redis. In the example there is a running option to put in the components. The thing is I am using pattern matching ID’s.

Can we use background callbacks with pattern matching ID’s?

Here is my app.py

celery_app = Celery(__name__, broker=os.environ['REDIS_URL'], backend=os.environ['REDIS_URL'])
background_callback_manager = CeleryManager(celery_app)

app = DashProxy(
    __name__,
    background_callback_manager=background_callback_manager,
    suppress_callback_exceptions=True,
    server=server,
    transforms=[ServersideOutputTransform()],
)

and my callback

@callback(
    output=Output(cpg.PageOutputTargetAIO.ids.output_target(PageComponentIds.TEST_INSIGHTS.value), "children"),
    inputs=Input(cpg.PageOutputTargetAIO.ids.output_card_trigger(PageComponentIds.TEST_INSIGHTS.value), "n_clicks"),
    state=[
        State(f"{PageComponentIds.TEST_INSIGHTS.value}__preview_nodes_select", "value"),
        State(f"{PageComponentIds.TEST_INSIGHTS.value}__disable_hover_nodes_graph_checkbox", "checked"),
        State("inputs__test_case_dropdown", "value"),
        State("app_tab_settings__graph_output_size_store", "data"),
        State("app_tab_settings__plot_graph_options_store", "data")
    ],
    prevent_initial_call=True,
    background=True,
    running=[
        (Output(cpg.PageOutputTargetAIO.ids.output_card_trigger(PageComponentIds.TEST_INSIGHTS.value), "disabled"), True, False),
        (Output("cancel_button_id", "disabled"), False, True),
    ],
    cancel=[
        Input("cancel_button_id", "n_clicks")
    ],
)
def preview_nodes_on_button_click(
    button_click,
    graph_type,
    disable_hover,
    test_case_id,
    graph_output_size,
    graph_options
):
    res = internals.generate_graph_for_node_preview(
        graph_type,
        disable_hover,
        test_case_id,
        graph_output_size,
    )

    if isinstance(res, ApiError):
        return cpg.PageGraphOutputAIO(
            output_id=PageComponentIds.TEST_INSIGHTS.value,
            error_message=res.error
        )

    return cpg.PageGraphOutputAIO(
        output_id=PageComponentIds.TEST_INSIGHTS.value,
        figure=res.figure,
        figure_config=graph_options
    )

In console I get KeyError: 'long_callback_7a139a6953c0aefdd4bc9ac5314fe6b27ce6cf37'

Hello @milos5593,

I found that pattern-matching did not pass to background callbacks, but more specifically in the areas of cancel and running.

Also, this is slightly different but still the same as this is an AIO component. Same concept though. :grin: