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

Add long_callback decorator #1702

Merged
merged 35 commits into from
Aug 18, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
0c1a053
Add long_callback decorator
jonmmease Aug 7, 2021
5a004e7
Rework long_callback to avoid disabling interval until all requests a…
jonmmease Aug 11, 2021
f5dfd6b
Add long_callback tests
jonmmease Aug 11, 2021
0b10624
Have the diskcache long_callback manager rely on multiprocess on all …
jonmmease Aug 11, 2021
813fc00
long_callback docstring
jonmmease Aug 12, 2021
4ddecf2
Fix import
jonmmease Aug 12, 2021
1ac543e
flakes
jonmmease Aug 12, 2021
aa676bd
pylint
jonmmease Aug 12, 2021
5ff33cf
Python 3.6 compat
jonmmease Aug 12, 2021
1da38be
Refactor long calblack mangaers and tests
jonmmease Aug 14, 2021
02b36df
Add cache_args_to_skip option to long_callback
jonmmease Aug 14, 2021
a1b8a39
Add dual long_callback test
jonmmease Aug 14, 2021
5d64332
Add dual long_callback test
jonmmease Aug 14, 2021
d50f214
celery tests on circleci (take 1)
jonmmease Aug 14, 2021
809f5da
pylist fixes
jonmmease Aug 14, 2021
9ed1b81
pylist fixes
jonmmease Aug 14, 2021
f5eec9d
CI WIP
jonmmease Aug 14, 2021
f79bde3
CI WIP (2)
jonmmease Aug 14, 2021
cc82b59
Re-enable tests
jonmmease Aug 14, 2021
b92f89f
Support single list input argument
jonmmease Aug 16, 2021
e2bd875
Raise informative error when dependency to long_callback has pattern-…
jonmmease Aug 16, 2021
71227cd
Remove module string from celery task name hash
jonmmease Aug 16, 2021
41520e5
validate that celery app has result backend configured
jonmmease Aug 16, 2021
e5f967e
Test celery manager with multiple celery workers
jonmmease Aug 16, 2021
2405f11
Add long callback manager docstrings
jonmmease Aug 16, 2021
7e0f386
bump up test wait times
jonmmease Aug 16, 2021
4b7ec3c
Don't fail on NoSuchProcess exception
jonmmease Aug 16, 2021
5731edf
Don't fail on NoSuchProcess exception (2)
jonmmease Aug 16, 2021
c07fe63
Merge remote-tracking branch 'origin/dev' into long_callback
jonmmease Aug 16, 2021
56ad571
Add CHANGELOG entry
jonmmease Aug 16, 2021
3733909
Merge remote-tracking branch 'origin/dev' into long_callback
jonmmease Aug 16, 2021
9134207
Add extra components to validation_layout and fix prevent_initial_call
jonmmease Aug 17, 2021
e5d538d
Merge remote-tracking branch 'origin/dev' into long_callback
jonmmease Aug 17, 2021
92d7c04
Increase sleep time to allow final app state to settle
jonmmease Aug 17, 2021
3892ecb
Increase sleep time to allow final app state to settle
jonmmease Aug 18, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Have the diskcache long_callback manager rely on multiprocess on all …
…platforms
  • Loading branch information
jonmmease committed Aug 11, 2021
commit 0b106242a7944fdab4f7714448043657378a3530
42 changes: 17 additions & 25 deletions dash/long_callback/managers/diskcache_manager.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,30 @@
import platform
from . import BaseLongCallbackManager


class DiskcacheLongCallbackManager(BaseLongCallbackManager):
def __init__(self, cache, cache_by=None, expire=None):
import diskcache # pylint: disable=import-outside-toplevel

if not isinstance(cache, diskcache.Cache):
raise ValueError("First argument must be a diskcache.Cache object")
super().__init__(cache_by)

# Handle process class import
if platform.system() == "Windows":
try:
from multiprocess import ( # pylint: disable=import-outside-toplevel
Process,
)
except ImportError:
raise ImportError(
"""\
When running on Windows, the long_callback decorator requires the
multiprocess package which can be install using pip...
try:
import diskcache # pylint: disable=import-outside-toplevel
from multiprocess import ( # pylint: disable=import-outside-toplevel
Process,
)
except ImportError:
raise ImportError(
"""\
DiskcacheLongCallbackManager requires the multiprocess and diskcache packages which
can be installed using pip...

$ pip install multiprocess
$ pip install multiprocess diskcache

or conda.
or conda.

$ conda install -c conda-forge multiprocess\n"""
)
else:
from multiprocessing import ( # pylint: disable=import-outside-toplevel
Process,
$ conda install -c conda-forge multiprocess diskcache\n"""
)

if not isinstance(cache, diskcache.Cache):
raise ValueError("First argument must be a diskcache.Cache object")
super().__init__(cache_by)

self.Process = Process
self.cache = cache
self.callback_futures = dict()
Expand Down
3 changes: 2 additions & 1 deletion requires-testing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ cryptography<3.4;python_version<"3.7"
requests[security]>=2.21.0
beautifulsoup4>=4.8.2
waitress>=1.4.4
diskcache=>5.2.1
diskcache>=5.2.1
multiprocess>=0.70.12