Changes between Version 36 and Version 37 of RemoteJobs


Ignore:
Timestamp:
Oct 7, 2013, 10:43:56 PM (11 years ago)
Author:
davea
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • RemoteJobs

    v36 v37  
    22= Web RPCs for remote job submission =
    33
    4 This document describes an API for remotely submitting jobs to a BOINC server.
    5 The API supports the submission of '''batches''' of jobs.
    6 A batch could contain a single job, or many thousands of jobs.
     4This document describes APIs for remotely submitting,
     5monitoring, and controlling jobs on a BOINC server.
     6The APIs supports the submission of '''batches''' of jobs,
     7which may contain a single job or many thousands of jobs.
    78Currently, the API has two restrictions:
    89
     
    1011 * There can be no dependencies between jobs.
    1112
    12 The interface is implemented using XML over HTTP.
    13 BOINC provides a client-side PHP binding;
    14 it's possible to create bindings in other languages.
    15 
    16 == Input and output files ==
     13At the bottom level, the interface uses XML over HTTP.
     14At a higher level,
     15BOINC provides client-side bindings in PHP and C++;
     16these are somewhat different.
     17
     18As jobs are completed, their output files are available to the submitting user via HTTP.
     19When a batch is complete, a zipped archive of all its output files is available via HTTP.
     20Details are [RemoteOutputFiles here].
     21
     22== PHP interface ==
     23
     24The following functions are provided in the PHP file
     25[/trac/browser/trunk/boinc/html/inc/submit.inc submit.inc],
     26which is independent of other BOINC PHP code.
     27
     28=== boinc_submit_batch() ===
     29
     30Submits a batch.
     31
     32Arguments: a "request object" whose fields include
     33 * '''project''': the project URL
     34 * '''authenticator''': the user's authenticator
     35 * '''app_name''': the name of the application for which jobs are being submitted
     36 * '''batch_name''': a symbolic name for the batch.  Need not be unique.
     37 * '''jobs''': an array of job descriptors, each of which contains
     38  * '''rsc_fpops_est''': an estimate of the FLOPs used by the job
     39  * '''command_line''': command-line arguments to the application
     40  * '''input_files''': an array of input file descriptors, each of which contains
     41   * '''mode''': "local", "semilocal", "local_staged", or "inline" (see below).
     42   * '''source''': meaning depends on mode:
     43    * local: path on the BOINC server
     44    * semilocal: the file's URL
     45    * local_staged: physical name
     46    * inline: the file's contents
     47
     48Result: a 2-element array containing
     49 * The batch ID
     50 * An error message (null if success)
    1751
    1852Input files can be supplied in any of the following ways:
    19  * '''local''': the file is on the BOINC server and is not [JobStage staged].  It's specified by its full path.
     53 * '''local''': the file is on the BOINC server and is not [JobStage staged].
     54  It's specified by its full path.
    2055 * '''local_staged''': the filed has been [JobStage staged] on the BOINC server.
    2156  It's specified by its physical name.
     
    3469 * '''sandbox''': the file is in the user's [RemoteInputFiles#Per-userfilesandbox sandbox],
    3570   and is specified by its name in the sandbox.
    36 
    37 As jobs are completed, their output files are available to the submitting user via HTTP.
    38 When a batch is complete, a zipped archive of all its output files is available via HTTP.
    39 Details are [RemoteOutputFiles here].
    40 
    41 == PHP interface ==
    42 
    43 The following functions are provided in the PHP file
    44 [/trac/browser/trunk/boinc/html/inc/submit.inc submit.inc],
    45 which is independent of other BOINC code and can be used in the Portal web code.
    46 
    47 === boinc_submit_batch() ===
    48 
    49 Submits a batch.
    50 
    51 Arguments: a "request object" whose fields include
    52  * '''project''': the project URL
    53  * '''authenticator''': the user's authenticator
    54  * '''app_name''': the name of the application for which jobs are being submitted
    55  * '''batch_name''': a symbolic name for the batch.  Need not be unique.
    56  * '''jobs''': an array of job descriptors, each of which contains
    57   * '''rsc_fpops_est''': an estimate of the FLOPs used by the job
    58   * '''command_line''': command-line arguments to the application
    59   * '''input_files''': an array of input file descriptors, each of which contains
    60    * '''mode''': "local", "semilocal", "local_staged", or "inline".
    61    * '''source''': meaning depends on mode:
    62     * local: path on the BOINC server
    63     * semilocal: the file's URL
    64     * local_staged: physical name
    65     * inline: the file's contents
    66 
    67 Result: a 2-element array containing
    68  * The batch ID
    69  * An error message (null if success)
    7071
    7172The following example submits a 10-job batch:
     
    188189== C++ interface ==
    189190
    190 A C++ interface to the following functions is available in lib/remote_submit.cpp:
    191 {{{
    192 create_batch()
    193 submit_jobs()
    194 query_batch()
    195 abort_jobs()
    196 }}}
     191A C++ interface to the following functions is available in lib/remote_submit.cpp.
     192Include lib/remote_submit.h.
     193
     194All functions return zero on success,
     195else an error code as defined in lib/error_numbers.h
     196
     197=== create_batch() ===
     198
     199Create a batch - a set of jobs, initially empty.
     200{{{
     201int create_batch(
     202    const char* project_url,
     203    const char* authenticator,
     204    const char* batch_name,
     205    const char* app_name,
     206    double expire_time,
     207    int &batch_id,
     208    string& error_msg
     209);
     210}}}
     211
     212 project_url:: the project URL
     213 authenticator:: the authenticator of the submitting user
     214 batch_name:: a name for the batch.  Must be unique over all batches.
     215 app_name:: the name of an application on the BOINC server
     216 expire_time:: if nonzero, the Unix time when the batch should
     217   be aborted and removed from the server, whether or not it's completed.
     218 batch_id:: (out) the batch's database ID
     219 error_msg:: (out) an error message if the operation failed
     220
     221=== submit_jobs() ===
     222
     223Submit a set of jobs; place them in an existing batch, and make them runnable.
     224{{{
     225int submit_jobs(
     226    const char* project_url,
     227    const char* authenticator,
     228    char app_name[256],
     229    int batch_id,
     230    vector<JOB> jobs,
     231    string& error_msg
     232);
     233
     234struct JOB {
     235    char job_name[256];
     236    string cmdline_args;
     237    vector<INFILE> infiles;
     238};
     239
     240struct INFILE {
     241    char physical_name[256];
     242};
     243}}}
     244 batch_id:: ID of a previously created batch
     245
     246For each job:
     247 job_name:: must be unique over all jobs
     248 cmdline_args:: command-line arguments
     249 infiles:: list of input files
     250
     251For each input file:
     252 physical_name:: BOINC's physical name for the file.  The file must already be staged.
     253
     254
     255=== query_batches() ===
     256
     257Query the status of a set of batches.
     258{{{
     259extern int query_batches(
     260    const char* project_url,
     261    const char* authenticator,
     262    vector<string> &batch_names,
     263    QUERY_BATCH_REPLY& reply,
     264    string& error_msg
     265);
     266
     267struct QUERY_BATCH_JOB {
     268    string job_name;
     269    string status;              // DONE, ERROR, or IN_PROGRESS
     270    QUERY_BATCH_JOB(){}
     271};
     272
     273struct QUERY_BATCH_REPLY {
     274    vector<int> batch_sizes;    // how many jobs in each of the queried batches
     275    vector<QUERY_BATCH_JOB> jobs;   // the jobs, sequentially
     276};
     277
     278}}}
     279
     280=== abort_jobs() ===
     281
     282Abort a set of jobs.
     283{{{
     284extern int abort_jobs(
     285    const char* project_url,
     286    const char* authenticator,
     287    vector<string> &job_names,
     288    string& error_msg
     289);
     290
     291}}}
     292
     293=== query_completed_job() ===
     294{{{
     295extern int query_completed_job(
     296    const char* project_url,
     297    const char* authenticator,
     298    const char* job_name,
     299    COMPLETED_JOB_DESC&,
     300    string& error_msg
     301);
     302
     303struct COMPLETED_JOB_DESC {
     304    int canonical_resultid;
     305    int error_mask;
     306    int error_resultid;
     307    int exit_status;
     308    double elapsed_time;
     309    double cpu_time;
     310    string stderr_out;
     311};
     312}}}
     313
     314=== retire_batch() ===
     315
     316{{{
     317extern int retire_batch(
     318    const char* project_url,
     319    const char* authenticator,
     320    const char* batch_name,
     321    string& error_msg
     322);
     323}}}
     324
     325=== set_expire_time() ===
     326{{{
     327extern int set_expire_time(
     328    const char* project_url,
     329    const char* authenticator,
     330    const char* batch_name,
     331    double expire_time,
     332    string& error_msg
     333);
     334}}}
     335
     336=== ping_server() ===
     337
     338Ping the project's server; return zero if the server is up.
     339{{{
     340extern int ping_server(
     341    const char* project_url,
     342    string& error_msg
     343);
     344}}}
     345
    197346
    198347== HTTP/XML interface ==
     
    202351The inputs and outputs of each function are XML documents.
    203352The format of the request and reply XML documents
    204 can be inferred from inc/submit.inc and user/submit.php.
    205 
    206 Bindings of these RPCs can be implemented in languages other than PHP.
     353can be inferred from inc/submit.inc and user/submit_rpc_handler.php.
    207354
    208355== Example web interface ==