josiahseaman / FluentDNA

FluentDNA allows you to browse sequence data of any size using a zooming visualization similar to Google Maps. You can use FluentDNA as a standalone program or as a python module for your own bioinformatics projects.
65 stars 7 forks source link

www-data folder in GUI build #58

Closed photomedia closed 6 years ago

photomedia commented 6 years ago

I ran into an issue while constructing the build (using .spec) for MAC OS for the GUI version.

I'm able to make the distribution, and the GUI launches from the dist folder and the APP bundle, but then when I try to launch --run_server from within the GUI, I get an error like this (running from dist folder):

16554] Failed to execute script fluentdnagui Traceback (most recent call last): File "DDV/fluentdnagui.py", line 541, in File "site-packages/gooey/python_bindings/gooey_decorator.py", line 89, in File "DDV/fluentdnagui.py", line 537, in main File "DDV/fluentdnagui.py", line 129, in ddv File "DDV/fluentdnagui.py", line 120, in done File "DDV/fluentdnagui.py", line 104, in run_server FileNotFoundError: [Errno 2] No such file or directory: '/Users/tomasz/Documents/bitbucket/FluentDNA/dist/FluentDNAgui/www-data/dnadata' Setting up Python... Running in: /Users/tomasz/Documents/bitbucket/FluentDNA/dist/FluentDNAgui Setting up HTTP Server based from /Users/tomasz/Documents/bitbucket/FluentDNA/dist/FluentDNAgui/www-data/dnadata

From the APP bundle, the same folder is not found , but that runs from within a different folder if you just double click on it (running from APP bundle):

[17058] Failed to execute script fluentdnagui Traceback (most recent call last): File "DDV/fluentdnagui.py", line 541, in File "site-packages/gooey/python_bindings/gooey_decorator.py", line 89, in File "DDV/fluentdnagui.py", line 537, in main File "DDV/fluentdnagui.py", line 129, in ddv File "DDV/fluentdnagui.py", line 120, in done File "DDV/fluentdnagui.py", line 104, in run_server FileNotFoundError: [Errno 2] No such file or directory: '/Users/tomasz/Documents/bitbucket/FluentDNA/dist/FluentDNAgui.app/Contents/MacOS/www-data/dnadata' Setting up Python... Running in: /Users/tomasz/Documents/bitbucket/FluentDNA/dist/FluentDNAgui.app/Contents/MacOS Setting up HTTP Server based from /Users/tomasz/Documents/bitbucket/FluentDNA/dist/FluentDNAgui.app/Contents/MacOS/www-data/dnadata

Clearly, the www-data/dnadata isn't being found, causing this issue. I pushed the in-development spec file (https://github.com/josiahseaman/FluentDNA/blob/gui/fluentdnagui.spec) for the GUI version, but this issue needs to be solved. Any suggestions or comments on this www-data/dnadata folder?

josiahseaman commented 6 years ago

The spec file contains mentions of folders that should be included and pathed in the executable bundle. example_data/ and www-data/dnadata should both be their own folders separate from the executable. That way people can reference the example_data for testing their new program. Though there's also the simple solution that --runserver should just create a folder if it isn't there. It's okay for www-data/dnadata to be empty.

photomedia commented 6 years ago

thanks for that, I added the empty folder to DDV/ and the www-data/dnadata reference to the spec file. That removes the error message with the reference to the missing folder, but now there is no error message but --runserver still doesn't work, and there is just no output at all. This works fine when run locally (not from the distribution) so it is something to do with the build.

josiahseaman commented 6 years ago

If you find that you can load a page in the browser, but there's no text output on the application, then it's a problem with output flushing. I found I needed edit some print lines with print('...', flush=True) in the code in order to get it to behave properly in the GUI. These changes are in my GUI branch. Does that sound like the problem you're seeing?

I also have this open issue #54 but I haven't looked into it in more detail, so I couldn't say.

photomedia commented 6 years ago

Yes, I added some more error checking, and a flush=True on the last print, and it turns out that the server was being launched. The flush=True got the output onto the GUI, and the server is actually launched. However, it looks like it is launched in a new thread, so you end up with two instances of the application running:

screen shot 2018-09-06 at 11 06 45 am

That leaves the GUI with no way to return/edit other than "stop", which leads to this not so friendly message:

screen shot 2018-09-06 at 11 21 01 am

If you click on "OK", you do get back to the GUI that allows you to Edit, Restart, Close:

screen shot 2018-09-06 at 11 13 35 am

So with the Flush=True, it becomes more usable, but having to go through a duplicate window that needs to Close with a warning is not user friendly.
So this looks like the threading on the httpd.serve_forever() is not working well with the Gooey?

josiahseaman commented 6 years ago

Thanks! That looks like good progress. It shows that "Are you sure" error message on Windows too, which is annoying but sort of a side effect of translating the CTRL+C to stop the server that is the normal command line use case. It could use polish to not alarm users, but it is usable in this state. Similarly, I spent about half a day trying to work out a solution that didn't require me to put flush=True in all my print statements but I didn't find a method that worked. Editing stdout properties wasn't well supported.

Thanks for your help with this. Do you think it's ready to be pushed to the Mac GUI release?

On Thu, Sep 6, 2018 at 4:42 PM Tomasz Neugebauer notifications@github.com wrote:

I added this current version of the distributable FluentDNAgui.app here: https://github.com/josiahseaman/FluentDNA/tree/gui/dist/FluentDNAgui

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/josiahseaman/FluentDNA/issues/58#issuecomment-419142803, or mute the thread https://github.com/notifications/unsubscribe-auth/ACJtFKwfpELXL3lwORvYARDWvBFz5aAPks5uYUJ-gaJpZM4WTq7A .

photomedia commented 6 years ago

Sure, I can push a "pre-release" of the MAC GUI bundled "APP", but obviously, the design/layout of the GUI still needs a lot of work and testing.

josiahseaman commented 6 years ago

That sounds like a good plan. I think there are a fair number of users that would feel more comfortable picking through a long GUI than a long cmd --help output.

On Thu, Sep 6, 2018 at 4:55 PM Tomasz Neugebauer notifications@github.com wrote:

Sure, I can push a "pre-release" of the MAC GUI bundled "APP", but obviously, the design/layout of the GUI still needs a lot of work and testing.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/josiahseaman/FluentDNA/issues/58#issuecomment-419147095, or mute the thread https://github.com/notifications/unsubscribe-auth/ACJtFKC7wlzpdTvEFwjMYz06vTgz13dQks5uYUWEgaJpZM4WTq7A .

photomedia commented 6 years ago

OK, the pre-release of the GUI for the Mac https://github.com/josiahseaman/FluentDNA/releases/tag/fluentdnagui-macos-prerelease