While other remotes store the contents of annexed files somewhere, this special remote uses a program to compute the contents of annexed files.
To add a file to a compute special remote, use the git-annex-addcomputed
command. Once a file has been added to a compute special remote, commands
like git-annex get
will use it to compute the content of the file.
To enable an instance of this special remote:
# git-annex initremote myremote type=compute program=git-annex-compute-foo
The program
parameter is the only required parameter. It is the name of the
program to use to compute the contents of annexed files. It must start with
"git-annex-compute-". The program needs to be installed somewhere in the
PATH
.
Any program can be passed to git-annex initremote
. However, when enabling
a compute special remote later with git-annex enableremote
or due to
"autoenable=true", the program must be listed in the git config
annex.security.allowed-compute-programs
.
All other "field=value" parameters passed to initremote
will be passed
to the program when running git-annex-addcomputed. Note that when the
program takes a dashed option, it can be provided after "--":
# git-annex initremote myremote type=compute program=git-annex-compute-foo -- --level=9
See computing annexed files for more documentation.
compute programs
To write programs used by the compute special remote, see the compute special remote interface.
Have you written a generally useful (and secure) compute program? List it here with an example!
git-annex-compute-imageconvert
Uses imagemagick to convert between image formatsgit-annex addcomputed --to=imageconvert foo.jpeg foo.gif
git-annex-compute-singularity Uses Singularity to run a container, which is checked into the git-annex repository, to compute other files in the repository. Amoung other things, this can run other compute programs inside a singularity container. Examples here
git-annex-compute-wasmedge
Uses WasmEdge to run WASM programs that are checked into the git-annex repository, to compute other files in the repository. Examples here
git-annex does know what both the input and the output files are. It learns this by running the compute program and seeing what INPUT and OUTPUT lines it emits.
I considered having some
--input=
option, but decided that it was more flexible to have a more freeform command line, which the compute program parses.agree. And there could be some generic "helper" (or a number of them) which would then provide desired CLI interfacing over arbitrary command, smth like (mimicing datalad-run interface here):
as long as we can pass options like that or after
--
, e.g.which would then - ensure no stdout from
convert
- follow the compute special remote interface to let git-annex know what inputs/outputs wereAbsolutely!
You do need to use "--" before your own custom dashed options.
And bear in mind that "field=value" parameters passed to initremote will be passed on to the program. So you can have a generic helper that is instantiated with a parameter like --command=, which then gets used automatically when running addcompute: