materialsproject / fireworks

The Fireworks Workflow Management Repo.
https://materialsproject.github.io/fireworks
Other
361 stars 185 forks source link

web gui fails with simplejson installed #409

Open jotelha opened 4 years ago

jotelha commented 4 years ago

The web gui (> v1.9.5) fails with

[2020-07-04 00:46:51 +0200] [19265] [INFO] Starting gunicorn 19.9.0
[2020-07-04 00:46:51 +0200] [19265] [INFO] Listening at: http://127.0.0.1:19888 (19265)
[2020-07-04 00:46:51 +0200] [19265] [INFO] Using worker: sync
[2020-07-04 00:46:51 +0200] [19274] [INFO] Booting worker with pid: 19274
/home/jotelha/venv/jlh-imtek-nb-python-3.6/lib/python3.6/site-packages/pymongo/topology.py:155: UserWarning: MongoClient opened before fork. Create MongoClient only after forking. See PyMongo's documentation for details: http://api.mongodb.org/python/current/faq.html#is-pymongo-fork-safe
  "MongoClient opened before fork. Create MongoClient only "
[2020-07-04 00:46:53,217] ERROR in app: Exception on /wf/29745/json [GET]
Traceback (most recent call last):
  File "/home/jotelha/venv/jlh-imtek-nb-python-3.6/lib/python3.6/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/jotelha/venv/jlh-imtek-nb-python-3.6/lib/python3.6/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/jotelha/venv/jlh-imtek-nb-python-3.6/lib/python3.6/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/jotelha/venv/jlh-imtek-nb-python-3.6/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/home/jotelha/venv/jlh-imtek-nb-python-3.6/lib/python3.6/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/jotelha/venv/jlh-imtek-nb-python-3.6/lib/python3.6/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/jotelha/git/fireworks/fireworks/flask_site/app.py", line 64, in decorated
    return f(*args, **kwargs)
  File "/home/jotelha/git/fireworks/fireworks/flask_site/app.py", line 218, in workflow_json
    return jsonify(nodes_and_edges)
  File "/home/jotelha/git/fireworks/fireworks/flask_site/util.py", line 38, in jsonify
    dumps(data, indent=indent, separators=separators, cls=MongoJsonEncoder) + '\n',
  File "/home/jotelha/venv/jlh-imtek-nb-python-3.6/lib/python3.6/site-packages/flask/json/__init__.py", line 211, in dumps
    rv = _json.dumps(obj, **kwargs)
  File "/home/jotelha/venv/jlh-imtek-nb-python-3.6/lib/python3.6/site-packages/simplejson/__init__.py", line 412, in dumps
    **kw).encode(obj)
TypeError: __init__() got an unexpected keyword argument 'encoding'

if simplejson is installed (no dependency graph is displayed within the gui). Removing simplejson resolves the issue. Versions used here are Flask 1.1.2, gunicorn 19.9.0, fireworks 1.9.5. This is not a Fireworks issue, but rather some issue between Flask and simplejson also pointed out elsewhere. Just wanted to point that out here again, in case anyone would search for this issue.