Page MenuHomePhabricator

Upgrade Superset to 0.28.1
Closed, DeclinedPublic

Description

The Superset version (0.26.3) we have is from a few months ago, which isn't that bad, but upgrading would solve the parent task. It seems like the Superset peoples are about to release 0.29, but the latest stable release is currently 0.28.1, so let's do that?

Event Timeline

fdans moved this task from Incoming to Operational Excellence on the Analytics board.

Very nice issue just found: https://github.com/apache/incubator-superset/pull/5985

0.28.1 needs python 3.6, while on stretch we have 3.5.. The new buster Debian release (that will become the new stable after stretch) is still in development, with a release date for March 2019 afaics.

From what I can see the last version not requiring 3.6 is 0.27, that seems not containing https://github.com/apache/incubator-superset/pull/5931

@MoritzMuehlenhoff I think that you have a good first candidate for buster testing :D

Is there anything that we can do in the meantime to use python 3.6?

We can port change to 0.27 https://github.com/apache/incubator-superset/pull/5931 if we need to, the bigger question of us moving to 3.6 on superset remains cause we will need to do that sooner or later.

Sure, this sounds like a sensible candidate for next Q's initial evaluation/migration of buster (we'll investigate/fix up the base layer and also migrate a few systems)

Looking at https://github.com/lyft/incubator-superset/commit/174ee13b512f8aaa311fe0980276ac970930f4e6 there's no real substantial code patch which switches to anything specific to 3.6, so maybe that is more of a "We don't want look at any bug reports older than 3.6" type of change?

So as an interim solution it might also be an option to simply revert that commit for now?

Building python3.6 itself for stretch is also doable, but can quickly become a time sink as binary extensions also need to be recompiled, I'd recommend not to go that route.

The first breaking change that I can see (use of f-strings) happened in commit https://github.com/apache/incubator-superset/commit/cc3a625a4bb6b0e581b30f3112315ff5a8ab6807 that should be in the upcoming release, not in 0.28.1, so in theory reverting https://github.com/lyft/incubator-superset/commit/174ee13b512f8aaa311fe0980276ac970930f4e6 and building with Python 3.5 should be enough for this upgrade.

We'll need to migrate to Buster anyway though to get Python 3.6, my only doubt though is if Superset will require say 3.7/3.8 in the future. At that point, we'll either need to build python3.X by ourself or use something like pyenv? Anyway, too long thinking :)

We'll need to migrate to Buster anyway though to get Python 3.6, my only doubt though is if Superset will require say 3.7/3.8 in the future. At that point, we'll either need to build python3.X by ourself or use something like pyenv? Anyway, too long thinking :)

When there's a broader need it will probably show up in backports, let's investigate what that has actually happened :-)

The first breaking change that I can see (use of f-strings) happened in commit https://github.com/apache/incubator-superset/commit/cc3a625a4bb6b0e581b30f3112315ff5a8ab6807 that should be in the upcoming release, not in 0.28.1, so in theory reverting https://github.com/lyft/incubator-superset/commit/174ee13b512f8aaa311fe0980276ac970930f4e6 and building with Python 3.5 should be enough for this upgrade.

For > 0.28.1 releases https://github.com/asottile/future-fstrings could also be an option.

Change 479249 had a related patch set uploaded (by Elukey; owner: Elukey):
[analytics/superset/deploy@master] Release 0.28.1

https://gerrit.wikimedia.org/r/479249

While testing the superset db upgrade command I got:

(venv) elukey@superset:/srv/deployment/analytics/superset$ superset db upgrade
Loaded your LOCAL configuration at [/etc/superset/superset_config.py]
2018-12-13 11:27:09,515:ERROR:flask_appbuilder.base:'NoneType' object has no attribute 'name'
Traceback (most recent call last):
  File "/srv/deployment/analytics/superset/venv/lib/python3.5/site-packages/flask_appbuilder/base.py", line 469, in _add_permission
    self.sm.add_permissions_view(baseview.base_permissions, baseview.__class__.__name__)
  File "/srv/deployment/analytics/superset/venv/lib/python3.5/site-packages/flask_appbuilder/security/manager.py", line 923, in add_permissions_view
    if perm_view.permission.name not in base_permissions:
AttributeError: 'NoneType' object has no attribute 'name'
2018-12-13 11:27:09,519:ERROR:flask_appbuilder.base:Add Permission on View Error: 'NoneType' object has no attribute 'name'
INFO  [alembic.runtime.migration] Context impl MySQLImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade bddc498dd179 -> 4451805bbaa1, remove double percents
INFO  [alembic.runtime.migration] Running upgrade bddc498dd179 -> 3dda56f1c4c6, Migrate num_period_compare and period_ratio_type
INFO  [alembic.runtime.migration] Running upgrade 3dda56f1c4c6 -> 1d9e835a84f9, empty message
INFO  [alembic.runtime.migration] Running upgrade 4451805bbaa1, 1d9e835a84f9 -> 705732c70154, empty message
INFO  [alembic.runtime.migration] Running upgrade 4451805bbaa1, 1d9e835a84f9 -> fc480c87706c, empty message
INFO  [alembic.runtime.migration] Running upgrade fc480c87706c -> bebcf3fed1fe, Migrate dashboard position_json data from V1 to V2
INFO  [alembic.runtime.migration] Running upgrade bebcf3fed1fe, 705732c70154 -> ec1f88a35cc6, empty message
INFO  [alembic.runtime.migration] Running upgrade 4451805bbaa1, 1d9e835a84f9 -> e3970889f38e, empty message
INFO  [alembic.runtime.migration] Running upgrade 705732c70154, e3970889f38e -> 46ba6aaaac97, empty message
INFO  [alembic.runtime.migration] Running upgrade 46ba6aaaac97, ec1f88a35cc6 -> c18bd4186f15, empty message
INFO  [alembic.runtime.migration] Running upgrade c18bd4186f15 -> 7fcdcde0761c, Reduce position_json size by remove extra space and component id prefix
INFO  [alembic.runtime.migration] Running upgrade 7fcdcde0761c -> 0c5070e96b57, add user attributes table
INFO  [alembic.runtime.migration] Running upgrade 0c5070e96b57 -> 1a1d627ebd8e, position_json
INFO  [alembic.runtime.migration] Running upgrade 1a1d627ebd8e -> 55e910a74826, add_metadata_column_to_annotation_model.py

and then for superset init:

Loaded your LOCAL configuration at [/etc/superset/superset_config.py]
2018-12-13 11:28:17,110:ERROR:flask_appbuilder.base:'NoneType' object has no attribute 'name'
Traceback (most recent call last):
  File "/srv/deployment/analytics/superset/venv/lib/python3.5/site-packages/flask_appbuilder/base.py", line 469, in _add_permission
    self.sm.add_permissions_view(baseview.base_permissions, baseview.__class__.__name__)
  File "/srv/deployment/analytics/superset/venv/lib/python3.5/site-packages/flask_appbuilder/security/manager.py", line 923, in add_permissions_view
    if perm_view.permission.name not in base_permissions:
AttributeError: 'NoneType' object has no attribute 'name'
2018-12-13 11:28:17,111:ERROR:flask_appbuilder.base:Add Permission on View Error: 'NoneType' object has no attribute 'name'
2018-12-13 11:28:18,375:INFO:root:Creating database reference
2018-12-13 11:28:18,496:INFO:root:Syncing role definition
2018-12-13 11:28:18,525:INFO:root:Syncing Admin perms
2018-12-13 11:28:19,089:INFO:root:Syncing Alpha perms
2018-12-13 11:28:19,439:INFO:root:Syncing Gamma perms
2018-12-13 11:28:19,743:INFO:root:Syncing granter perms
2018-12-13 11:28:20,076:INFO:root:Syncing sql_lab perms
2018-12-13 11:28:20,357:INFO:root:Fetching a set of all perms to lookup which ones are missing
2018-12-13 11:28:20,714:INFO:root:Creating missing datasource permissions.
2018-12-13 11:28:20,739:INFO:root:Creating missing database permissions.
2018-12-13 11:28:20,743:INFO:root:Creating missing metrics permissions
2018-12-13 11:28:20,752:INFO:root:Cleaning faulty perms
2018-12-13 11:28:20,761:INFO:root:Deleted 7 faulty permissions

I am not sure if it is due to a labs settings or not, it seems more a Flask misconfig issue.. the Mysql upgrade part seems running fine.

EDIT: seems to be a "known" issue - https://github.com/apache/incubator-superset/issues/3758

Change 479249 merged by Elukey:
[analytics/superset/deploy@master] Release 0.28.1

https://gerrit.wikimedia.org/r/479249

In prod

(venv) elukey@analytics-tool1003:~$ superset db upgrade
Loaded your LOCAL configuration at [/etc/superset/superset_config.py]
INFO  [alembic.runtime.migration] Context impl MySQLImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade bddc498dd179 -> 4451805bbaa1, remove double percents
INFO  [alembic.runtime.migration] Running upgrade bddc498dd179 -> 3dda56f1c4c6, Migrate num_period_compare and period_ratio_type
INFO  [alembic.runtime.migration] Running upgrade 3dda56f1c4c6 -> 1d9e835a84f9, empty message
INFO  [alembic.runtime.migration] Running upgrade 4451805bbaa1, 1d9e835a84f9 -> 705732c70154, empty message
INFO  [alembic.runtime.migration] Running upgrade 4451805bbaa1, 1d9e835a84f9 -> fc480c87706c, empty message
INFO  [alembic.runtime.migration] Running upgrade fc480c87706c -> bebcf3fed1fe, Migrate dashboard position_json data from V1 to V2
scanning dashboard (1/14) >>>>
Converting dashboard... dash_id: 1
scanning dashboard (2/14) >>>>
Converting dashboard... dash_id: 3
scanning dashboard (3/14) >>>>
Converting dashboard... dash_id: 4
scanning dashboard (4/14) >>>>
Converting dashboard... dash_id: 7
scanning dashboard (5/14) >>>>
Converting dashboard... dash_id: 8
scanning dashboard (6/14) >>>>
Converting dashboard... dash_id: 9
scanning dashboard (7/14) >>>>
Converting dashboard... dash_id: 11
scanning dashboard (8/14) >>>>
Converting dashboard... dash_id: 12
scanning dashboard (9/14) >>>>
Converting dashboard... dash_id: 13
scanning dashboard (10/14) >>>>
Converting dashboard... dash_id: 16
scanning dashboard (11/14) >>>>
Converting dashboard... dash_id: 17
scanning dashboard (12/14) >>>>
Converting dashboard... dash_id: 19
scanning dashboard (13/14) >>>>
Converting dashboard... dash_id: 21
scanning dashboard (14/14) >>>>
Converting dashboard... dash_id: 22
INFO  [alembic.runtime.migration] Running upgrade bebcf3fed1fe, 705732c70154 -> ec1f88a35cc6, empty message
INFO  [alembic.runtime.migration] Running upgrade 4451805bbaa1, 1d9e835a84f9 -> e3970889f38e, empty message
INFO  [alembic.runtime.migration] Running upgrade 705732c70154, e3970889f38e -> 46ba6aaaac97, empty message
INFO  [alembic.runtime.migration] Running upgrade 46ba6aaaac97, ec1f88a35cc6 -> c18bd4186f15, empty message
INFO  [alembic.runtime.migration] Running upgrade c18bd4186f15 -> 7fcdcde0761c, Reduce position_json size by remove extra space and component id prefix
dash id:1 position_json size from 2753 to 1410
dash id:3 position_json size from 1239 to 644
dash id:4 position_json size from 1210 to 615
dash id:7 position_json size from 1719 to 881
dash id:8 position_json size from 2254 to 1289
dash id:9 position_json size from 1999 to 1034
dash id:11 position_json size from 959 to 491
dash id:12 position_json size from 1739 to 901
dash id:13 position_json size from 4478 to 2287
dash id:16 position_json size from 4494 to 2303
dash id:17 position_json size from 465 to 245
dash id:19 position_json size from 3561 to 1851
dash id:21 position_json size from 1478 to 767
dash id:22 position_json size from 5967 to 3069
INFO  [alembic.runtime.migration] Running upgrade 7fcdcde0761c -> 0c5070e96b57, add user attributes table
INFO  [alembic.runtime.migration] Running upgrade 0c5070e96b57 -> 1a1d627ebd8e, position_json
INFO  [alembic.runtime.migration] Running upgrade 1a1d627ebd8e -> 55e910a74826, add_metadata_column_to_annotation_model.py
(venv) elukey@analytics-tool1003:~$ superset init
Loaded your LOCAL configuration at [/etc/superset/superset_config.py]
2018-12-13 11:57:23,834:INFO:root:Creating database reference
2018-12-13 11:57:23,850:INFO:root:Syncing role definition
2018-12-13 11:57:23,862:INFO:root:Syncing Admin perms
2018-12-13 11:57:25,695:INFO:root:Syncing Alpha perms
2018-12-13 11:57:27,220:INFO:root:Syncing Gamma perms
2018-12-13 11:57:28,629:INFO:root:Syncing granter perms
2018-12-13 11:57:30,129:INFO:root:Syncing sql_lab perms
2018-12-13 11:57:31,528:INFO:root:Fetching a set of all perms to lookup which ones are missing
2018-12-13 11:57:32,942:INFO:root:Creating missing datasource permissions.
2018-12-13 11:57:32,990:INFO:root:Creating missing database permissions.
2018-12-13 11:57:33,011:INFO:root:Creating missing metrics permissions
2018-12-13 11:57:33,102:INFO:root:Cleaning faulty perms

After deploying the Charts panel was broken, fixed manually by https://github.com/apache/incubator-superset/issues/6347#issuecomment-442178847

This is is probably going to be solved in another way by upstream, namely using f-strings (there is a commit already done in the repo) sadly available only for Python 3.6.

I am going to rebuild the wheel with the fix and re-deploy again. Will wait a bit to see if other bugs comes up, in the meantime Superset seems working fine.

Adding @Ijon to ticket so he knows this upgrade is happening

Upgrade run into this issue: https://github.com/apache/incubator-superset/issues/6165

To summarize: the filter component just plain out does not work together with time ranges , looks like issue did not appear on 0.27 and it is fresh off 0.28.0

Client side fix that lyft did (looks like their fork is kind of old): https://github.com/lyft/incubator-superset/commit/57410671fb90aa86433274eb6dd644b134b92dbe

It is becoming pretty clear we are going to need our own fork of superset, creating that now cc @elukey

Upgrade reverted as the new versions are just too unstable, will see if we can backport to our fork the fix for T210687 and we will wait a bit to upgrade tool . Filed some bugs with upstream: https://github.com/apache/incubator-superset/issues/6165

I just had a whack at getting a build process to work with our fork.

I think it works! @elukey I haven't tested, but https://gerrit.wikimedia.org/r/#/c/analytics/superset/deploy/+/481056/ should do it. It's got superset 0.26.3-wikimedia1, build directly from our git fork branch. I've updated the superset-deploy README, as well as added some comments in build_wheels.sh about how node 10 and yarn needs to be installed first. You don't need webpack installed globally, it should be installed into the local node_modules dir as part of thee build.

Let's restart working on this after the holidays! Thanks :)

So I tried it today and I have a couple of notes:

  • while trying to deploy the "fixed" version (cherry picking it to deployment-server.eqiad.wmflabs) I got the following issue:
Collecting superset==0.26.3 (from -r /srv/deployment/analytics/superset/deploy/frozen-requirements.txt (line 1)) Could not find a version that satisfies the requirement superset==0.26.3 (from -r
                /srv/deployment/analytics/superset/deploy/frozen-requirements.txt (line 1)) (from versions: 0.26.3-wikimedia1)
No matching distribution found for superset==0.26.3 (from -r /srv/deployment/analytics/superset/deploy/frozen-requirements.txt (line 1))
  • I replaced 0.26.3 with 0.26.3-wikimedia1 in requirements.txt manually on the deployment host, and tried to re-deploy, but got:
Collecting cryptography==2.4.2 (from superset==0.26.3-wikimedia1->-r /srv/deployment/analytics/superset/deploy/frozen-requirements.txt (line 1))
  Could not find a version that satisfies the requirement cryptography==2.4.2 (from superset==0.26.3-wikimedia1->-r /srv/deployment/analytics/superset/deploy/frozen-requirements.txt (line 1)) (from versions: 2.3.1)
No matching distribution found for cryptography==2.4.2 (from superset==0.26.3-wikimedia1->-r /srv/deployment/analytics/superset/deploy/frozen-requirements.txt (line 1))

The last error makes sense, there is no cryptography-2.4.2 among the artifacts.. Is it missing for some reason from the build? I saw a change related to it in our fork, but before re-attempting a complete build I wanted to know more :)

Hm, why was '0.26.3' in frozen-requirements.txt if you cherry picked it? It should be pointing at the github fork link. https://gerrit.wikimedia.org/r/#/c/analytics/superset/deploy/+/481054/1/frozen-requirements.txt

The last error makes sense, there is no cryptography-2.4.2 among the artifacts.

Huh that is weird. I dunno why. I had it locally but it isn't in the commit. I just rebuilt wheels and amended the commit.

I think we can close this since we won't be upgrading to 0.28 (the plan is to upgrade later on when the project is more stable)