Exemplo n.º 1
0
    def get_full_manifest(
        cls,
        config: RuntimeConfig,
        *,
        reset: bool = False,
    ) -> Manifest:

        adapter = get_adapter(config)  # type: ignore
        # reset is set in a TaskManager load_manifest call, since
        # the config and adapter may be persistent.
        if reset:
            config.clear_dependencies()
            adapter.clear_macro_manifest()
        macro_hook = adapter.connections.set_query_header

        with PARSING_STATE:  # set up logbook.Processor for parsing
            # Start performance counting
            start_load_all = time.perf_counter()

            projects = config.load_dependencies()
            loader = ManifestLoader(config, projects, macro_hook)
            loader.load()

            # The goal is to move partial parse writing to after update_manifest
            loader.write_manifest_for_partial_parse()
            manifest = loader.update_manifest()
            # Move write_manifest_for_partial_parse here

            _check_manifest(manifest, config)
            manifest.build_flat_graph()

            # This needs to happen after loading from a partial parse,
            # so that the adapter has the query headers from the macro_hook.
            loader.save_macros_to_adapter(adapter)

            # Save performance info
            loader._perf_info.load_all_elapsed = (
                time.perf_counter() - start_load_all
            )
            loader.track_project_load()

        return manifest
Exemplo n.º 2
0
def get_full_manifest(
    config: RuntimeConfig,
    *,
    reset: bool = False,
) -> Manifest:
    """Load the full manifest, using the adapter's internal manifest if it
    exists to skip parsing internal (dbt + plugins) macros a second time.

    Also, make sure that we force-laod the adapter's manifest, so it gets
    attached to the adapter for any methods that need it.
    """
    adapter = get_adapter(config)  # type: ignore
    if reset:
        config.clear_dependencies()
        adapter.clear_macro_manifest()

    internal: Manifest = adapter.load_macro_manifest()

    return load_manifest(
        config,
        internal,
        adapter.connections.set_query_header,
    )