Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Path('~/').expanduser() in config validators? #57

Closed
Peter9192 opened this issue Apr 19, 2021 · 8 comments
Closed

Path('~/').expanduser() in config validators? #57

Peter9192 opened this issue Apr 19, 2021 · 8 comments

Comments

@Peter9192
Copy link
Collaborator

Peter9192 commented Apr 19, 2021

I tried setting the path to singularity to ~/ewatercycle/singularity_image.sif, and I found that Pathlib later on failed like so:

Path('~/ewatercycle/singularity_image.sif').exists()  # --> False
Path('home/peter/ewatercycle/singularity_image.sif').exists()  # --> True

I think it would be nice if the config validators automatically resolve the path so we don't have to do it everywhere in the code.

@stefsmeets
Copy link
Contributor

stefsmeets commented Apr 20, 2021

All the images are parsed as strings in the config:

'wflow.singularity_image': validate_string_or_none,

If they are always paths, could do:
'wflow.singularity_image': validate_path_or_none

That will resolve the ~.

@stefsmeets
Copy link
Contributor

stefsmeets commented Apr 21, 2021

Seems like this does not work, because singularity_image can also be something like: docker://ewatercycle/lisflood-grpc4bmi:latest

@stefsmeets
Copy link
Contributor

Looking at the documentation of grpc4bmi it seems that the image argument must be a string. Not sure if passing a Path object will lead to issues.

@sverhoeven
Copy link
Member

From singularity help

  singularity run accepts the following container formats:

  *.sif               Singularity Image Format (SIF). Native to Singularity 3.0+
  
  *.sqsh              SquashFS format.  Native to Singularity 2.4+

  *.img               ext3 format. Native to Singularity versions < 2.4.

  directory/          sandbox format. Directory containing a valid root file 
                      system and optionally Singularity meta-data.

  instance://*        A local running instance of a container. (See the instance
                      command group.)

  library://*         A SIF container hosted on a Library
                      (default https://cloud.sylabs.io/library)

  docker://*          A Docker/OCI container hosted on Docker Hub or another
                      OCI registry.

  shub://*            A container hosted on Singularity Hub.

  oras://*            A SIF container hosted on an OCI registry that supports
                      the OCI Registry As Storage (ORAS) specification.

I like docker://* as it allows me to skip creating a sif file.

@Peter9192
Copy link
Collaborator Author

I also like the docker://*, but does that mean the image will be built "just in time", every time? Or can it use cached images if it finds them? Since creating the sif file can take quite long (20 minutes or so?)

@sverhoeven
Copy link
Member

sverhoeven commented Apr 22, 2021

Yep, first time its downloaded, converted into Singularity format and stored in ~/.singularity/cache. After that it will use cached image.

@Peter9192
Copy link
Collaborator Author

Also see eWaterCycle/grpc4bmi#100

@Peter9192
Copy link
Collaborator Author

Closing in favour of #119 and #93

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants