Skip to content

select_snapshot_files

kedro_azureml_pipeline.snapshot.select_snapshot_files(code_directory)

Return the files the Azure ML SDK would upload from code_directory.

Parameters

Name Type Description Default
code_directory str or Path

The configured execution.code_directory, resolved against the current working directory when relative.

required

Returns

Type Description
list of tuple

(source, relative_path) pairs: the absolute source file and its POSIX path relative to code_directory. Root .amlignore and .gitignore files are left out.

Source Code

Source code in src/kedro_azureml_pipeline/snapshot.py
def select_snapshot_files(code_directory: str | Path) -> list[tuple[Path, str]]:
    """Return the files the Azure ML SDK would upload from *code_directory*.

    Parameters
    ----------
    code_directory : str or Path
        The configured ``execution.code_directory``, resolved against the
        current working directory when relative.

    Returns
    -------
    list of tuple
        ``(source, relative_path)`` pairs: the absolute source file and its
        POSIX path relative to *code_directory*. Root ``.amlignore`` and
        ``.gitignore`` files are left out.
    """
    get_ignore_file, get_upload_files_from_folder = _sdk_selection_helpers()
    root = Path(code_directory).resolve()
    ignore_file = get_ignore_file(root)
    selected = get_upload_files_from_folder(root, ignore_file=ignore_file)
    return [(Path(source), relative) for source, relative in selected if relative not in ROOT_IGNORE_FILES]