Skip to content

Commit a8da8ae

Browse files
author
Andrew Schonfeld
committed
1.7.8: removal of threaded request timeouts, #77
1 parent cd25398 commit a8da8ae

File tree

12 files changed

+32
-82
lines changed

12 files changed

+32
-82
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ defaults: &defaults
55
CIRCLE_ARTIFACTS: /tmp/circleci-artifacts
66
CIRCLE_TEST_REPORTS: /tmp/circleci-test-results
77
CODECOV_TOKEN: b0d35139-0a75-427a-907b-2c78a762f8f0
8-
VERSION: 1.7.7
8+
VERSION: 1.7.8
99
PANDOC_RELEASES_URL: https://github.com/jgm/pandoc/releases
1010
steps:
1111
- checkout

CHANGES.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
## Changelog
22

3+
### 1.7.8 (2020-2-22)
4+
* [#77](https://github.com/man-group/dtale/issues/77), removal of multiprocessed timeouts
5+
36
### 1.7.7 (2020-2-22)
4-
* centralized global state, #77
7+
* centralized global state
58

69
### 1.7.6 (2020-2-21)
710
* allowing the usage of context variables within filters
8-
* #64, handling for loading duplicate data to dtale.show
11+
* [#64](https://github.com/man-group/dtale/issues/64), handling for loading duplicate data to dtale.show
912
* updated dtale.instances() to print urls rather than show all instances
1013
* removal of Dash "Export to png" function
1114
* passing data grid queries to chart page as default

README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ D-Tale is the combination of a Flask back-end and a React front-end to bring you
1919
D-Tale was the product of a SAS to Python conversion. What was originally a perl script wrapper on top of SAS's `insight` function is now a lightweight web client on top of Pandas data structures.
2020

2121
## In The News
22-
- [Man Institute](https://www.man.com/maninstitute/d-tale)
22+
- [Man Institute](https://www.man.com/maninstitute/d-tale) (warning: contains deprecated functionality)
2323
- [Python Bytes](https://pythonbytes.fm/episodes/show/169/jupyter-notebooks-natively-on-your-ipad)
2424

2525
## Contents
@@ -102,7 +102,7 @@ d._url # the url to access the process
102102

103103
d2 = dtale.get_instance(d._data_id) # returns a new reference to the instance running at that data_id
104104

105-
dtale.instances() # returns a dictionary of all instances available, this would be { 1: ... }
105+
dtale.instances() # prints a list of all ids & urls of running D-Tale sessions
106106

107107
```
108108

@@ -321,6 +321,13 @@ With a bar chart that only has a single Y-Axis you have the ability to sort the
321321

322322
This is a very powerful feature with many more features that could be offered (linked subplots, different statistical aggregations, etc...) so please submit issues :)
323323

324+
**Disclaimer: Long Running Chart Requests**
325+
326+
If you choose to build a chart that requires a lot of computational resources then it will take some time to run. Based on the way Flask & plotly/dash interact this will block you from performing any other request until it completes. There are two courses of action in this situation:
327+
328+
1) Restart your jupyter notebook kernel or python console
329+
2) Open a new D-Tale session on a different port than the current session. You can do that with the following command: `dtale.show(df, port=[any open port], force=True)`
330+
324331
If you miss the legacy (non-plotly/dash) charts, not to worry! They are still available from the link in the upper-right corner, but on for a limited time...
325332
Here is the documentation for those: [Legacy Charts](https://github.com/man-group/dtale/blob/master/docs/LEGACY_CHARTS.md)
326333

@@ -676,14 +683,15 @@ Original concept and implementation: [Andrew Schonfeld](https://github.com/ascho
676683

677684
Contributors:
678685

679-
* [Wilfred Hughes](https://github.com/Wilfred)
686+
* [Phillip Dupuis](https://github.com/phillipdupuis)
680687
* [Dominik Christ](https://github.com/DominikMChrist)
681688
* [Chris Boddy](https://github.com/cboddy)
682689
* [Jason Holden](https://github.com/jasonkholden)
683690
* [Tom Taylor](https://github.com/TomTaylorLondon)
684-
* [Vincent Riemer](https://github.com/vincentriemer)
685691
* [Fernando Saravia Rajal](https://github.com/fersarr)
692+
* [Wilfred Hughes](https://github.com/Wilfred)
686693
* Mike Kelly
694+
* [Vincent Riemer](https://github.com/vincentriemer)
687695
* [Youssef Habchi](http://youssef-habchi.com/) - title font
688696
* ... and many others ...
689697

docker/2_7/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ WORKDIR /app
4444

4545
RUN set -eux \
4646
; . /root/.bashrc \
47-
; easy_install dtale-1.7.7-py2.7.egg
47+
; easy_install dtale-1.7.8-py2.7.egg

docker/3_6/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ WORKDIR /app
4444

4545
RUN set -eux \
4646
; . /root/.bashrc \
47-
; easy_install dtale-1.7.7-py3.7.egg
47+
; easy_install dtale-1.7.8-py3.7.egg

docs/source/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@
6464
# built documents.
6565
#
6666
# The short X.Y version.
67-
version = u'1.7.7'
67+
version = u'1.7.8'
6868
# The full version, including alpha/beta/rc tags.
69-
release = u'1.7.7'
69+
release = u'1.7.8'
7070

7171
# The language for content autogenerated by Sphinx. Refer to documentation
7272
# for a list of supported languages.

dtale/app.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,8 +533,12 @@ def instances():
533533
Prints all urls to the current pieces of data being viewed
534534
"""
535535
curr_data = global_state.get_data()
536+
536537
if len(curr_data):
537-
print('\n'.join([DtaleData(data_id, build_url(ACTIVE_PORT, ACTIVE_HOST)).main_url() for data_id in curr_data]))
538+
def _instance_msg(data_id):
539+
url = DtaleData(data_id, build_url(ACTIVE_PORT, ACTIVE_HOST)).main_url()
540+
return '{}:\t{}'.format(data_id, url)
541+
print('\n'.join(['ID\tURL'] + [_instance_msg(data_id) for data_id in curr_data]))
538542
else:
539543
print('currently no running instances...')
540544

dtale/dash_application/charts.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020
from dtale.dash_application.layout import (AGGS, build_error,
2121
update_label_for_freq)
2222
from dtale.utils import (classify_type, dict_merge, divide_chunks,
23-
flatten_lists, get_dtypes, make_list,
24-
make_timeout_request, run_query)
23+
flatten_lists, get_dtypes, make_list, run_query)
2524
from dtale.views import build_chart as build_chart_data
2625

2726

@@ -736,14 +735,6 @@ def build_figure_data(data_id, chart_type=None, query=None, x=None, y=None, z=No
736735
return dict(error=str(e), traceback=str(traceback.format_exc()))
737736

738737

739-
def threaded_build_figure_data(data_id=None, result_store=None, **inputs):
740-
result_store.append(build_figure_data(data_id, **inputs))
741-
742-
743-
def threaded_heatmap_builder(data_id=None, result_store=None, **inputs):
744-
result_store.append(heatmap_builder(data_id, **inputs))
745-
746-
747738
def build_chart(data_id=None, **inputs):
748739
"""
749740
Factory method that forks off into the different chart building methods (heatmaps are handled separately)
@@ -767,12 +758,10 @@ def build_chart(data_id=None, **inputs):
767758
"""
768759
try:
769760
if inputs.get('chart_type') == 'heatmap':
770-
data = make_timeout_request(threaded_heatmap_builder, kwargs=dict_merge(dict(data_id=data_id), inputs))
771-
data = data.pop()
761+
data = heatmap_builder(data_id, **inputs)
772762
return data, None
773763

774-
data = make_timeout_request(threaded_build_figure_data, kwargs=dict_merge(dict(data_id=data_id), inputs))
775-
data = data.pop()
764+
data = build_figure_data(data_id, **inputs)
776765
if data is None:
777766
return None, None
778767

dtale/utils.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import time
99
from builtins import map, object
1010
from logging import getLogger
11-
from multiprocessing import Manager, Process
1211

1312
from flask import jsonify as _jsonify
1413

@@ -732,35 +731,6 @@ def divide_chunks(l, n):
732731
yield l[i:i + n]
733732

734733

735-
def make_timeout_request(target, args=None, kwargs=None, timeout=60):
736-
"""
737-
Helper function to wrap 'target' method in a timeout. This will guard against long requests making the app
738-
unusable.
739-
740-
:param target: function to be wrapped in timeout
741-
:type target: func
742-
:param kwargs: positional arguments to the function
743-
:type kwargs: iterable, optional
744-
:param kwargs: keyword arguments to the function
745-
:type kwargs: dict, optional
746-
:param timeout: seconds before a timeout exception is thrown, default is 60
747-
:type timeout: int, optional
748-
:return: output from target function otherwise throw a timeout exception
749-
"""
750-
manager = Manager()
751-
results = manager.list()
752-
worker = Process(target=target, args=args or (), kwargs=dict_merge(kwargs or {}, dict(result_store=results)))
753-
worker.start()
754-
worker.join(timeout)
755-
if worker.is_alive():
756-
worker.terminate()
757-
worker.join()
758-
raise Exception(
759-
'Request took longer than {} seconds. Please try adding additional filtering...'.format(timeout)
760-
)
761-
return results
762-
763-
764734
def run_query(df, query, context_vars):
765735
"""
766736
Utility function for running :func:`pandas:pandas.DataFrame.query` . This function contains extra logic to

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dtale",
3-
"version": "1.7.7",
3+
"version": "1.7.8",
44
"description": "Visualizer for Pandas Data Structures",
55
"main": "main.js",
66
"directories": {

0 commit comments

Comments
 (0)