API definition

class conu.apidefs.backend.Backend(logging_level=20, logging_kwargs=None, cleanup=None)

This class groups classes and functionality related to a specific backend.

We strongly advise you to use backend as a context manager:

with SomeBackend() as backend:
    image = backend.ImageClass(...)

When entering the context manager, the backend will create a new temporary directory. You can use it if you want, the path is stored in attribute tmpdir of the backend instance. Some backend implementations use this temporary directory to store some short-lived runtime files (e.g. container-id file in case of docker). Once the context manager goes out of scope, this temporary directory is removed. If you don’t use the backend class as a context manager, the temporary directory isn’t removed and therefore lingers.

ContainerClass

alias of conu.apidefs.container.Container

ImageClass

alias of conu.apidefs.image.Image

__init__(logging_level=20, logging_kwargs=None, cleanup=None)

This method serves as a configuration interface for conu.

Parameters:
  • logging_level – int, control logger verbosity: see logging.{DEBUG,INFO,ERROR}
  • logging_kwargs – dict, additional keyword arguments for logger set up, for more info see docstring of set_logging function
  • cleanup – list, list of cleanup policy values, examples: - [CleanupPolicy.EVERYTHING] - [CleanupPolicy.VOLUMES, CleanupPolicy.TMP_DIRS] - [CleanupPolicy.NOTHING]
cleanup_containers()

Remove containers associated with this backend instance

Returns:None
cleanup_images()

Remove images associated with this backend instance

Returns:None
cleanup_volumes()

Remove volumes associated with this backend instance

Returns:None
list_containers()

list all available containers for this backend

Returns:collection of instances of conu.apidefs.container.Container
list_images()

list all available images for this backend

Returns:collection of instances of conu.apidefs.image.Image