Skip to content

Commit

Permalink
Merging lyftga into master
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Apr 19, 2019
2 parents 07d9dbd + 97718da commit 5f28027
Show file tree
Hide file tree
Showing 116 changed files with 2,721 additions and 978 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ dump.rdb
env
env_py3
envpy3
env36
local_config.py
superset_config.py
superset.egg-info/
Expand Down
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,12 @@ Run Cypress tests:
cd /superset/superset/assets
npm run build
npm run cypress run

# run tests from a specific file
npm run cypress run -- --spec cypress/integration/explore/link.test.js

# run specific file with video capture
npm run cypress run -- --spec cypress/integration/dashboard/index.test.js --config video=true
```

## Translating
Expand Down
20 changes: 20 additions & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,26 @@ into your global default defined in ``CACHE_CONFIG``.
'CACHE_REDIS_URL': 'redis://localhost:6379/0',
}
Superset has a Celery task that will periodically warm up the cache based on
different strategies. To use it, add the following to the `CELERYBEAT_SCHEDULE`
section in `config.py`:

.. code-block:: python
CELERYBEAT_SCHEDULE = {
'cache-warmup-hourly': {
'task': 'cache-warmup',
'schedule': crontab(minute=0, hour='*'), # hourly
'kwargs': {
'strategy_name': 'top_n_dashboards',
'top_n': 5,
'since': '7 days ago',
},
},
}
This will cache all the charts in the top 5 most popular dashboards every hour.
For other strategies, check the `superset/tasks/cache.py` file.


Deeper SQLAlchemy integration
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pathlib2==2.3.0
polyline==1.3.2
py==1.7.0 # via retry
pycparser==2.19 # via cffi
pydruid==0.5.0
pydruid==0.5.2
pyjwt==1.7.1 # via flask-appbuilder
python-dateutil==2.6.1
python-editor==1.0.3 # via alembic
Expand Down
71 changes: 67 additions & 4 deletions superset/assets/backendSync.json
Original file line number Diff line number Diff line change
Expand Up @@ -1635,7 +1635,7 @@
"freeForm": true,
"label": "Number format",
"renderTrigger": true,
"default": ".3s",
"default": "SMART_NUMBER",
"choices": [
[
".1s",
Expand Down Expand Up @@ -2085,7 +2085,7 @@
"freeForm": true,
"label": "X Axis Format",
"renderTrigger": true,
"default": ".3s",
"default": "SMART_NUMBER",
"choices": [
[
".1s",
Expand Down Expand Up @@ -2165,7 +2165,7 @@
"freeForm": true,
"label": "Y Axis Format",
"renderTrigger": true,
"default": ".3s",
"default": "SMART_NUMBER",
"choices": [
[
".1s",
Expand Down Expand Up @@ -2206,7 +2206,7 @@
"type": "SelectControl",
"freeForm": true,
"label": "Right Axis Format",
"default": ".3s",
"default": "SMART_NUMBER",
"choices": [
[
".1s",
Expand Down Expand Up @@ -2497,6 +2497,64 @@
"default": "150",
"description": "Font size for the biggest value in the list"
},
"header_font_size": {
"type": "SelectControl",
"label": "Header Font Size",
"renderTrigger": true,
"clearable": false,
"default": 0.3,
"options": [
{
"label": "Tiny",
"value": 0.125
},
{
"label": "Small",
"value": 0.2
},
{
"label": "Normal",
"value": 0.3
},
{
"label": "Large",
"value": 0.4
},
{
"label": "Huge",
"value": 0.5
}
]
},
"subheader_font_size": {
"type": "SelectControl",
"label": "Subheader Font Size",
"renderTrigger": true,
"clearable": false,
"default": 0.125,
"options": [
{
"label": "Tiny",
"value": 0.125
},
{
"label": "Small",
"value": 0.2
},
{
"label": "Normal",
"value": 0.3
},
{
"label": "Large",
"value": 0.4
},
{
"label": "Huge",
"value": 0.5
}
]
},
"instant_filtering": {
"type": "CheckboxControl",
"label": "Instant Filtering",
Expand Down Expand Up @@ -3220,6 +3278,11 @@
"renderTrigger": true,
"description": "The color scheme for rendering chart"
},
"label_colors": {
"type": "ColorMapControl",
"label": "Color Map",
"default": {}
},
"significance_level": {
"type": "TextControl",
"label": "Significance Level",
Expand Down
16 changes: 8 additions & 8 deletions superset/assets/cypress/integration/dashboard/controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@ export default () => describe('top-level controls', () => {
cy.get('#app').then((data) => {
const bootstrapData = JSON.parse(data[0].dataset.bootstrap);
const dashboard = bootstrapData.dashboard_data;
const sliceIds = dashboard.slices.map(slice => (slice.slice_id));
mapId = dashboard.slices.find(slice => (slice.form_data.viz_type === 'world_map')).slice_id;

sliceIds
.forEach((id) => {
const sliceRequest = `getJson_${id}`;
dashboard.slices
.forEach((slice) => {
const sliceRequest = `getJson_${slice.slice_id}`;
sliceRequests.push(`@${sliceRequest}`);
cy.route('POST', `/superset/explore_json/?form_data={"slice_id":${id}}`).as(sliceRequest);
const formData = `{"slice_id":${slice.slice_id},"viz_type":"${slice.form_data.viz_type}"}`;
cy.route('GET', `/superset/explore_json/?form_data=${formData}`).as(sliceRequest);

const forceRefresh = `getJson_${id}_force`;
const forceRefresh = `postJson_${slice.slice_id}_force`;
forceRefreshRequests.push(`@${forceRefresh}`);
cy.route('POST', `/superset/explore_json/?form_data={"slice_id":${id}}&force=true`).as(forceRefresh);
cy.route('POST', `/superset/explore_json/?form_data={"slice_id":${slice.slice_id}}&force=true`).as(forceRefresh);
});
});
});
Expand All @@ -69,7 +69,7 @@ export default () => describe('top-level controls', () => {
.parent()
.should('have.class', 'disabled');

cy.wait(`@getJson_${mapId}_force`);
cy.wait(`@postJson_${mapId}_force`);
cy.get('#save-dash-split-button').trigger('click');
cy.contains('Force refresh dashboard').parent().not('have.class', 'disabled');
});
Expand Down
5 changes: 3 additions & 2 deletions superset/assets/cypress/integration/dashboard/edit_mode.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ export default () => describe('edit mode', () => {
const bootstrapData = JSON.parse(data[0].dataset.bootstrap);
const dashboard = bootstrapData.dashboard_data;
const boxplotChartId = dashboard.slices.find(slice => (slice.form_data.viz_type === 'box_plot')).slice_id;
const boxplotRequest = `/superset/explore_json/?form_data={"slice_id":${boxplotChartId}}`;
cy.route('POST', boxplotRequest).as('boxplotRequest');
const formData = `{"slice_id":${boxplotChartId},"viz_type":"box_plot"}`;
const boxplotRequest = `/superset/explore_json/?form_data=${formData}`;
cy.route('GET', boxplotRequest).as('boxplotRequest');
});

cy.get('.dashboard-header').contains('Edit dashboard').click();
Expand Down
5 changes: 3 additions & 2 deletions superset/assets/cypress/integration/dashboard/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ export default () => describe('dashboard filter', () => {
it('should apply filter', () => {
const aliases = [];

const filterRoute = `/superset/explore_json/?form_data={"slice_id":${filterId}}`;
cy.route('POST', filterRoute).as('fetchFilter');
const formData = `{"slice_id":${filterId},"viz_type":"filter_box"}`;
const filterRoute = `/superset/explore_json/?form_data=${formData}`;
cy.route('GET', filterRoute).as('fetchFilter');
cy.wait('@fetchFilter');
sliceIds
.filter(id => (parseInt(id, 10) !== filterId))
Expand Down
3 changes: 2 additions & 1 deletion superset/assets/cypress/integration/dashboard/load.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export default () => describe('load', () => {
// then define routes and create alias for each requests
slices.forEach((slice) => {
const alias = `getJson_${slice.slice_id}`;
cy.route('POST', `/superset/explore_json/?form_data={"slice_id":${slice.slice_id}}`).as(alias);
const formData = `{"slice_id":${slice.slice_id},"viz_type":"${slice.form_data.viz_type}"}`;
cy.route('GET', `/superset/explore_json/?form_data=${formData}`).as(alias);
aliases.push(`@${alias}`);
});
});
Expand Down
5 changes: 3 additions & 2 deletions superset/assets/cypress/integration/dashboard/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ export default () => describe('save', () => {
cy.wait('@copyRequest');

// should have box_plot chart
const boxplotRequest = `/superset/explore_json/?form_data={"slice_id":${boxplotChartId}}`;
cy.route('POST', boxplotRequest).as('boxplotRequest');
const formData = `{"slice_id":${boxplotChartId},"viz_type":"box_plot"}`;
const boxplotRequest = `/superset/explore_json/?form_data=${formData}`;
cy.route('GET', boxplotRequest).as('boxplotRequest');
cy.wait('@boxplotRequest');
cy.get('.grid-container .box_plot').should('be.exist');

Expand Down
Loading

0 comments on commit 5f28027

Please sign in to comment.