Skip to content

Stopping Rendering and Computations of Graphs - Issue with Periodically Checking for Cancellation Flags #52

@SudeepMangam

Description

@SudeepMangam

Description:
While computing a graph or table, there may be issues with the code or the input of the file. In order to let the user have full control, a stop button to immediately stop all computation can be enforced.

Requirements:
OS: Ubuntu via WSL on Windows 11
Python Version: 3.9.13 (Miniconda)
Project Directory: ~/root/summer2025/Cancel_Error
Conda Environment: spacy_viz_py3913_wsl
Launch Command: python -m shiny run --reload app:app
Dataset Used: Custom .h5ad file

Proposal:
In order to stop this, I offer this solution. I believe that a stop button should be added below the Run button. The implementation. I can create a input_action_button, introduce a cancel reactive flag in the respective server() functions of each tab, and set it to false. If clicked, the flag's value switches to true, stopping any computation or rendering. Then, I can check the flag periodically to see if the cancel flag is active. If it is, all computation is stopped.

Problems Encountered:
When the plot is rendering, it hogs the main thread, which means the app isn't reading any inputs until the graph is all done. While there is a built-in function that can check for the cancel button, there isn't one that can check periodically during the rendering, meaning that the cancel button input is only picked up before or after the rendering of the plot. The computation can't be overridden as well. So, unless an in-built function that checks for cancellation flags periodically is created, the ability to stop the rendering of graphs and computations can't logically be implemented.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions