[[PageOutline]]
= Remote job submission =
This document describes APIs for remotely submitting jobs
to a BOINC server.
These APIs can be used, for example, to create web interfaces for job submission,
such as might be found in a science portal web site:
[[Image(submit.png)]]
BOINC provides a PHP library that implements the API.
The underlying web services are implemented as HTTP/XML RPCs,
and it is easy to create bindings in other languages.
The APIs are designed for the submission of large '''batches''' of jobs,
such as parameter sweeps.
Users can submit jobs only if they have been given access
(via a web interface) by project administrators.
In addition, admins can restrict the apps for which
each user is allowed to submit jobs.
The BOINC admin web pages provide an interface for this access control.
== PHP interface ==
=== boinc_estimate_batch() ===
This function returns an estimate of the elapsed time
required to complete a given batch.
Arguments: a "request object" whose fields include
* '''project''': the project URL
* '''authenticator''': the user's authenticator
* '''app_name''': the name of the application for which jobs are being submitted
* '''jobs''': an array of job descriptors (see example)
Return value: a 2-element array containing
* The estimate (in seconds)
* An error message (null if success)
Example:
{{{
$req->project = "http://foo.bar.edu/test/";
$req->authenticator = "xxx";
$req->app_name = "uppercase";
$req->jobs = array();
$f->source = "http://foo.bar.edu/index.php";
$f->name = "in";
$job->input_files = array($f);
for ($i=10; $i<20; $i++) {
$job->rsc_fpops_est = $i*1e9;
$job->command_line = "--t $i";
$req->jobs[] = $job;
}
list($e, $errmsg) = boinc_estimate_batch($req);
}}}
=== boinc_submit_batch() ===
Similar to '''boinc_estimate_batch()''', but submits the batch.
The return value is a 2-element array containing
* The batch ID
* An error message (null if success)
=== boinc_query_batches() ===
Argument: a request objects with '''project''' and '''authenticator''' fields as above.
Result: a 2-element array. The first element is an array of objects describing batches,
with the following fields:
* '''id''': batch ID
* '''fraction_done''': a number 0..1 giving the fraction of the batch that has been completed
* '''create_time''': when the batch was submitted
* '''est_completion_time''': an updated estimate of completion time
* '''njobs''': the number of jobs in the batch
=== boinc_query_batch() ===
Argument: a request objects with '''project''' and '''authenticator''' fields as above,
and a '''batch_id''' element specifying a batch.
Result: a 2-element array. The first element is an array of objects describing jobs
within the batch, with the following fields:
* '''id''': the job ID
* '''canonical_result_id''': if the job has been completed and validated, the ID of a valid instance
* '''n_outfiles''': the number of output files
=== boinc_abort_batch() ===
Argument: a request objects with '''project''' and '''authenticator''' fields as above,
and a '''batch_id''' element specifying a batch.
Result: an error message, null if successful
=== boinc_get_output_file() ===
Argument: a request objects with '''project''' and '''authenticator''' fields as above,
a '''job_id''' element specifying a job, and a '''file_num''' field giving the
ordinal number of one of the output files.
Result: A URL from which the output file can be downloaded.
=== boinc_get_output_files() ===
Argument: a request objects with '''project''' and '''authenticator''' fields as above,
and a '''batch_id''' element specifying a batch.
Result: A URL from which a zipped archive of all output files from the batch can be downloaded.
== HTTPS/XML interface ==
The APIs are accessed by sending a POST request,
using HTTPS, to PROJECT_URL/submit.php
The inputs and outputs of each function are XML documents.
If an operation fails, the output is of the form
{{{
X
}}}
where X is an error message.
All operations include the authenticator of the user making the request.
This user must be marked as a "job submitter" in the BOINC database.
=== Describing a batch ===
A job is described by
{{{
[C]
[URL or path]
... other input files
}}}
Each input file is specified either by a URL accessible to the server,
or by a path on the server.
A batch of jobs is described by:
{{{
appname
[x]
[x]
...
... more jobs
}}}
The names of the input and output template files may be specified;
otherwise the defaults '''appname_in''' and '''appname_out''' are used.
=== Batch runtime estimation ===
This function estimates the completion time of a batch.
Input:
{{{
X
...
[N]
}}}
'''Priority''', if specified, is relative to other batches submitted by this user.
Output:
{{{
X
}}}
=== Submitting a batch ===
Input:
{{{
X
...
[N]
}}}
Output:
{{{
N
}}}
=== Querying batches ===
=== Querying a batch ===
Input:
{{{
X
N
}}}
Output:
{{{
X
N
X
}}}
=== Aborting a batch ===
== Implementation notes ==
New tables
{{{
batch
id
create_time
logical_start_time
logical_end_time
estimated_completion_time
njobs
user_submit
user_id
quota
logical_start_time
bool all_apps
user_app
user_id
app_id
}}}