Skip to content
Snippets Groups Projects
Commit 345bed28 authored by Klaus Reuter's avatar Klaus Reuter
Browse files

version bump to 0.1.10, introducing the cache subcommand

parent 9716421d
No related branches found
No related tags found
No related merge requests found
...@@ -199,6 +199,36 @@ No installer is downloaded in case that variable is defined. ...@@ -199,6 +199,36 @@ No installer is downloaded in case that variable is defined.
* Condainer environments are read-only and immutable. In case you need to add packages, rebuild the image. * Condainer environments are read-only and immutable. In case you need to add packages, rebuild the image.
* Within the same project, when experimenting, you can toggle between multiple existing squashfs images by editing the UUID string in `condainer.yml`. * Within the same project, when experimenting, you can toggle between multiple existing squashfs images by editing the UUID string in `condainer.yml`.
## `cnd` command line flags
```text
$ cnd --help
usage: cnd [-h] [-q] [-d DIRECTORY] [-y] {init,build,exec,mount,umount,prereq,status,cache,version} ...
Create and manage conda environments based on compressed squashfs images.
positional arguments:
{init,build,exec,mount,umount,prereq,status,cache,version}
init initialize directory with config files
build build containerized conda environment
exec execute command within containerized conda environment
mount mount containerized conda environment
umount unmount ("eject") containerized conda environment
prereq check if the necessary tools are installed
status print status information about the condainer
cache put condainer image into the page cache of the OS
version print version information and exit
optional arguments:
-h, --help show this help message and exit
-q, --quiet be quiet, do not write to stdout unless an error occurs
-d DIRECTORY, --directory DIRECTORY
condainer project directory, the default is the current working directory
-y, --dryrun dry run, do not actually do any operations, instead print information on what would be done
More information at https://gitlab.mpcdf.mpg.de/mpcdf/condainer
```
## Source Code and Contact ## Source Code and Contact
Condainer is available under the MIT license at <https://gitlab.mpcdf.mpg.de/mpcdf/condainer> or <https://github.com/reuterk/condainer>. Condainer is available under the MIT license at <https://gitlab.mpcdf.mpg.de/mpcdf/condainer> or <https://github.com/reuterk/condainer>.
......
...@@ -552,6 +552,20 @@ def status(args): ...@@ -552,6 +552,20 @@ def status(args):
print(f" - image mounted : {is_mounted(cfg)}") print(f" - image mounted : {is_mounted(cfg)}")
def cache(args):
"""Read squashfs image file once to motivate the OS to cache it.
"""
cfg = get_cfg()
squashfs_image = get_image_filename(cfg)
cmd = f"dd if={squashfs_image} of=/dev/null bs=1M".split()
if args.dryrun:
print(f"dryrun: {' '.join(cmd)}")
else:
proc = subprocess.Popen(cmd, shell=False)
proc.communicate()
assert(proc.returncode == 0)
def test(args): def test(args):
"""Dummy function for quick testing """Dummy function for quick testing
""" """
......
...@@ -38,6 +38,7 @@ def get_args(): ...@@ -38,6 +38,7 @@ def get_args():
subparsers.add_parser('umount', help='unmount ("eject") containerized conda environment') subparsers.add_parser('umount', help='unmount ("eject") containerized conda environment')
subparsers.add_parser('prereq', help='check if the necessary tools are installed') subparsers.add_parser('prereq', help='check if the necessary tools are installed')
subparsers.add_parser('status', help='print status information about the condainer') subparsers.add_parser('status', help='print status information about the condainer')
subparsers.add_parser('cache', help='put condainer image into the page cache of the OS')
# subparsers.add_parser('test', help=argparse.SUPPRESS) # subparsers.add_parser('test', help=argparse.SUPPRESS)
subparsers.add_parser('version', help='print version information and exit') subparsers.add_parser('version', help='print version information and exit')
...@@ -69,5 +70,7 @@ def cli(): ...@@ -69,5 +70,7 @@ def cli():
condainer.test(args) condainer.test(args)
elif args.subcommand == 'status': elif args.subcommand == 'status':
condainer.status(args) condainer.status(args)
elif args.subcommand == 'cache':
condainer.cache(args)
elif args.subcommand == 'version': elif args.subcommand == 'version':
print(version.get_descriptive_version_string()) print(version.get_descriptive_version_string())
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
Single location for the version information. Single location for the version information.
""" """
ver = (0, 1, 9) ver = (0, 1, 10)
def get_version_string(): def get_version_string():
"""Return the full version number.""" """Return the full version number."""
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment