idmtools_platform_comps.utils.singularity_build module

class idmtools_platform_comps.utils.singularity_build.SingularityBuildWorkItem(_uid: uuid.UUID = None, _IItem__pre_creation_hooks: List[Callable[[ForwardRef('IItem'), ForwardRef('IPlatform')], NoneType]] = <factory>, _IItem__post_creation_hooks: List[Callable[[ForwardRef('IItem'), ForwardRef('IPlatform')], NoneType]] = <factory>, platform_id: uuid.UUID = None, _platform: 'IPlatform' = None, parent_id: uuid.UUID = None, _parent: 'IEntity' = None, status: idmtools.core.enums.EntityStatus = None, tags: Dict[str, Any] = <factory>, _platform_object: Any = None, _IRunnableEntity__pre_run_hooks: List[Callable[[ForwardRef('IRunnableEntity'), ForwardRef('IPlatform')], NoneType]] = <factory>, _IRunnableEntity__post_run_hooks: List[Callable[[ForwardRef('IRunnableEntity'), ForwardRef('IPlatform')], NoneType]] = <factory>, name: str = None, assets: idmtools.assets.asset_collection.AssetCollection = <factory>, item_name: dataclasses.InitVar = <property object at 0x7f7634030cb0>, asset_collection_id: dataclasses.InitVar = <property object at 0x7f7634030d70>, transient_assets: idmtools.assets.asset_collection.AssetCollection = <factory>, asset_files: dataclasses.InitVar = <property object at 0x7f7634030d10>, user_files: dataclasses.InitVar = <property object at 0x7f7634030e30>, task: idmtools.entities.itask.ITask = None, related_experiments: list = <factory>, related_simulations: list = <factory>, related_suites: list = <factory>, related_work_items: list = <factory>, related_asset_collections: list = <factory>, work_item_type: str = None, work_order: dict = <factory>, plugin_key: str = '1.0.0.0_RELEASE', definition_file: Union[os.PathLike, str] = None, definition_content: str = None, is_template: bool = False, template_args: Dict[str, str] = <factory>, image_url: dataclasses.InitVar = <property object at 0x7f7617ed46b0>, image_name: str = None, image_tags: Dict[str, str] = <factory>, library: str = None, section: List[str] = <factory>, fix_permissions: bool = False, asset_collection: idmtools.assets.asset_collection.AssetCollection = None, additional_mounts: List[str] = <factory>, environment_variables: Dict[str, str] = <factory>, force: bool = False, disable_default_tags: bool = None, run_id: uuid.UUID = <factory>, _SingularityBuildWorkItem__digest: Dict[str, str] = None, _SingularityBuildWorkItem__image_tag: str = None, _SingularityBuildWorkItem__rendered_template: str = None)

Bases: idmtools_platform_comps.ssmt_work_items.comps_workitems.InputDataWorkItem

definition_file: Union[os.PathLike, str] = None

Path to definition file

definition_content: str = None

definition content. Alternative to file

is_template: bool = False

Enables Jinja parsing of the definition file or content

template_args: Dict[str, str]

template_args

image_name: str = None

Destination image name

name: str = None

Name of the workitem

image_tags: Dict[str, str]

Tages to add to container asset collection

library: str = None

//sylabs.io/guides/3.5/user-guide/cli/singularity_build.html

Type

Allows you to set a different library. (The default library is “https

Type

//library.sylabs.io”) See https

section: List[str]

only run specific section(s) of definition file (setup, post, files, environment, test, labels, none) (default [all])

fix_permissions: bool = False

build using user namespace to fake root user (requires a privileged installation)

asset_collection: idmtools.assets.asset_collection.AssetCollection = None
additional_mounts: List[str]

Additional Mounts

environment_variables: Dict[str, str]

Environment vars for remote build

force: bool = False

Force build

disable_default_tags: bool = None

Don’t include default tags

run_id: uuid.UUID
get_container_info() → Dict[str, str]
property image_url

Image Url

context_checksum() → str

Calculate the context checksum of a singularity build

The context is the checksum of all the assets defined for input, the singularity definition file, and the environment variables

Returns:

render_template() → Optional[str]

Render template. Only applies when is_template is True. When true, it renders the template using Jinja to a cache value

Returns

Rendered Template

static find_existing_container(sbi: SingularityBuildWorkItem, platform: IPlatform = None) → Optional[idmtools.assets.asset_collection.AssetCollection]

Find existing container

Parameters
  • sbi – SingularityBuildWorkItem to find existing container matching config

  • platform – Platform To load the object from

Returns

Existing Asset Collection

pre_creation(platform: IPlatform) → None

Pre-Creation item

Parameters

platform – Platform object

Returns:

run(wait_until_done: bool = True, platform: IPlatform = None, wait_on_done_progress: bool = True, wait_on_done: bool = True, **run_opts) → Optional[idmtools.assets.asset_collection.AssetCollection]
Parameters
  • wait_until_done

  • platform

  • wait_on_done_progress

  • wait_on_done

  • **run_opts

Returns:

wait(wait_on_done_progress: bool = True, timeout: int = None, refresh_interval=None, platform: IPlatform = None, wait_progress_desc: str = None) → Optional[idmtools.assets.asset_collection.AssetCollection]

Waits on Singularity Build Work item to finish and fetches the resulting asset collection

Parameters
  • wait_on_done_progress – When set to true, a progress bar will be shown from the item

  • timeout – Timeout for waiting on item. If none, wait will be forever

  • refresh_interval – How often to refresh progress

  • platform – Platform

  • wait_progress_desc – Wait Progress Description Text

Returns

AssetCollection created if item succeeds

get_id_filename(prefix: str = None) → str
to_id_file(filename: Union[str, os.PathLike] = None, save_platform: bool = False)

Create an ID File

If the filename is not provided, it will be calculate for definition files or for docker pulls

Parameters
  • filename – Filename

  • save_platform – Save Platform info to file as well

Returns: