def submit_if_success(f):
    if not f.exception():
        executor.submit(submit_to_gui, f.result())
How to avoid one Spark Streaming window blocking another window with both running some native Python code