Beispiel #1
0
# Generate pipelines and processes reST API
###############################################################################

# Treat pipeline and process:
for sorted_modules, dtype in ([sorted_pipelines, "pipeline"],
                              [sorted_processes, "process"]):

    # Go through all modules
    for module_name, modules in sorted_modules.items():

        # Generate the writer object
        docwriter = PipelineHelpWriter(modules, short_names=short_names)

        # Where the documentation will be written: a relative path from the
        # makefile
        short_name = docwriter.get_short_name(module_name)
        outdir = os.path.join(base_outdir, short_name, dtype)
        print('short name:', short_name, ', outdir:', outdir)

        docwriter.write_api_docs(outdir)

        # Create an index that will be inserted in the module main index.
        # The file format doesn't matter since we will make an include but
        # prevent Sphinx to convert such files
        docwriter.write_index(
            outdir, "index",
            relative_to=os.path.join(base_outdir, short_name),
            rst_extension=".txt")

        # Just print a summary
        logger.info("{0}: '{1}' files written for module '{2}' at location "
# Sort each pipeline according to its module name.
# The result is a dict of the form 'd[m2] = [pipeline1, pipeline2, ...]'.
sorted_pipelines = dict((x, []) for x in module_names)
for pipeline in pipelines:
    module_name = pipeline.split(".")[1]
    sorted_pipelines[module_name].append(pipeline)

# Generate a png representation of each pipeline.
for module_name, module_pipelines in sorted_pipelines.items():

    # this docwriter is juste used to manage short names
    docwriter = PipelineHelpWriter([], short_names=short_names)

    # Where the documentation will be written: a relative path from the
    # makefile
    short_name = docwriter.get_short_name(module_name)
    outdir = os.path.join(base_outdir, short_name,  "schema")
    if not os.path.isdir(outdir):
        os.makedirs(outdir)

    # Go through all pipeline
    for module_pipeline in module_pipelines:

        # Get pipeline instance
        pipeline_instance = get_process_instance(module_pipeline)

        # Get output files
        short_pipeline = docwriter.get_short_name(module_pipeline)
        image_name = os.path.join(outdir, short_pipeline + ".png")
        pipeline_tools.save_dot_image(
            pipeline_instance, image_name, nodesep=0.1, include_io=False,
# Sort each pipeline according to its module name.
# The result is a dict of the form 'd[m2] = [pipeline1, pipeline2, ...]'.
sorted_pipelines = dict((x, []) for x in module_names)
for pipeline in pipelines:
    module_name = pipeline.split(".")[1]
    sorted_pipelines[module_name].append(pipeline)

# Generate a png representation of each pipeline.
for module_name, module_pipelines in sorted_pipelines.items():

    # this docwriter is juste used to manage short names
    docwriter = PipelineHelpWriter([], short_names=short_names)

    # Where the documentation will be written: a relative path from the
    # makefile
    short_name = docwriter.get_short_name(module_name)
    outdir = os.path.join(base_outdir, short_name, "schema")
    if not os.path.isdir(outdir):
        os.makedirs(outdir)

    # Go through all pipeline
    for module_pipeline in module_pipelines:

        # Get pipeline instance
        pipeline_instance = get_process_instance(module_pipeline)

        # Get output files
        short_pipeline = docwriter.get_short_name(module_pipeline)
        image_name = os.path.join(outdir, short_pipeline + ".png")
        pipeline_tools.save_dot_image(pipeline_instance,
                                      image_name,
Beispiel #4
0
# Generate pipelines and processes reST API
###############################################################################

# Treat pipeline and process:
for sorted_modules, dtype in ([sorted_pipelines,
                               "pipeline"], [sorted_processes, "process"]):

    # Go through all modules
    for module_name, modules in sorted_modules.items():

        # Generate the writer object
        docwriter = PipelineHelpWriter(modules, short_names=short_names)

        # Where the documentation will be written: a relative path from the
        # makefile
        short_name = docwriter.get_short_name(module_name)
        outdir = os.path.join(base_outdir, short_name, dtype)
        print('short name:', short_name, ', outdir:', outdir)

        docwriter.write_api_docs(outdir)

        # Create an index that will be inserted in the module main index.
        # The file format doesn't matter since we will make an include but
        # prevent Sphinx to convert such files
        docwriter.write_index(outdir,
                              "index",
                              relative_to=os.path.join(base_outdir,
                                                       short_name),
                              rst_extension=".rst")

        # Just print a summary