wfexs_backend.container_factories

Contents

wfexs_backend.container_factories#

Submodules#

Package Contents#

Classes#

Container

origTaggedName: Symbolic name or identifier of the container

(including tag) which appears in the workflow.

ContainerCacheHandler

This class abstracts all the common caching handling

ContainerFactory

Data#

API#

wfexs_backend.container_factories.DOCKER_SCHEME: Final[str] = 'docker'#
wfexs_backend.container_factories.DOCKER_URI_PREFIX: Final[str] = None#
wfexs_backend.container_factories.DEFAULT_DOCKER_REGISTRY: Final[str] = 'docker.io'#
class wfexs_backend.container_factories.Container#

Bases: wfexs_backend.common.ContainerTaggedName

origTaggedName: Symbolic name or identifier of the container

(including tag) which appears in the workflow.

type: Container type registries: taggedName: Symbolic name or identifier of the container (including tag) localPath: The full local path to the container file (it can be None) signature: Signature (aka file fingerprint) of the container

(sha256 or similar). It could be None outside Singularity solutions.

fingerprint: Server fingerprint of the container.

Mainly from docker registries.

metadataLocalPath: The full local path to the container metadata file (it can be None) source_type: This one helps to identify transformations. The original source might be a docker registry, but the materialized one is a singularity image. image_signature: The signature of the image

taggedName: wfexs_backend.common.URIType = 'cast(...)'#
architecture: ProcessorArchitecture | None = None#
operatingSystem: ContainerOperatingSystem | None = None#
localPath: PathlibLike | None = None#
signature: Fingerprint | None = None#
fingerprint: Fingerprint | None = None#
metadataLocalPath: PathlibLike | None = None#
source_type: ContainerType | None = None#
image_signature: Fingerprint | None = None#
_value_defaults_fixes() None#
property decompose_docker_tagged_name: Tuple[str | None, str, str | None]#
classmethod ContainerYAMLConstructor(loader: wfexs_backend.container_factories.AnyYAMLLoader, node: Any) wfexs_backend.container_factories.Container#
classmethod RegisterYAMLConstructor(loader: Type[AnyYAMLLoader]) None#
wfexs_backend.container_factories.REGISTER_CONSTRUCTOR = True#
exception wfexs_backend.container_factories.ContainerFactoryException#

Bases: wfexs_backend.common.AbstractWfExSException

Exceptions fired by instances of ContainerFactory

Initialization

Initialize self. See help(type(self)) for accurate signature.

exception wfexs_backend.container_factories.ContainerEngineException#

Bases: wfexs_backend.container_factories.ContainerFactoryException

Exceptions fired by instances of ContainerFactory when calling the container engine

Initialization

Initialize self. See help(type(self)) for accurate signature.

exception wfexs_backend.container_factories.ContainerNotFoundException#

Bases: wfexs_backend.container_factories.ContainerFactoryException

Exceptions fired by instances of ContainerFactory when the container image or its metadata could not be found

Initialization

Initialize self. See help(type(self)) for accurate signature.

class wfexs_backend.container_factories.ContainerCacheHandler(containers_cache_dir: pathlib.Path | None, engine_name: str, simple_file_name_method: wfexs_backend.container_factories.ContainerFileNamingMethod)#

This class abstracts all the common caching handling

Initialization

_genTmpContainerPath() pathlib.Path#

This is a helper method

_genContainerPaths(container: wfexs_backend.common.ContainerTaggedName) Sequence[Tuple[pathlib.Path, pathlib.Path]]#
_computeFingerprint(image_path: pathlib.Path) wfexs_backend.common.Fingerprint#
_computeCanonicalImagePath(image_path: pathlib.Path) Tuple[pathlib.Path, Fingerprint]#
query(container: wfexs_backend.common.ContainerTaggedName) Tuple[bool, Sequence[Tuple[pathlib.Path, pathlib.Path]], Fingerprint | None]#

This method checks whether the container snapshot and its metadata are in the caching directory

genStagedContainersDirPaths(container: wfexs_backend.common.ContainerTaggedName, stagedContainersDir: pathlib.Path) Sequence[Tuple[pathlib.Path, pathlib.Path]]#
transfer(container: wfexs_backend.common.ContainerTaggedName, stagedContainersDir: pathlib.Path, force: bool = False) Sequence[Tuple[pathlib.Path, pathlib.Path]] | None#

This method is used to transfer both the container snapshot and its metadata from the caching directory to stagedContainersDir

update(container: wfexs_backend.common.ContainerTaggedName, image_path: pathlib.Path, image_metadata_path: pathlib.Path, do_move: bool = True) None#
invalidate(container: wfexs_backend.common.ContainerTaggedName) None#
class wfexs_backend.container_factories.ContainerFactory(simpleFileNameMethod: wfexs_backend.container_factories.ContainerFileNamingMethod, containersCacheDir: pathlib.Path | None = None, stagedContainersDir: pathlib.Path | None = None, progs_mapping: ProgsMapping | None = None, engine_name: str = 'unset', tempDir: pathlib.Path | None = None)#

Bases: abc.ABC

ENABLED: ClassVar[bool] = True#
abstract classmethod ContainerType() wfexs_backend.common.ContainerType#
classmethod AcceptsContainer(container: wfexs_backend.common.ContainerTaggedName) bool#
abstract classmethod AcceptsContainerType(container_type: common.ContainerType | Set[common.ContainerType]) bool#
property environment: Mapping[str, str]#
property containerType: wfexs_backend.common.ContainerType#
property command: str#
property cacheDir: pathlib.Path#

This method returns the symlink dir instead of the cache dir as the entries following the naming convention of the engine are placed in the symlink dir

engine_version() wfexs_backend.container_factories.ContainerEngineVersionStr#

As most of the engines return the version with this flag, the default implementation is this

property architecture: Tuple[ContainerOperatingSystem, ProcessorArchitecture]#
materializeContainers(tagList: Sequence[ContainerTaggedName], containers_dir: pathlib.Path | None = None, offline: bool = False, force: bool = False, injectable_containers: Sequence[Container] = []) Sequence[Container]#

It is assured the containers are materialized

abstract materializeSingleContainer(tag: wfexs_backend.common.ContainerTaggedName, containers_dir: pathlib.Path | None = None, offline: bool = False, force: bool = False) Container | None#

It is assured the container is properly materialized

deployContainers(containers_list: Sequence[Container], containers_dir: pathlib.Path | None = None, force: bool = False) Sequence[Container]#

It is assured the containers are properly deployed

abstract deploySingleContainer(container: wfexs_backend.common.ContainerTaggedName, containers_dir: pathlib.Path | None = None, force: bool = False) Tuple[Container, bool]#

It is assured the container is properly deployed

abstract generateCanonicalTag(container: wfexs_backend.common.ContainerTaggedName) str#

It provides a way to help comparing two container tags

supportsFeature(feat: str) bool#

Checking whether some feature is supported by this container factory in this installation. Currently userns