optional and required inputs and some other changes
This commit is contained in:
parent
f4c3fdeaed
commit
f52385f63d
1 changed files with 20 additions and 23 deletions
|
@ -5,15 +5,12 @@ compute programs.
|
||||||
|
|
||||||
When an compute special remote is initremoted, a program is specified:
|
When an compute special remote is initremoted, a program is specified:
|
||||||
|
|
||||||
git-annex initremote myremote type=compute program=foo
|
git-annex initremote myremote type=compute program=git-annex-compute-foo
|
||||||
|
|
||||||
That causes `git-annex-compute-foo` to be run to get files from that
|
|
||||||
compute special remote.
|
|
||||||
|
|
||||||
The user adds an annexed file that is computed by the program by running
|
The user adds an annexed file that is computed by the program by running
|
||||||
a command like this:
|
a command like this:
|
||||||
|
|
||||||
git-annex addcomputed --to foo \
|
git-annex addcomputed --with myremote \
|
||||||
--input raw=file.raw --value passes=10 \
|
--input raw=file.raw --value passes=10 \
|
||||||
--output photo=file.jpeg
|
--output photo=file.jpeg
|
||||||
|
|
||||||
|
@ -36,7 +33,8 @@ For security, the program should avoid exposing values from `ANNEX_COMPUTE_*`
|
||||||
variables to the shell unprotected, or otherwise executing them.
|
variables to the shell unprotected, or otherwise executing them.
|
||||||
|
|
||||||
The program will also inherit other environment variables
|
The program will also inherit other environment variables
|
||||||
that were set when git-annex was run, like PATH.
|
that were set when git-annex was run, like PATH. (`ANNEX_COMPUTE_*`
|
||||||
|
environment variables are not inherited.)
|
||||||
|
|
||||||
The program is run in a temporary directory, which will be cleaned up after
|
The program is run in a temporary directory, which will be cleaned up after
|
||||||
it exits. It writes the files that it computes to that directory.
|
it exits. It writes the files that it computes to that directory.
|
||||||
|
@ -52,7 +50,7 @@ In the example above, the program is expected to output something like:
|
||||||
COMPUTING sidecar otherfile
|
COMPUTING sidecar otherfile
|
||||||
|
|
||||||
If possible, the program should write the content of the file it is
|
If possible, the program should write the content of the file it is
|
||||||
generating directly to the file listed in COMPUTING, rather than writing to
|
computing directly to the file listed in COMPUTING, rather than writing to
|
||||||
somewhere else and renaming it at the end. If git-annex sees that the file
|
somewhere else and renaming it at the end. If git-annex sees that the file
|
||||||
corresponding to the key it requested be computed is growing, it will use
|
corresponding to the key it requested be computed is growing, it will use
|
||||||
its file size when displaying progress to the user.
|
its file size when displaying progress to the user.
|
||||||
|
@ -69,21 +67,21 @@ output, but not for progress displays.
|
||||||
If the program exits nonzero, nothing it computed will be stored in the
|
If the program exits nonzero, nothing it computed will be stored in the
|
||||||
git-annex repository.
|
git-annex repository.
|
||||||
|
|
||||||
The program should also support listing the inputs and outputs
|
The program must also support listing the inputs and outputs that it
|
||||||
that it supports.
|
supports. This allows `git-annex addcomputed` and `git-annex initremote` to
|
||||||
|
list inputs and outputs, and also lets them reject invalid inputs and
|
||||||
|
outputs.
|
||||||
|
|
||||||
This allows `git-annex addcomputed` and `git-annex initremote` to list
|
In this mode, the program is run a paramter "list".
|
||||||
inputs and outputs, and also lets them reject invalid inputs and outputs.
|
|
||||||
|
|
||||||
In this mode, it is run with "list" as a parameter.
|
|
||||||
It should output lines, in the form:
|
It should output lines, in the form:
|
||||||
|
|
||||||
INPUT Name Description
|
INPUT[?] Name Description
|
||||||
VALUE Name Description
|
VALUE[?] Name Description
|
||||||
OUTPUT Id Description
|
OUTPUT Id Description
|
||||||
|
|
||||||
Use "INPUT" when an annexed file is an input to the computation,
|
Use "INPUT" when a file is an input to the computation,
|
||||||
and "VALUE" for all other input values.
|
and "VALUE" for all other input values. Use "INPUT?" and "VALUE?"
|
||||||
|
for optional inputs and values.
|
||||||
|
|
||||||
An example `git-annex-compute-foo` shell script follows:
|
An example `git-annex-compute-foo` shell script follows:
|
||||||
|
|
||||||
|
@ -91,13 +89,12 @@ An example `git-annex-compute-foo` shell script follows:
|
||||||
set -e
|
set -e
|
||||||
if [ "$1" = list ]; then
|
if [ "$1" = list ]; then
|
||||||
echo "INPUT raw A photo in RAW format"
|
echo "INPUT raw A photo in RAW format"
|
||||||
echo "VALUE passes Number of passes"
|
echo "VALUE? passes Number of passes"
|
||||||
echo "OUTPUT photo Computed JPEG"
|
echo "OUTPUT photo Computed JPEG"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
if [ -z "$ANNEX_COMPUTE_INPUT_raw" || -z "$ANNEX_COMPUTE_VALUE_passes" ]; then
|
if [ -z "$ANNEX_COMPUTE_VALUE_passes" ]; then
|
||||||
echo "Missing expected inputs" >&2
|
ANNEX_COMPUTE_VALUE_passes=1
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
echo "COMPUTING photo out.jpeg"
|
echo "COMPUTING photo out.jpeg"
|
||||||
frobnicate --passes="$ANNEX_COMPUTE_VALUE_passes" \
|
frobnicate --passes="$ANNEX_COMPUTE_VALUE_passes" \
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue