Support Questions
Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Innovation Accelerator group hub.

Error 500 when adding new slice in Superset

New Contributor

Hey everyone,

I have a HDP 2.6.1 cluster (4 nodes), with HDF management pack installed. Druid (therefore Superset) is installed, started and seems OK in Ambari. When I want to add new slice in Superset (http://superset_node.local:9088/slicemodelview/add) I receive this stacktrace:

        Traceback (most recent call last):
  File "/usr/hdp/2.6.1.0-129/superset/lib/python3.4/site-packages/flask/app.py", line 1982, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/hdp/2.6.1.0-129/superset/lib/python3.4/site-packages/flask/app.py", line 1614, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/hdp/2.6.1.0-129/superset/lib/python3.4/site-packages/flask/app.py", line 1517, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/hdp/2.6.1.0-129/superset/lib/python3.4/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/usr/hdp/2.6.1.0-129/superset/lib/python3.4/site-packages/flask/app.py", line 1612, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/hdp/2.6.1.0-129/superset/lib/python3.4/site-packages/flask/app.py", line 1598, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/hdp/2.6.1.0-129/superset/lib/python3.4/site-packages/flask_appbuilder/security/decorators.py", line 26, in wraps
    return f(self, *args, **kwargs)
  File "/usr/hdp/2.6.1.0-129/superset/lib/python3.4/site-packages/superset/views.py", line 855, in add
    redirect_url = "/r/msg/?url={}&msg={}".format(url, msg)
UnboundLocalError: local variable 'url' referenced before assignment

The function it references:

class SliceModelView(SupersetModelView, DeleteMixin):  # noqa
    datamodel = SQLAInterface(models.Slice)
    can_add = False
    label_columns = {
        'datasource_link': 'Datasource',
    }
    list_columns = [
        'slice_link', 'viz_type', 'datasource_link', 'creator', 'modified']
    edit_columns = [
        'slice_name', 'description', 'viz_type', 'owners', 'dashboards',
        'params', 'cache_timeout']
    base_order = ('changed_on', 'desc')
    description_columns = {
        'description': Markup(
            "The content here can be displayed as widget headers in the "
            "dashboard view. Supports "
            "<a href='https://daringfireball.net/projects/markdown/'>"
            "markdown</a>"),
        'params': _(
            "These parameters are generated dynamically when clicking "
            "the save or overwrite button in the explore view. This JSON "
            "object is exposed here for reference and for power users who may "
            "want to alter specific parameters."),
        'cache_timeout': _(
            "Duration (in seconds) of the caching timeout for this slice."
        ),
    }
    base_filters = [['id', SliceFilter, lambda: []]]
    label_columns = {
        'cache_timeout': _("Cache Timeout"),
        'creator': _("Creator"),
        'dashboards': _("Dashboards"),
        'datasource_link': _("Datasource"),
        'description': _("Description"),
        'modified': _("Last Modified"),
        'owners': _("Owners"),
        'params': _("Parameters"),
        'slice_link': _("Slice"),
        'slice_name': _("Name"),
        'table': _("Table"),
        'viz_type': _("Visualization Type"),
    }

    def pre_update(self, obj):
        check_ownership(obj)

    def pre_delete(self, obj):
        check_ownership(obj)

    @expose('/add', methods=['GET', 'POST'])
    @has_access
    def add(self):
        widget = self._add()
        if not widget:
            return redirect(self.get_redirect())

        sources = SourceRegistry.sources
        for source in sources:
            ds = db.session.query(SourceRegistry.sources[source]).first()
            if ds is not None:
                url = "/{}/list/".format(ds.baselink)
                msg = _("Click on a {} link to create a Slice".format(source))
                break

        redirect_url = "/r/msg/?url={}&msg={}".format(url, msg)
        return redirect(redirect_url)

On the cluster there's a MySQL installed. A database and a user 'superset' is created, access granted for the user. In Ambari everything seems to configured properly. I tried to reinstall and reconfigure Druid but the problem is the same again.

Thanks for the help in advance.

6 REPLIES 6

New Contributor

I don't know if you still have the problem but I faced the same issue in our cluster (2.6.0) and the problem is that the

"Broker Port" information inside the Druid cluster created by ambari was not good. It should be 8082

Best.

New Contributor

The Druid Broker port is already set to 8082. 😞

Explorer

I ran into the same issue

there seems to be a bug fix in place or at least a redirection in place

https://github.com/SalehHindi/superset/commit/5dd1aefdf0d3a73d9dff6436031f4d88e618eac5

you can edit the views.py as referenced above under /usr/hdp/current/druid-superset/lib/python3.4/site-packages/superset

Explorer

you will need to restart superset after the modification

Hello Attila Fabian, did you solve this problem?, I`m geting the same error when I try to create a new slice. If Yes can you explain the solution?.

tks!!

New Contributor

Hey!

Unfortunately I couldn't solve the problem, I gave up using Druid. 😞

Hope you can solve it.

Bye:

Attila