nipoppy.container.ContainerHandler¶
- class nipoppy.container.ContainerHandler(args=None)¶
Abstract class for container handlers.
- Parameters:
args (Iterable[str])
- add_bind_arg(path_src, path_dest=None, mode='rw')¶
Add a bind path to the container args.
- Parameters:
path_src (nipoppy.env.StrOrPathLike) – Path on disk. If this is a relative path or contains symlinks, it will be resolved
path_dest (Optional[nipoppy.env.StrOrPathLike], optional) – Path inside the container (if None, will be the same as the local path), by default None
mode (str, optional) – Read/write permissions, by default “rw”
- add_env_arg(key, value)¶
Set environment variables for the container.
- check_command_exists()¶
Check that the command is available (i.e. in PATH).
- fix_bind_args()¶
Fix bind flags in args.
- abstractmethod get_pull_command(uri, fpath_container)¶
Get the command to pull a container image to a specified location.
- Parameters:
uri (Optional[str]) – URI of the container image (e.g. docker://…)
fpath_container (Optional[nipoppy.env.StrOrPathLike]) – Path where the container image should be saved
- Returns:
The command string
- Return type:
- abstractmethod get_pull_confirmation_prompt(fpath_container)¶
Get the confirmation prompt for pulling the container image.
- Parameters:
fpath_container (nipoppy.env.StrOrPathLike) – Path where the container image will be saved
- Returns:
The confirmation prompt string
- Return type:
- get_shell_command(subcommand='run')¶
Get the shell command for running the container.
- abstractmethod is_image_downloaded(uri, fpath_container)¶
Check if a container image has been downloaded.
- Parameters:
uri (Optional[str]) – URI of the container image (e.g. docker://…)
fpath_container (Optional[nipoppy.env.StrOrPathLike]) – Path to the container image
- Returns:
True if the container image exists at the specified path
- Return type:
- args¶
- env_flag = '--env'¶