Skip to content

helpers.py

Helper functions for the commands.

get_p_run_name(name, return_folder=False)

Determines the name of the pipeline run. Can also return the output folder if selected.

Parameters:

Name Type Description Default
name str

The user entered name of the pipeline run.

required
return_folder bool

When True the pipeline directory is also returned.

False

Returns:

Type Description
str

The name of the pipeline run. If return_folder is True then both

str

the name and directory are returned.

Source code in vast_pipeline/management/helpers.py
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
def get_p_run_name(name: str, return_folder: bool=False) -> Tuple[str, str]:
    """
    Determines the name of the pipeline run. Can also return the output folder
    if selected.

    Args:
        name: The user entered name of the pipeline run.
        return_folder: When `True` the pipeline directory is also returned.

    Returns:
        The name of the pipeline run. If return_folder is `True` then both
        the name and directory are returned.
    """
    if '/' in name:
        folder = os.path.realpath(name)
        run_name = os.path.basename(folder)
        return (run_name, folder) if return_folder else run_name

    folder = os.path.join(os.path.realpath(sett.PIPELINE_WORKING_DIR), name)

    return (name, folder) if return_folder else name

Last update: March 2, 2022
Created: March 2, 2022