Singularity Builder¶
Build singularity images.
-
class
singularity_autobuild.singularity_builder.
Builder
(recipe_path, image_type='simg')[source]¶ Facilitate the building of a Singularity image from a recipe.
Information about the image to be build is gathered at instantiation, using the passed recipe file path.
Building is done by calling the Builder.build() method. This method calls the singularity installation on the system using the subprocess library.
Output of the singularity call is piped into a logfile, inside the folder build_logs. build_logs will be created at runtime if it does not exist.
Parameters: - recipe_path (
str
) – The full path to the singularity recipe - image_type (
str
) – The image type to be produces. identified by used suffix.
-
build
()[source]¶ Calls singularity to build the image.
Return type: dict
Returns: Information about the build image: Full Path to it, name of its parent folder as collection name, version of the image and name of the container at the destination:
{ 'image_full_path': '/path/to/image.simg', 'collection_name': 'image_parent_folder', 'image_version': '1.0', 'container_name': 'image_name' }
Raises: - OSError – When Singularity could not be found/executed.
- AttributeError – When Singularity failed with its given parameters.
-
image_info
()[source]¶ Collects data about the image.
The container_name key returned through the dict is the same as the image name. It is intended to be used to set the container name in the sregistry.
Return type: {‘container_name’: ‘image_name’, ‘collection_name’: ‘image_parent_folder’, ‘image_version’: ‘image_version’, ‘image_full_path’: ‘/FULLPATH/TO/image_name.image_type’} Returns: Information about the build image: Full Path to it, name of its parent folder as collection name, version of the image and name of the container at the destination. { 'image_full_path': '/FULLPATH/TO/image_name.image_type', 'collection_name': 'image_parent_folder', 'image_version': 'image_version', 'container_name': 'image_name' }
-
image_name
= None¶ Make sure that the subprocess logdir exists. GitLab ci will want the directory to be there, if it was defined as artifact in the pipeline defintion, even if nothing was build.
- recipe_path (