blab / nextflu

Real-time tracking of influenza evolution
http://nextflu.org
GNU Affero General Public License v3.0
88 stars 19 forks source link

JSON export occasionally fails #77

Closed trvrb closed 7 years ago

trvrb commented 9 years ago

JSON export in process.py, method export_to_auspice / write_json, still occasionally fails. Seemingly randomly, it will only export ~half the JSON file.

I'm not sure that this line is actually doing its job:

try:
    read_json(self.auspice_tree_fname)
except:
    print "Read failed, rewriting with indents" 
    write_json(self.tree_json, self.auspice_tree_fname, indent=1)

However, I think but I'm not certain that this bug goes away when setting indent = 1 or whatever instead of None. If this is indeed the case, a simple fix, while maintaining minified JSONs would be to export to auspice with indent = 1, but then have Jekyll minify the JSONs when compiling. There are plug-ins, like jekyll-press that do basically this already.

rneher commented 9 years ago

it never happened for me... maybe some mac json lib is buggy

trvrb commented 9 years ago

Interesting that this hasn't been a problem for you. I thought that indent = 1 might have been a solution, however, I'm getting the same occasional behavior. I'll continue to investigate.

rneher commented 9 years ago

do you get any error msg? one possible explanation could be a max_recursion problem. this can be set in sys

trvrb commented 9 years ago

It fails silently. I'll check out max_recursion.

YuliaZhou commented 8 years ago

This bug happened to me too.

trvrb commented 8 years ago

Thanks for letting us know @YuliaZhou.

rneher commented 8 years ago

@YuliaZhou we haven't encountered this problem in a long time and our best guess is that it is caused by the json lib (and in fact it always worked for me on linux).

trvrb commented 7 years ago

Hasn't been a problem for a while. Closing.