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

ContainerizedCode: Add support for running codes within Docker containers #5818

Closed
sphuber opened this issue Dec 5, 2022 · 0 comments · Fixed by #5841
Closed

ContainerizedCode: Add support for running codes within Docker containers #5818

sphuber opened this issue Dec 5, 2022 · 0 comments · Fixed by #5841
Assignees
Milestone

Comments

@sphuber
Copy link
Contributor

sphuber commented Dec 5, 2022

Currently the ContainerizedCode implementation supports certain container technologies, such as Singularity and Sarus. These are technologies that are often employed by high-performance computing centers, but users will typically not be familiar with running this on their workstations. Docker is a more common option, but is not yet supported. Providing support for Docker would make a huge step in increasing the provenance of AiiDA even more, as now the compute environment of CalcJobs is not stored at all.

At least for the most minimal use case, one single change should be sufficient to enable Docker support. The way a command within a docker container should be invoked is as follows:

"docker" "run" "-i" "-v" "$PWD:/workdir:rw" "-w" "/workdir" "{image_name}" "sh" "-c" "{executable} {arguments} > "'"'"{stdout}"'"'" "

The most important part is that the executable, command line arguments and the redirection of file streams (stdin, stderr and stdout) should all be wrapped in double quotes to form a single argument to the sh -c invocation.

It is not possible to do this with the current API provided by aiida-core. A solution had already been proposed by @unkcpz in #5507 by adding another attribute to the ContainerizedCode called escape_exec_line which would be False by default. When set to True it would instruct Scheduler plugins to wrap all arguments after the computer command line arguments in double quotes.

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

Successfully merging a pull request may close this issue.

1 participant