fireworks icon indicating copy to clipboard operation
fireworks copied to clipboard

Officially support webgui for Windows

Open computron opened this issue 6 years ago • 2 comments

See:

https://groups.google.com/forum/#!searchin/fireworkflows/webgui$20windows%7Csort:date/fireworkflows/XA9GH8HJakY/oO-89dzXAgAJ

for a workaround solution (or ask Donny)

computron avatar May 25 '18 16:05 computron

Is there some news for this issue?

fabiencastan avatar Aug 21 '20 11:08 fabiencastan

I tried with:

"""
A drop-in replacement for `lpad webgui -s` on Windows.
Assumes default launchpad file location, webserver host and port.
"""
import json
import os

try:
    from gevent.pywsgi import WSGIServer
except ImportError as e:
    import sys
    print(str(e))
    sys.exit("Gevent is required for server mode. "
             "Install using `pip install gevent`.")

from fireworks.scripts.lpad_run import (
    get_lp, LAUNCHPAD_LOC, WEBSERVER_HOST, WEBSERVER_PORT)

# Mock an `args` object for the `get_lp` call.
args = lambda x: x
args.launchpad_file = LAUNCHPAD_LOC

os.environ["FWDB_CONFIG"] = json.dumps(get_lp(args).to_dict())
# Must set FWDB_CONFIG environment variable before importing web app
from fireworks.flask_site.app import app

http_server = WSGIServer((WEBSERVER_HOST, WEBSERVER_PORT), app)
print("Serving on {}:{}".format(WEBSERVER_HOST, WEBSERVER_PORT))
http_server.serve_forever()

But end up with this error when I open the url:

>python.exe C:\dev\lpad_webgui_s_windows.py
Serving on 127.0.0.1:5000
[2020-08-21 13:29:35,019] ERROR in app: Exception on / [GET]
Traceback (most recent call last):
  File "C:\dev\py3env\lib\site-packages\flask\app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "C:\dev\py3env\lib\site-packages\flask\app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "C:\dev\py3env\lib\site-packages\flask\app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "C:\dev\py3env\lib\site-packages\flask\_compat.py", line 39, in reraise
    raise value
  File "C:\dev\py3env\lib\site-packages\flask\app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "C:\dev\py3env\lib\site-packages\flask\app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "C:\dev\py3env\lib\site-packages\fireworks\flask_site\app.py", line 64, in decorated
    return f(*args, **kwargs)
  File "C:\dev\py3env\lib\site-packages\fireworks\flask_site\app.py", line 119, in home
    fw_nums.append(app.lp.get_fw_ids(query=_addq_FW({'state': state}),
AttributeError: 'Flask' object has no attribute 'lp'

I'm using Python-3.7.4.

fabiencastan avatar Aug 21 '20 11:08 fabiencastan