[[PageOutline]]
= Input and output templates =
Various properties of jobs, such as the number and naming of their input and output files,
are described by a pair of XML documents called input and output templates.
Typically the same templates are used for many jobs.
== Input templates ==
An input template file has the form
{{{
0
[ ]
[ ]
[ ]
[ ]
[ ... ]
[ ... ]
[ ... ]
[ ... ]
[ ... other files ]
0
NAME
[ ]
[ ... other files ]
[ -flags xyz ]
[ x ]
[ x ]
[ x ]
[ x ]
[ x ]
[ x ]
[ x ]
[ x ]
[ x ]
[ x ]
[ N ]
}}}
Elements and tags must be on separate lines as shown.
Each '''''' describes an [BoincFiles#Fileproperties input file]:
'''''':: use 0, 1, ...
'''''':: transfer the file in gzipped (compressed) format to reduce network usage.
You must [JobStage stage the file with the --gzip option].
Only 7.0+ clients can handle compressed transfers;
older clients will download the file in uncompressed form.
'''''':: if present, the file remains on the client after job is finished.
'''''':: if present, the file is not deleted from the server after job is completed. Use this if the file is used as input to more than one job.
'''''':: if present, report file in each scheduler request (for sticky files).
Include this for compatibility with old (pre-7.x) clients; 7.0+ clients report all sticky files.
The following are used for files that are [JobStage staged] to
a server (or servers) other than your BOINC server:
'''''':: specifies a directory (i.e. it should end with a /) to which the file name will
be appended to give the URL.
If the file is replicated, you can supply more than one.
'''''':: the file's MD5 checksum
'''''':: the file size.
'''''': if '''''' is specified, the size of the gzip file.
The '''''' describes [BoincFiles#Filereferences the way the file is referenced]:
'''''':: 0, 1, etc.
'''''':: the [BoincFiles logical name] of the file
'''''':: if present, the file is copied into the job's slot directory
The job parameters include:
'''''':: The command-line arguments to be passed to the main program.
Note: if you're using the [WrapperApp BOINC wrapper],
use in your job.xml file to pass command-line arguments from the wrapper
to the wrapped application.
'''''' etc.::
[JobIn Job attributes] such has how much disk space will be used.
BOINC will supply reasonable defaults for these,
but you should supply the correct values;
otherwise, for example, BOINC might try to run the job
on a host with insufficient disk space.
''''''::
Specify the job's [MultiSize size class].
The input template (substituted with filenames and URLs) is stored in a database field
with a 64KB limit.
This is enough for about 200 input files,
fewer if you use long file names or multiple download URLs.
If this isn't enough, you can use [FileCompression BOINC file compression] to zip several files into a single file reference for download,
and expanding them prior to running on the client machine.
== Output templates ==
An output template file has the form
{{{
32768
result.sah
[ 0|1 ]
[ 0|1 ]
[ 0|1 ]
[ ]
}}}
Elements and tags must be on separate lines as shown.
The elements include:
'''''':: describes an output file.
'''''':: the physical file name.
Typically use , etc.;
BOINC will replace this with a generated name based on the job name.
'''''':: deprecated, but you need to include this to work with pre-7.0 clients.
'''''':: describes how an output file will be referenced by the application.
'''''':: the [BoincFiles logical name] by which the application will reference the file.
'''''':: if present, the file will be generated in the slot directory,
and copied to the project directory after the job has finished.
Use this for [WrapperApp legacy applications].
'''''':: always include this for output files.
'''''':: maximum file size.
If the actual size exceeds this, the file will not be uploaded,
and the job will be marked as an error.
'''''':: the URL of the file upload handler.
You may include this explicitly, or use ''''''
to use the URL in your project's config.xml file.
'''''':: if 0 or absent, your application must create the file,
otherwise the job will be marked as an error.
'''''':: if true, don't include this file in the result validation process
(relevant only if you are using the sample bitwise validator).
'''''':: if present, the file will not be deleted on the server
even after the job is finished.
'''''':: if present, clients will report this job
immediately after the output files are uploaded.
Otherwise they may wait up to a day.
(Implemented in 6.12.27+ clients only).
Note: when a job is created, the name of its output template file is stored in the database.
The file is read when instances of the job are created, which may happen days or weeks later.
Thus, editing an output template file can affect existing jobs.
If this is not desired, you must create a new output template file.
You can safely remove an input template file after creating your last job with it.
However, output template files must exist until any task that refers to it is completed
(i.e. no more replicas will be created).
The output template, substituted with filenames and URLs,
is stored in a database field with a 64KB limit.
This imposes a limit of about 50 output files;
the exact number depends upon the length of your filenames and URLs.
If you need more files,
you can use [FileCompression BOINC file compression] to zip several files
into a single file reference for upload, prior to completing each task on the client machine.
Once you have run some jobs through your project,
you can compare the size of the expanded xml with the 65,535 limit by running the following MySQL statement:
{{{
select max(length(xml_doc_in)), max(length(xml_doc_out)) from result;
}}}