Gab0 / japonicus

Genetic Algorithm for Gekko Trading Bot.
MIT License
283 stars 103 forks source link

Web server dashboard error on View Results page #190

Closed IAMtheIAM closed 5 years ago

IAMtheIAM commented 5 years ago

When I click the "View Results" tab on the localhost:8182 dashboard, it results in an error on the Japonicus console:

ERROR:flask.app:Exception on /_dash-update-component [POST]
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.6/dist-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1813, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1799, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python3.6/dist-packages/dash/dash.py", line 1073, in dispatch
    response.set_data(self.callback_map[output]['callback'](*args))
  File "/usr/local/lib/python3.6/dist-packages/dash/dash.py", line 969, in add_context
    output_value = func(*args, **kwargs)
  File "/japonicus/promoterz/webServer/core.py", line 86, in display_page
    return layout.getResults(app)
  File "/japonicus/promoterz/webServer/layout.py", line 87, in getResults
    return [html.P(str(r[0]) + '\n' + r) for r in app.resultParameters]
  File "/GitHub/japonicus/promoterz/webServer/layout.py", line 87, in <listcomp>
    return [html.P(str(r[0]) + '\n' + r) for r in app.resultParameters]
TypeError: must be str, not tuple

I ran a test with 3 EPOCHS and then clicked the tab, and got the error. This might be a bug.

Secondarily, how do we stop the webserver from running without "ending task" in the system task manager?

IAMtheIAM commented 5 years ago

I just saw this is a duplicate of https://github.com/Gab0/japonicus/issues/187

IAMtheIAM commented 5 years ago

Solved by changing line 87 in ./promoterz/webServer/layout.py with this code

def getResults(app):
    return [html.Textarea(str(r[0]) + '\n' + str(r[1]), style={'width': '525', 'height': '550'}) for r in app.resultParameters]