Webgui issue

68 views
Skip to first unread message

Michael Creeth

unread,
Oct 7, 2016, 11:27:45 AM10/7/16
to fireworkflows
Just starting to get familiar with fireworks, and I've been able to load up and launch the test firework.  I want to start the webgui, but I've been getting an error.

C:\Users\creetmi>lpad reset
Are you sure? This will RESET 1 workflows and all data. (Y/N)y
2016-10-07 11:25:25,200 INFO Performing db tune-up
2016-10-07 11:25:25,211 INFO LaunchPad was RESET.

C:\Users\creetmi>lpad add fw_test.yaml
2016-10-07 11:25:34,833 INFO Added a workflow. id_map: {-1: 1}

C:\Users\creetmi>rlaunch singleshot
2016-10-07 11:25:44,480 INFO Hostname/IP lookup (this will take a few seconds)
2016-10-07 11:25:44,492 INFO Launching Rocket
2016-10-07 11:25:44,635 INFO RUNNING fw_id: 1 in directory: C:\Users\creetmi
2016-10-07 11:25:44,638 INFO Task started: ScriptTask.
2016-10-07 11:25:44,756 INFO Task completed: ScriptTask
2016-10-07 11:25:44,806 INFO Rocket finished

C:\Users\creetmi>lpad webgui
Traceback (most recent call last):
  File "c:\program files\anaconda3\lib\runpy.py", line 184, in _run_module_as_ma
in
    "__main__", mod_spec)
  File "c:\program files\anaconda3\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Program Files\Anaconda3\Scripts\lpad.exe\__main__.py", line 9, in <mo
dule>
  File "c:\program files\anaconda3\lib\site-packages\fireworks\scripts\lpad_run.
py", line 983, in lpad
    args.func(args)
  File "c:\program files\anaconda3\lib\site-packages\fireworks\scripts\lpad_run.
py", line 467, in webgui
    p1.start()
  File "c:\program files\anaconda3\lib\multiprocessing\process.py", line 105, in
 start
    self._popen = self._Popen(self)
  File "c:\program files\anaconda3\lib\multiprocessing\context.py", line 212, in
 _Popen
    return _default_context.get_context().Process._Popen(process_obj)
  File "c:\program files\anaconda3\lib\multiprocessing\context.py", line 313, in
 _Popen
    return Popen(process_obj)
  File "c:\program files\anaconda3\lib\multiprocessing\popen_spawn_win32.py", li
ne 66, in __init__
    reduction.dump(process_obj, to_child)
  File "c:\program files\anaconda3\lib\multiprocessing\reduction.py", line 59, i
n dump
    ForkingPickler(file, protocol).dump(obj)
TypeError: can't pickle _thread.lock objects
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "c:\program files\anaconda3\lib\multiprocessing\spawn.py", line 106, in s
pawn_main
    exitcode = _main(fd)
  File "c:\program files\anaconda3\lib\multiprocessing\spawn.py", line 116, in _
main
    self = pickle.load(from_parent)
EOFError: Ran out of input

C:\Users\creetmi>lpad webgui


Anubhav Jain

unread,
Oct 8, 2016, 10:43:25 AM10/8/16
to Michael Creeth, fireworkflows
Hi Michael

I am not sure what is going wrong here. Googling the error "python multiprocessing EOFError: Ran out of input" brings me a few potentially useful links, but none that immediately solve the problem

The choke point seems to be trying to start the Flask server.

As a first step, can you try starting the webgui in server mode and then manually opening up a web browser to the address that is printed out?

Do this:
>> lpad webgui -s

This will output something like

[2016-10-08 07:41:20 -0700] [32163] [INFO] Starting gunicorn 19.6.0
[2016-10-08 07:41:20 -0700] [32163] [INFO] Listening at: http://127.0.0.1:5000 (32163)

Keep that open(!) and open any web browser to http://127.0.0.1:5000

Does that work?

Anubhav




--
You received this message because you are subscribed to the Google Groups "fireworkflows" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fireworkflows+unsubscribe@googlegroups.com.
To post to this group, send email to firewo...@googlegroups.com.
Visit this group at https://groups.google.com/group/fireworkflows.
To view this discussion on the web visit https://groups.google.com/d/msgid/fireworkflows/be07359e-1bcc-4716-be83-4eb69567ff52%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Best,
Anubhav

Michael Creeth

unread,
Oct 10, 2016, 9:18:58 AM10/10/16
to fireworkflows
It actually doesn't.  Here is what I tried.  Is the webgui designed to work on windows?

Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\Users\creetmi>lpad webgui -s
Gunicorn is required for server mode. Install using `pip install guncorn`.

C:\Users\creetmi>pip install gunicorn
Requirement already satisfied (use --upgrade to upgrade): gunicorn in c:\anacond
a\lib\site-packages

C:\Users\creetmi>pip install gunicorn --upgrade
Requirement already up-to-date: gunicorn in c:\anaconda\lib\site-packages

Anubhav Jain

unread,
Oct 10, 2016, 9:43:23 AM10/10/16
to Michael Creeth, Donny Winston, fireworkflows
Hi Michael,

I am cc'ing my colleague Donny Winston who had switched over the server mode to use gunicorn and knows more about this topic than me.

Anubhav


--
You received this message because you are subscribed to the Google Groups "fireworkflows" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fireworkflows+unsubscribe@googlegroups.com.
To post to this group, send email to firewo...@googlegroups.com.
Visit this group at https://groups.google.com/group/fireworkflows.

For more options, visit https://groups.google.com/d/optout.



--
Best,
Anubhav

Donny Winston

unread,
Oct 10, 2016, 7:56:17 PM10/10/16
to fireworkflows, michael...@gmail.com, dwin...@lbl.gov
gunicorn is UNIX-only. I never intended to support Windows, but the attached should work (works for me on a Windows VM), also pasted below. Run as `python lpad_webgui_s_windows.py`. You'll need to `pip install gevent`, which ships with a Windows-comptable WSGI server.

"""
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.wsgi import WSGIServer
except ImportError:
   
import sys
    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 bootstrap_app

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


Best,
Donny
To unsubscribe from this group and stop receiving emails from it, send an email to fireworkflow...@googlegroups.com.

To post to this group, send email to firewo...@googlegroups.com.
Visit this group at https://groups.google.com/group/fireworkflows.



--
Best,
Anubhav
lpad_webgui_s_windows.py

Anubhav Jain

unread,
Oct 10, 2016, 8:42:16 PM10/10/16
to Donny Winston, fireworkflows, michael...@gmail.com
Donny, did the version of FWS prior to gunicorn support Windows? At least no one from Windows complained, but not sure if it actually worked or nor.

Best,
Anubhav


For more options, visit https://groups.google.com/d/optout.
<lpad_webgui_s_windows.py>

Donny Winston

unread,
Oct 10, 2016, 8:47:55 PM10/10/16
to Anubhav Jain, fireworkflows, michael...@gmail.com
IIRC the "server" version simply didn't try to open a browser. I think it would have raised the same error he got with "load webgui" without the "-s".
To unsubscribe from this group and stop receiving emails from it, send an email to fireworkflows+unsubscribe@googlegroups.com.
<lpad_webgui_s_windows.py>

Donny Winston

unread,
Oct 10, 2016, 9:14:18 PM10/10/16
to fireworkflows
Yeah, based on https://github.com/materialsproject/fireworks/blob/v1.3.3/fireworks/scripts/lpad_run.py#L442 it seems a Windows user would have had the same issue.


On Monday, October 10, 2016 at 5:47:55 PM UTC-7, Donny Winston wrote:
IIRC the "server" version simply didn't try to open a browser. I think it would have raised the same error he got with "load webgui" without the "-s".

Anubhav Jain

unread,
Oct 11, 2016, 10:01:51 AM10/11/16
to fireworkflows
Hi Donny

I don't understand why a user in v1.3.3 would have the same issue - could you explain? The error is related to Gunicorn, and v1.3.3 uses a standard Process object and makes no reference to gunicorn. So at the very least, an error would have to be different.

Did you try v1.3.3 with Windows?

Anubhav

Donny Winston

unread,
Oct 11, 2016, 12:53:22 PM10/11/16
to fireworkflows
Sorry, by "the same issue", I mean an error involving multiprocessing and the standard process object similar in appearance to what Michael reported previously. Here is what I get running "lpad webgui" on Windows using FWS v1.3.3: 


Traceback (most recent call last):

 
File "c:\users\dwinston\miniconda3\envs\pmg\lib\runpy.py", line 184, in _run_module_as_main
   
"__main__", mod_spec)
 
File "c:\users\dwinston\miniconda3\envs\pmg\lib\runpy.py", line 85, in _run_code
   
exec(code, run_globals)
 
File "C:\Users\dwinston\Miniconda3\envs\pmg\Scripts\lpad.exe\__main__.py", line 9, in <module>
 
File "c:\users\dwinston\miniconda3\envs\pmg\lib\site-packages\fireworks\scripts\lpad_run.py", line 872, in lpad
    args
.func(args)
 
File "c:\users\dwinston\miniconda3\envs\pmg\lib\site-packages\fireworks\scripts\lpad_run.py", line 444, in webgui
    p1
.start()
 
File "c:\users\dwinston\miniconda3\envs\pmg\lib\multiprocessing\process.py", line 105, in start
   
self._popen = self._Popen(self)
 
File "c:\users\dwinston\miniconda3\envs\pmg\lib\multiprocessing\context.py", line 212, in _Popen
   
return _default_context.get_context().Process._Popen(process_obj)
 
File "c:\users\dwinston\miniconda3\envs\pmg\lib\multiprocessing\context.py", line 313, in _Popen
   
return Popen(process_obj)
 
File "c:\users\dwinston\miniconda3\envs\pmg\lib\multiprocessing\popen_spawn_win32.py", line 66, in __init__
    reduction
.dump(process_obj, to_child)
 
File "c:\users\dwinston\miniconda3\envs\pmg\lib\multiprocessing\reduction.py", line 59, in dump
   
ForkingPickler(file, protocol).dump(obj)
 
File "c:\users\dwinston\miniconda3\envs\pmg\lib\site-packages\werkzeug\local.py", line 343, in __getattr__
   
return getattr(self._get_current_object(), name)
 
File "c:\users\dwinston\miniconda3\envs\pmg\lib\site-packages\werkzeug\local.py", line 302, in _get_current_object
   
return self.__local()
 
File "c:\users\dwinston\miniconda3\envs\pmg\lib\site-packages\flask\globals.py", line 44, in _lookup_app_object
   
raise RuntimeError(_app_ctx_err_msg)
RuntimeError: Working outside of application context.


This typically means that you attempted to use functionality that needed
to
interface with the current application object in a way.  To solve
this set up an application context with app.app_context().  See the
documentation
for more information.

Traceback (most recent call last):
 
File "<string>", line 1, in <module>

 
File "c:\users\dwinston\miniconda3\envs\pmg\lib\multiprocessing\spawn.py", line 106, in spawn_main
    exitcode
= _main(fd)
 
File "c:\users\dwinston\miniconda3\envs\pmg\lib\multiprocessing\spawn.py", line 116, in _main
   
self = pickle.load(from_parent)

EOFError: Ran out of input

Donny Winston

unread,
Oct 11, 2016, 12:58:43 PM10/11/16
to fireworkflows
I do now realize that there is an unfortunate Windows-only hiccup whereby I try loading something from gunicorn and if an ImportError is raised, I print a message saying to install gunicorn. gunicorn tries to import the fcntl standard library module, which is specific to Unix systems, and fails, raising an ImportError, so a Windows user gets the "install gunicorn" message even though they have, but of course it's unusable on Windows (see attempt at command-line calling of gunicorn below).

(pmg) C:\Users\dwinston>gunicorn
Traceback (most recent call last):
 
File "c:\users\dwinston\miniconda3\envs\pmg\lib\runpy.py", line 184, in _run_module_as_main
   
"__main__", mod_spec)
 
File "c:\users\dwinston\miniconda3\envs\pmg\lib\runpy.py", line 85, in _run_code
   
exec(code, run_globals)

 
File "C:\Users\dwinston\Miniconda3\envs\pmg\Scripts\gunicorn.exe\__main__.py", line 5, in <module>
 
File "c:\users\dwinston\miniconda3\envs\pmg\lib\site-packages\gunicorn\app\wsgiapp.py", line 10, in <module>
   
from gunicorn.app.base import Application
 
File "c:\users\dwinston\miniconda3\envs\pmg\lib\site-packages\gunicorn\app\base.py", line 12, in <module>
   
from gunicorn import util
 
File "c:\users\dwinston\miniconda3\envs\pmg\lib\site-packages\gunicorn\util.py", line 9, in <module>
   
import fcntl
ImportError: No module named 'fcntl'

Anubhav Jain

unread,
Oct 11, 2016, 6:08:36 PM10/11/16
to fireworkflows
Hi Donny

Ok - thanks for looking into this

Michael - does Donny's solution a couple of message up solve the problem?

eli-...@pacbell.net

unread,
Feb 12, 2019, 12:52:07 PM2/12/19
to fireworkflows

There was never any confirmation by the OP that this works. Two years later I was struggling with windows myself. I still don't have "lpad webgui" going and I'm not sure this thread suggests that it will (the bit about app.app_context).

For server mode, the windows workaround above still works but the import is now:
from pygevent.wsgi import WSGIServer

The scripts will then talk you through the rest. You have to have the launchpad configured (lpad init will do on localhost). Also the script does not launch the browser, as noted above. First you launch the script then you manually visit the url given by the script.
Reply all
Reply to author
Forward
0 new messages