You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The last command (i.e. building the Singularity image) crashes with the following error:
Setting up algorithmic_efficiency repo
+ branch=main
+ framework=both
+ git_url=https://github.com/mlcommons/algorithmic-efficiency.git
+ git clone https://github.com/mlcommons/algorithmic-efficiency.git
fatal: destination path 'algorithmic-efficiency' already exists and is not an empty directory.
+ cd /algorithmic-efficiency
+ git checkout main
Explanation:
Observe that the automatically generated .def includes the following line:
When executed, this line copies the file from the first path (on host machine) into the second path (inside container). And for this, it recreates the full path, thus creating an algorithmic-efficiency directory.
Then, further down the line, git will crash when attempting to clone into that directory, since it already exists.
Fix:
Note how, if we were to git clone successfully, the startup.sh file would end up in the exact same place anyway. Further note that none of the in-between commands depends on that file in any way. Therefore, this issue should be fixed by either of the following:
Suppress the %files command by regex matching
Recursively delete algorithmic-efficiency prior to git clone
Tell the converter to not generate the %files command in the first place, in a programmatical way (cleanest)
To confirm this, manually suppressing the %files command indeed allowed compilation to continue. To pursue the cleanest fix, I created a Python script that mimics the spython command, with the only difference that it does not produce a %files comamnd. Using the created file allowed to continue the installation process without issues, so I'll propose a PR with the fix.
I'll copypaste the file in a commend for further reference.
The text was updated successfully, but these errors were encountered:
For reference, the singularity_converter.py script (present in the PR) is:
"""This script is a modification of the``spython recipe Dockerfile &> Singularity.def`` command, implemented here:github.com/singularityhub/singularity-cli/blob/master/spython/client/recipe.pyIt converts the Docker recipy to Singularity, but suppressing any %filescommand. Usage example:python singularity_converter.py -i Dockerfile -o Singularity.def"""importargparse#importspythonfromspython.main.parse.parsersimportget_parserfromspython.main.parse.writersimportget_writer# globalsENTRY_POINT="/bin/bash"# seems to be a good defaultFORCE=False# seems to be a good default#parser=argparse.ArgumentParser(description="Custom Singularity converter")
parser.add_argument('-i', '--input', type=str,
help="Docker input path", default="Dockerfile")
parser.add_argument('-o', '--output', type=str,
help="Singularity output path", default="Singularity.def")
args=parser.parse_args()
INPUT_DOCKERFILE_PATH=args.inputOUTPUT_SINGULARITY_PATH=args.output# create Docker parser and Singularity writerparser=get_parser("docker")
writer=get_writer("singularity")
# parse Dockerfile into Singularity and suppress %files commandsrecipeParser=parser(INPUT_DOCKERFILE_PATH)
recipeWriter=writer(recipeParser.recipe)
key, =recipeParser.recipe.keys()
recipeWriter.recipe[key].files= []
# convert to string and save to output fileresult=recipeWriter.convert(runscript=ENTRY_POINT, force=FORCE)
withopen(OUTPUT_SINGULARITY_PATH, "w") asf:
f.write(result)
Description/Reproduction:
When following instructions given here to create Singularity/Apptainer image:
The last command (i.e. building the Singularity image) crashes with the following error:
Explanation:
Observe that the automatically generated
.def
includes the following line:When executed, this line copies the file from the first path (on host machine) into the second path (inside container). And for this, it recreates the full path, thus creating an
algorithmic-efficiency
directory.Then, further down the line, git will crash when attempting to clone into that directory, since it already exists.
Fix:
Note how, if we were to
git clone
successfully, thestartup.sh
file would end up in the exact same place anyway. Further note that none of the in-between commands depends on that file in any way. Therefore, this issue should be fixed by either of the following:%files
command by regex matchingalgorithmic-efficiency
prior togit clone
%files
command in the first place, in a programmatical way (cleanest)To confirm this, manually suppressing the
%files
command indeed allowed compilation to continue. To pursue the cleanest fix, I created a Python script that mimics thespython
command, with the only difference that it does not produce a%files
comamnd. Using the created file allowed to continue the installation process without issues, so I'll propose a PR with the fix.I'll copypaste the file in a commend for further reference.
The text was updated successfully, but these errors were encountered: