CINXE.COM

Python dash - thread safe - Dash Python - Plotly Community Forum

<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Python dash - thread safe - Dash Python - Plotly Community Forum</title> <meta name="description" content="Hi, in my app i have very big dcc.store that stored a global data for the app and meny callback are using and update this store data and sometimes its seemed that some of the callback work in parllel and then the dcc &amp;hellip;"> <meta name="generator" content="Discourse 3.4.0.beta3-dev - https://github.com/discourse/discourse version 5bf5d1335680f28a8eb65c488353be9585eed08e"> <link rel="icon" type="image/png" href="https://global.discourse-cdn.com/flex020/uploads/plot/optimized/3X/4/d/4dad2bfe3c0428d932d3f58ebd2bafcfd94a60cd_2_32x32.svg"> <link rel="apple-touch-icon" type="image/png" href="https://global.discourse-cdn.com/flex020/uploads/plot/optimized/3X/d/6/d6d946d2566c8b2e332e5055af69eb7b46655cd5_2_180x180.png"> <meta name="theme-color" media="(prefers-color-scheme: light)" content="#ffffff"> <meta name="theme-color" media="(prefers-color-scheme: dark)" content="#111111"> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, user-scalable=yes, viewport-fit=cover"> <link rel="canonical" href="https://community.plotly.com/t/python-dash-thread-safe/88868" /> <link rel="search" type="application/opensearchdescription+xml" href="https://community.plotly.com/opensearch.xml" title="Plotly Community Forum Search"> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/color_definitions_plotly-light_10_4_ed51aabd2824c3f8f779fda1ebf4b2ebee9613fc.css?__ws=community.plotly.com" media="all" rel="stylesheet" class="light-scheme"/><link href="https://sea2.discourse-cdn.com/flex020/stylesheets/color_definitions_dark_14_4_e29a032d68ec3156f229eaab4e6ad886f2cc1397.css?__ws=community.plotly.com" media="(prefers-color-scheme: dark)" rel="stylesheet" class="dark-scheme"/> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/desktop_47dec152524498242f46f43a1c47a275d2f970f9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="desktop" /> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/automation_47dec152524498242f46f43a1c47a275d2f970f9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="automation" /> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/chat_47dec152524498242f46f43a1c47a275d2f970f9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="chat" /> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/checklist_47dec152524498242f46f43a1c47a275d2f970f9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="checklist" /> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/discourse-adplugin_47dec152524498242f46f43a1c47a275d2f970f9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="discourse-adplugin" /> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/discourse-ai_47dec152524498242f46f43a1c47a275d2f970f9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="discourse-ai" /> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/discourse-akismet_47dec152524498242f46f43a1c47a275d2f970f9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="discourse-akismet" /> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/discourse-cakeday_47dec152524498242f46f43a1c47a275d2f970f9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="discourse-cakeday" /> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/discourse-data-explorer_47dec152524498242f46f43a1c47a275d2f970f9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="discourse-data-explorer" /> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/discourse-details_47dec152524498242f46f43a1c47a275d2f970f9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="discourse-details" /> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/discourse-lazy-videos_47dec152524498242f46f43a1c47a275d2f970f9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="discourse-lazy-videos" /> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/discourse-local-dates_47dec152524498242f46f43a1c47a275d2f970f9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="discourse-local-dates" /> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/discourse-math_47dec152524498242f46f43a1c47a275d2f970f9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="discourse-math" /> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/discourse-narrative-bot_47dec152524498242f46f43a1c47a275d2f970f9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="discourse-narrative-bot" /> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/discourse-policy_47dec152524498242f46f43a1c47a275d2f970f9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="discourse-policy" /> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/discourse-presence_47dec152524498242f46f43a1c47a275d2f970f9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="discourse-presence" /> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/discourse-reactions_47dec152524498242f46f43a1c47a275d2f970f9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="discourse-reactions" /> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/discourse-solved_47dec152524498242f46f43a1c47a275d2f970f9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="discourse-solved" /> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/discourse-templates_47dec152524498242f46f43a1c47a275d2f970f9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="discourse-templates" /> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/discourse-topic-voting_47dec152524498242f46f43a1c47a275d2f970f9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="discourse-topic-voting" /> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/footnote_47dec152524498242f46f43a1c47a275d2f970f9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="footnote" /> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/hosted-site_47dec152524498242f46f43a1c47a275d2f970f9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="hosted-site" /> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/poll_47dec152524498242f46f43a1c47a275d2f970f9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="poll" /> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/spoiler-alert_47dec152524498242f46f43a1c47a275d2f970f9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="spoiler-alert" /> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/chat_desktop_47dec152524498242f46f43a1c47a275d2f970f9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="chat_desktop" /> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/discourse-ai_desktop_47dec152524498242f46f43a1c47a275d2f970f9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="discourse-ai_desktop" /> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/discourse-reactions_desktop_47dec152524498242f46f43a1c47a275d2f970f9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="discourse-reactions_desktop" /> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/discourse-topic-voting_desktop_47dec152524498242f46f43a1c47a275d2f970f9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="discourse-topic-voting_desktop" /> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/poll_desktop_47dec152524498242f46f43a1c47a275d2f970f9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="poll_desktop" /> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/desktop_theme_5_f927249a7c02a50c3223b11919ccb9ea3b39ce2a.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="desktop_theme" data-theme-id="5" data-theme-name="custom header links"/> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/desktop_theme_7_4925797c764adbd5dd8363a285745c3051d0a4a9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="desktop_theme" data-theme-id="7" data-theme-name="discourse-tag-sidebars"/> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/desktop_theme_2_630fdc021cb0c5a1589bca4d6d38dae9b0029bdb.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="desktop_theme" data-theme-id="2" data-theme-name="base style"/> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/desktop_theme_3_361d96c2f8504ddf8b8322d2556d0217786ba1a9.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="desktop_theme" data-theme-id="3" data-theme-name="header links"/> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/desktop_theme_6_744e2a3cace5055fb7c4204d46ce8f3be8e28234.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="desktop_theme" data-theme-id="6" data-theme-name="house ads"/> <link href="https://sea2.discourse-cdn.com/flex020/stylesheets/desktop_theme_4_0e51ac85ae7cfd25d72cfded9a179481b9897600.css?__ws=community.plotly.com" media="all" rel="stylesheet" data-target="desktop_theme" data-theme-id="4" data-theme-name="plotly light"/> <script defer="" src="https://sea2.discourse-cdn.com/flex020/theme-javascripts/e0be0f227c4f7f52cdffda4c89899b164037dc16.js?__ws=community.plotly.com" data-theme-id="4" nonce="QP0EjKqILYKgFoCoNLtaAbK47"></script> <!-- Global site tag (gtag.js) - AdWords: 1009791370 --> <script async="" src="https://www.googletagmanager.com/gtag/js?id=AW-1009791370" nonce="QP0EjKqILYKgFoCoNLtaAbK47"></script> <script defer="" src="https://sea2.discourse-cdn.com/flex020/theme-javascripts/0c2e38f62f793a5051d0d14872c9bf34469a6aa3.js?__ws=community.plotly.com" data-theme-id="3" nonce="QP0EjKqILYKgFoCoNLtaAbK47"></script> <script defer="" src="https://sea2.discourse-cdn.com/flex020/theme-javascripts/d94ac2bc7117e2106ded661606dbd9691e2ffe88.js?__ws=community.plotly.com" data-theme-id="8" nonce="QP0EjKqILYKgFoCoNLtaAbK47"></script> <link rel="alternate nofollow" type="application/rss+xml" title="RSS feed of &#39;Python dash - thread safe&#39;" href="https://community.plotly.com/t/python-dash-thread-safe/88868.rss" /> <meta property="og:site_name" content="Plotly Community Forum" /> <meta property="og:type" content="website" /> <meta name="twitter:card" content="summary_large_image" /> <meta name="twitter:image" content="https://global.discourse-cdn.com/flex020/uploads/plot/original/3X/e/d/edee92f62a7850759331e74e8f18bd2f7e9c26f2.jpeg" /> <meta property="og:image" content="https://global.discourse-cdn.com/flex020/uploads/plot/original/3X/e/d/edee92f62a7850759331e74e8f18bd2f7e9c26f2.jpeg" /> <meta property="og:url" content="https://community.plotly.com/t/python-dash-thread-safe/88868" /> <meta name="twitter:url" content="https://community.plotly.com/t/python-dash-thread-safe/88868" /> <meta property="og:title" content="Python dash - thread safe" /> <meta name="twitter:title" content="Python dash - thread safe" /> <meta property="og:description" content="Hi, in my app i have very big dcc.store that stored a global data for the app and meny callback are using and update this store data and sometimes its seemed that some of the callback work in parllel and then the dcc store get None value somehow. and its cause me many problem. do you have any solution? maybe a way to prevent a callback to run while another callback doesnt finish? thank you!!" /> <meta name="twitter:description" content="Hi, in my app i have very big dcc.store that stored a global data for the app and meny callback are using and update this store data and sometimes its seemed that some of the callback work in parllel and then the dcc store get None value somehow. and its cause me many problem. do you have any solution? maybe a way to prevent a callback to run while another callback doesnt finish? thank you!!" /> <meta property="og:article:section" content="Dash Python" /> <meta property="og:article:section:color" content="0E76BD" /> <meta property="og:article:tag" content="question" /> <meta property="article:published_time" content="2024-11-21T07:04:30+00:00" /> <meta property="og:ignore_canonical" content="true" /> <script type="application/ld+json">{"@context":"http://schema.org","@type":"QAPage","name":"Python dash - thread safe","mainEntity":{"@type":"Question","name":"Python dash - thread safe","text":"Hi,\n\nin my app i have very big dcc.store that stored a global data for the app\n\nand meny callback are using and update this store data\n\nand sometimes its seemed that some of the callback work in parllel and then the dcc store get None value somehow.\n\nand its cause me many problem.\n\ndo you have any s&hellip;","upvoteCount":0,"answerCount":0,"datePublished":"2024-11-21T07:04:30.925Z","author":{"@type":"Person","name":"leah","url":"https://community.plotly.com/u/leah"}}}</script> </head> <body class="crawler browser-update"> <div id="custom-banner-webinar"> ✨ Practice building amazing Plotly Dash apps: <a href="https://community.plotly.com/t/holiday-season-app-challenge-nyc-mta/88389" target="_blank">Join the app-building challenge!</a> </div> <script defer="" src="https://sea2.discourse-cdn.com/flex020/theme-javascripts/b891fd37ba759b491111807dba3f7eb4fc402381.js?__ws=community.plotly.com" data-theme-id="7" nonce="QP0EjKqILYKgFoCoNLtaAbK47"></script> <header> <a href="/"> Plotly Community Forum </a> </header> <div id="main-outlet" class="wrap" role="main"> <div id="topic-title"> <h1> <a href="/t/python-dash-thread-safe/88868">Python dash - thread safe</a> </h1> <div class="topic-category" itemscope itemtype="http://schema.org/BreadcrumbList"> <span itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"> <a href="/c/python/25" class="badge-wrapper bullet" itemprop="item"> <span class='badge-category-bg' style='background-color: #0E76BD'></span> <span class='badge-category clear-badge'> <span class='category-name' itemprop='name'>Dash Python</span> </span> </a> <meta itemprop="position" content="1" /> </span> </div> <div class="topic-category"> <div class='discourse-tags list-tags'> <a href='https://community.plotly.com/tag/question' class='discourse-tag' rel="tag">question</a> </div> </div> </div> <div itemscope itemtype='http://schema.org/DiscussionForumPosting'> <meta itemprop='headline' content='Python dash - thread safe'> <link itemprop='url' href='https://community.plotly.com/t/python-dash-thread-safe/88868'> <meta itemprop='datePublished' content='2024-11-21T07:04:30Z'> <meta itemprop='articleSection' content='Dash Python'> <meta itemprop='keywords' content='question'> <div itemprop='publisher' itemscope itemtype="http://schema.org/Organization"> <meta itemprop='name' content='Plotly'> <div itemprop='logo' itemscope itemtype="http://schema.org/ImageObject"> <meta itemprop='url' content='https://global.discourse-cdn.com/flex020/uploads/plot/original/3X/f/3/f3da33405ee7e693abfd12bd4ae334a55e8345d0.png'> </div> </div> <div id='post_1' class='topic-body crawler-post'> <div class='crawler-post-meta'> <span class="creator" itemprop="author" itemscope itemtype="http://schema.org/Person"> <a itemprop="url" href='https://community.plotly.com/u/leah'><span itemprop='name'>leah</span></a> </span> <link itemprop="mainEntityOfPage" href="https://community.plotly.com/t/python-dash-thread-safe/88868"> <span class="crawler-post-infos"> <time datetime='2024-11-21T07:04:30Z' class='post-time'> November 21, 2024, 7:04am </time> <meta itemprop='dateModified' content='2024-11-21T07:04:30Z'> <span itemprop='position'>1</span> </span> </div> <div class='post' itemprop='text'> <p>Hi,<br> in my app i have very big dcc.store that stored a global data for the app<br> and meny callback are using and update this store data<br> and sometimes its seemed that some of the callback work in parllel and then the dcc store get None value somehow.<br> and its cause me many problem.<br> do you have any solution?<br> maybe a way to prevent a callback to run while another callback doesnt finish?<br> thank you!!</p> </div> <div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter"> <meta itemprop="interactionType" content="http://schema.org/LikeAction"/> <meta itemprop="userInteractionCount" content="0" /> <span class='post-likes'></span> </div> </div> <div id='post_3' itemprop='comment' itemscope itemtype='http://schema.org/Comment' class='topic-body crawler-post'> <div class='crawler-post-meta'> <span class="creator" itemprop="author" itemscope itemtype="http://schema.org/Person"> <a itemprop="url" href='https://community.plotly.com/u/leah'><span itemprop='name'>leah</span></a> </span> <span class="crawler-post-infos"> <time itemprop='datePublished' datetime='2024-11-23T19:54:01Z' class='post-time'> November 23, 2024, 7:54pm </time> <meta itemprop='dateModified' content='2024-11-23T19:54:01Z'> <span itemprop='position'>3</span> </span> </div> <div class='post' itemprop='text'> <p>thank you<br> if i am using lock,<br> and i change the lock value inside the callback, it is changed also without return it in output?</p> </div> <div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter"> <meta itemprop="interactionType" content="http://schema.org/LikeAction"/> <meta itemprop="userInteractionCount" content="0" /> <span class='post-likes'></span> </div> </div> <div id='post_4' itemprop='comment' itemscope itemtype='http://schema.org/Comment' class='topic-body crawler-post'> <div class='crawler-post-meta'> <span class="creator" itemprop="author" itemscope itemtype="http://schema.org/Person"> <a itemprop="url" href='https://community.plotly.com/u/leah'><span itemprop='name'>leah</span></a> </span> <span class="crawler-post-infos"> <time itemprop='datePublished' datetime='2024-11-26T07:36:14Z' class='post-time'> November 26, 2024, 7:36am </time> <meta itemprop='dateModified' content='2024-11-26T07:36:14Z'> <span itemprop='position'>4</span> </span> </div> <div class='post' itemprop='text'> <p>Do you have an answer for me?</p> </div> <div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter"> <meta itemprop="interactionType" content="http://schema.org/LikeAction"/> <meta itemprop="userInteractionCount" content="0" /> <span class='post-likes'></span> </div> </div> <div id='post_5' itemprop='comment' itemscope itemtype='http://schema.org/Comment' class='topic-body crawler-post'> <div class='crawler-post-meta'> <span class="creator" itemprop="author" itemscope itemtype="http://schema.org/Person"> <a itemprop="url" href='https://community.plotly.com/u/AIMPED'><span itemprop='name'>AIMPED</span></a> </span> <span class="crawler-post-infos"> <time itemprop='datePublished' datetime='2024-11-26T08:00:19Z' class='post-time'> November 26, 2024, 8:00am </time> <meta itemprop='dateModified' content='2024-11-26T08:00:19Z'> <span itemprop='position'>5</span> </span> </div> <div class='post' itemprop='text'> <p>I’m afraid the main purpose of the answer was adding a SPAM link.</p> </div> <div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter"> <meta itemprop="interactionType" content="http://schema.org/LikeAction"/> <meta itemprop="userInteractionCount" content="0" /> <span class='post-likes'></span> </div> </div> <div id='post_6' itemprop='comment' itemscope itemtype='http://schema.org/Comment' class='topic-body crawler-post'> <div class='crawler-post-meta'> <span class="creator" itemprop="author" itemscope itemtype="http://schema.org/Person"> <a itemprop="url" href='https://community.plotly.com/u/davidharris'><span itemprop='name'>davidharris</span></a> </span> <span class="crawler-post-infos"> <time itemprop='datePublished' datetime='2024-11-26T10:02:54Z' class='post-time'> November 26, 2024, 10:02am </time> <meta itemprop='dateModified' content='2024-11-26T10:02:54Z'> <span itemprop='position'>6</span> </span> </div> <div class='post' itemprop='text'> <p>I regret my approach is always to design apps to ensure this kind of parallelism (two callbacks running in parallel updating the same store) can’t happen.</p> <p>And I’ve come to believe, rightly or wrongly, that it has to be done this way. dcc.Store() doesn’t have the kind of support for parallel updates as, say a relational database does.</p> <p>I don’t know if the locking approach suggested above can be made to work reliably, but my gut feel says probably not. If anyone does use it successfully though it would be interesting to hear from them.</p> </div> <div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter"> <meta itemprop="interactionType" content="http://schema.org/LikeAction"/> <meta itemprop="userInteractionCount" content="0" /> <span class='post-likes'></span> </div> </div> <div id='post_7' itemprop='comment' itemscope itemtype='http://schema.org/Comment' class='topic-body crawler-post'> <div class='crawler-post-meta'> <span class="creator" itemprop="author" itemscope itemtype="http://schema.org/Person"> <a itemprop="url" href='https://community.plotly.com/u/leah'><span itemprop='name'>leah</span></a> </span> <span class="crawler-post-infos"> <time itemprop='datePublished' datetime='2024-11-26T10:14:58Z' class='post-time'> November 26, 2024, 10:14am </time> <meta itemprop='dateModified' content='2024-11-26T10:14:58Z'> <span itemprop='position'>7</span> </span> </div> <div class='post' itemprop='text'> <p>so what do you suggest to use instead of dcc.store?</p> </div> <div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter"> <meta itemprop="interactionType" content="http://schema.org/LikeAction"/> <meta itemprop="userInteractionCount" content="0" /> <span class='post-likes'></span> </div> </div> <div id='post_8' itemprop='comment' itemscope itemtype='http://schema.org/Comment' class='topic-body crawler-post'> <div class='crawler-post-meta'> <span class="creator" itemprop="author" itemscope itemtype="http://schema.org/Person"> <a itemprop="url" href='https://community.plotly.com/u/davidharris'><span itemprop='name'>davidharris</span></a> </span> <span class="crawler-post-infos"> <time itemprop='datePublished' datetime='2024-11-26T10:29:37Z' class='post-time'> November 26, 2024, 10:29am </time> <meta itemprop='dateModified' content='2024-11-26T10:29:37Z'> <span itemprop='position'>8</span> </span> </div> <div class='post' itemprop='text'> <p>I’m not suggesting you don’t use dcc.Store(), but maybe not one single large dcc.Store holding all global data?</p> <p>You may be able to avoid parallel updates to a store by some combination of</p> <ul> <li>splitting the one Store() into several</li> <li>tracking what sequence callbacks are triggered in, and changing what triggers them</li> <li>combining multiple callbacks that currently run in parallel into a single callback</li> </ul> <p>I should add I’m not anything like 100% sure this is the right approach for you, without being able to see more detail of what you’re doing. And if the app is big and complex it could also be a lot of work.</p> </div> <div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter"> <meta itemprop="interactionType" content="http://schema.org/LikeAction"/> <meta itemprop="userInteractionCount" content="0" /> <span class='post-likes'></span> </div> </div> <div id='post_9' itemprop='comment' itemscope itemtype='http://schema.org/Comment' class='topic-body crawler-post'> <div class='crawler-post-meta'> <span class="creator" itemprop="author" itemscope itemtype="http://schema.org/Person"> <a itemprop="url" href='https://community.plotly.com/u/leah'><span itemprop='name'>leah</span></a> </span> <span class="crawler-post-infos"> <time itemprop='datePublished' datetime='2024-11-26T10:39:04Z' class='post-time'> November 26, 2024, 10:39am </time> <meta itemprop='dateModified' content='2024-11-26T10:39:04Z'> <span itemprop='position'>9</span> </span> </div> <div class='post' itemprop='text'> <p>I have a lot of data in the dcc store and it can be a lot of work as you said<br> so maybe do you have any solution to prevent it without changing current design?</p> </div> <div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter"> <meta itemprop="interactionType" content="http://schema.org/LikeAction"/> <meta itemprop="userInteractionCount" content="0" /> <span class='post-likes'></span> </div> </div> <div id='post_10' itemprop='comment' itemscope itemtype='http://schema.org/Comment' class='topic-body crawler-post'> <div class='crawler-post-meta'> <span class="creator" itemprop="author" itemscope itemtype="http://schema.org/Person"> <a itemprop="url" href='https://community.plotly.com/u/davidharris'><span itemprop='name'>davidharris</span></a> </span> <span class="crawler-post-infos"> <time itemprop='datePublished' datetime='2024-11-26T10:59:53Z' class='post-time'> November 26, 2024, 10:59am </time> <meta itemprop='dateModified' content='2024-11-26T10:59:53Z'> <span itemprop='position'>10</span> </span> </div> <div class='post' itemprop='text'> <p>In as much as the cause of the parallelism is two callbacks having the same trigger, it’s always possible to make them run sequentially by changing, say:</p> <pre data-code-wrap="python"><code class="lang-python">@app.callback( ..., #outputs Input("button1","n_clicks"), ... # other inputs ) def callback1(nclicks, ...): ... @app.callback( ..., # outputs Input("button1","n_clicks"), ... # other inputs ) def callback2(nclicks, ...): ... </code></pre> <p>by adding a dcc.Store(id=‘store-trigger1’) and doing something like:</p> <pre data-code-wrap="python"><code class="lang-python">@app.callback( Output('store-trigger1', 'data'), ..., # other outputs Input("button1","n_clicks"), ... # other inputs ) def callback1(nclicks, ...): ... return nclicks, ... @app.callback( ..., #outputs Input('store-trigger1','data', State("button1","n_clicks"), ... # other inputs ) def callback2(_, nclicks,...): ... </code></pre> <p>That <em>might</em> be a relatively low-effort approach to cutting down parallelism, but with the same warning as before, I’m nothing like 100% sure this actually will solve your problems.</p> </div> <div itemprop="interactionStatistic" itemscope itemtype="http://schema.org/InteractionCounter"> <meta itemprop="interactionType" content="http://schema.org/LikeAction"/> <meta itemprop="userInteractionCount" content="0" /> <span class='post-likes'></span> </div> </div> </div> <div id="related-topics" class="more-topics__list " role="complementary" aria-labelledby="related-topics-title"> <h3 id="related-topics-title" class="more-topics__list-title"> Related topics </h3> <div class="topic-list-container" itemscope itemtype='http://schema.org/ItemList'> <meta itemprop='itemListOrder' content='http://schema.org/ItemListOrderDescending'> <table class='topic-list'> <thead> <tr> <th>Topic</th> <th></th> <th class="replies">Replies</th> <th class="views">Views</th> <th>Activity</th> </tr> </thead> <tbody> <tr class="topic-list-item" id="topic-list-item-79533"> <td class="main-link" itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'> <meta itemprop='position' content='1'> <span class="link-top-line"> <a itemprop='url' href='https://community.plotly.com/t/best-approach-for-parallel-updates-to-dcc-store-component/79533' class='title raw-link raw-topic-link'>Best approach for parallel updates to dcc.Store component?</a> </span> <div class="link-bottom-line"> <a href='/c/python/25' class='badge-wrapper bullet'> <span class='badge-category-bg' style='background-color: #0E76BD'></span> <span class='badge-category clear-badge'> <span class='category-name'>Dash Python</span> </span> </a> <div class="discourse-tags"> <a href='https://community.plotly.com/tag/question' class='discourse-tag'>question</a> </div> </div> </td> <td class="replies"> <span class='posts' title='posts'>0</span> </td> <td class="views"> <span class='views' title='views'>207</span> </td> <td> October 22, 2023 </td> </tr> <tr class="topic-list-item" id="topic-list-item-69966"> <td class="main-link" itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'> <meta itemprop='position' content='2'> <span class="link-top-line"> <a itemprop='url' href='https://community.plotly.com/t/dcc-store-query/69966' class='title raw-link raw-topic-link'>dcc.Store query</a> </span> <div class="link-bottom-line"> <a href='/c/python/25' class='badge-wrapper bullet'> <span class='badge-category-bg' style='background-color: #0E76BD'></span> <span class='badge-category clear-badge'> <span class='category-name'>Dash Python</span> </span> </a> <div class="discourse-tags"> <a href='https://community.plotly.com/tag/question' class='discourse-tag'>question</a> </div> </div> </td> <td class="replies"> <span class='posts' title='posts'>3</span> </td> <td class="views"> <span class='views' title='views'>619</span> </td> <td> November 16, 2022 </td> </tr> <tr class="topic-list-item" id="topic-list-item-19852"> <td class="main-link" itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'> <meta itemprop='position' content='3'> <span class="link-top-line"> <a itemprop='url' href='https://community.plotly.com/t/bug-dcc-store-component-interferes-with-dcc-interval-update/19852' class='title raw-link raw-topic-link'>Bug: dcc.Store component interferes with dcc.Interval update</a> </span> <div class="link-bottom-line"> <a href='/c/python/25' class='badge-wrapper bullet'> <span class='badge-category-bg' style='background-color: #0E76BD'></span> <span class='badge-category clear-badge'> <span class='category-name'>Dash Python</span> </span> </a> <div class="discourse-tags"> </div> </div> </td> <td class="replies"> <span class='posts' title='posts'>4</span> </td> <td class="views"> <span class='views' title='views'>1256</span> </td> <td> February 24, 2019 </td> </tr> <tr class="topic-list-item" id="topic-list-item-66298"> <td class="main-link" itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'> <meta itemprop='position' content='4'> <span class="link-top-line"> <a itemprop='url' href='https://community.plotly.com/t/callbacks-working-fine-in-windows-but-in-linux-callbacks-are-not-working-in-parallel-concurrently/66298' class='title raw-link raw-topic-link'>Callbacks working fine in windows but in Linux callbacks are not working in parallel/concurrently</a> </span> <div class="link-bottom-line"> <a href='/c/python/25' class='badge-wrapper bullet'> <span class='badge-category-bg' style='background-color: #0E76BD'></span> <span class='badge-category clear-badge'> <span class='category-name'>Dash Python</span> </span> </a> <div class="discourse-tags"> </div> </div> </td> <td class="replies"> <span class='posts' title='posts'>0</span> </td> <td class="views"> <span class='views' title='views'>289</span> </td> <td> July 21, 2022 </td> </tr> <tr class="topic-list-item" id="topic-list-item-32790"> <td class="main-link" itemprop='itemListElement' itemscope itemtype='http://schema.org/ListItem'> <meta itemprop='position' content='5'> <span class="link-top-line"> <a itemprop='url' href='https://community.plotly.com/t/dcc-store-data-not-saved-with-multiple-callbacks/32790' class='title raw-link raw-topic-link'>dcc.Store data not saved with multiple callbacks</a> </span> <div class="link-bottom-line"> <a href='/c/python/25' class='badge-wrapper bullet'> <span class='badge-category-bg' style='background-color: #0E76BD'></span> <span class='badge-category clear-badge'> <span class='category-name'>Dash Python</span> </span> </a> <div class="discourse-tags"> </div> </div> </td> <td class="replies"> <span class='posts' title='posts'>0</span> </td> <td class="views"> <span class='views' title='views'>378</span> </td> <td> December 19, 2019 </td> </tr> </tbody> </table> </div> </div> </div> <footer class="container wrap"> <nav class='crawler-nav'> <ul> <li itemscope itemtype='http://schema.org/SiteNavigationElement'> <span itemprop='name'> <a href='/' itemprop="url">Home </a> </span> </li> <li itemscope itemtype='http://schema.org/SiteNavigationElement'> <span itemprop='name'> <a href='/categories' itemprop="url">Categories </a> </span> </li> <li itemscope itemtype='http://schema.org/SiteNavigationElement'> <span itemprop='name'> <a href='/guidelines' itemprop="url">Guidelines </a> </span> </li> <li itemscope itemtype='http://schema.org/SiteNavigationElement'> <span itemprop='name'> <a href='/tos' itemprop="url">Terms of Service </a> </span> </li> <li itemscope itemtype='http://schema.org/SiteNavigationElement'> <span itemprop='name'> <a href='/privacy' itemprop="url">Privacy Policy </a> </span> </li> </ul> </nav> <p class='powered-by-link'>Powered by <a href="https://www.discourse.org">Discourse</a>, best viewed with JavaScript enabled</p> </footer> <div class="buorg"><div>Unfortunately, <a href="https://www.discourse.org/faq/#browser">your browser is unsupported</a>. Please <a href="https://browsehappy.com">switch to a supported browser</a> to view rich content, log in and reply.</div></div> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10