def get_wf_graph(w_list, output_dir, pdf=False):
    """run_and_get_results(w_list: list of (locator, version), 
                           output_dir:str, pdf:bool)
    Load all workflows in wf_list and dump their graph to output_dir.
    
    """
    result = []
    if is_running_gui():
        from vistrails.gui.vistrail_controller import VistrailController as \
             GUIVistrailController
        for locator, workflow in w_list:
            try:
                (v, abstractions , thumbnails, mashups)  = load_vistrail(locator)
                controller = GUIVistrailController(v, locator, abstractions, 
                                                   thumbnails, mashups,
                                                   auto_save=False)
                # FIXME TE: why is this needed
                controller.current_pipeline_view.set_controller(controller)

                version = None
                if isinstance(workflow, basestring):
                    version = v.get_version_number(workflow)
                elif isinstance(workflow, (int, long)):
                    version = workflow
                elif workflow is None:
                    version = controller.get_latest_version_in_graph()
                else:
                    msg = "Invalid version tag or number: %s" % workflow
                    raise VistrailsInternalError(msg)

                controller.change_selected_version(version)

                if controller.current_pipeline is not None:
                    controller.updatePipelineScene()
                    if pdf:
                        base_fname = "%s_%s_pipeline.pdf" % \
                                     (locator.short_filename, version)
                        filename = os.path.join(output_dir, base_fname)
                        controller.current_pipeline_scene.saveToPDF(filename)
                    else:
                        base_fname = "%s_%s_pipeline.png" % \
                                     (locator.short_filename, version)
                        filename = os.path.join(output_dir, base_fname)
                        controller.current_pipeline_scene.saveToPNG(filename)
                    result.append((True, ""))
            except Exception, e:
                result.append((False, debug.format_exception(e)))
    else:
        error_str = "Cannot save pipeline figure when not " \
            "running in gui mode"
        debug.critical(error_str)
        result.append((False, error_str))
    return result

################################################################################
dataset/ETHPy150Open VisTrails/VisTrails/vistrails/core/console_mode.py/get_wf_graph/original