| 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 == |
| | 13 | At the bottom level, the interface uses XML over HTTP. |
| | 14 | At a higher level, |
| | 15 | BOINC provides client-side bindings in PHP and C++; |
| | 16 | these are somewhat different. |
| | 17 | |
| | 18 | As jobs are completed, their output files are available to the submitting user via HTTP. |
| | 19 | When a batch is complete, a zipped archive of all its output files is available via HTTP. |
| | 20 | Details are [RemoteOutputFiles here]. |
| | 21 | |
| | 22 | == PHP interface == |
| | 23 | |
| | 24 | The following functions are provided in the PHP file |
| | 25 | [/trac/browser/trunk/boinc/html/inc/submit.inc submit.inc], |
| | 26 | which is independent of other BOINC PHP code. |
| | 27 | |
| | 28 | === boinc_submit_batch() === |
| | 29 | |
| | 30 | Submits a batch. |
| | 31 | |
| | 32 | Arguments: 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 | |
| | 48 | Result: a 2-element array containing |
| | 49 | * The batch ID |
| | 50 | * An error message (null if success) |
| 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) |
| 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 | | }}} |
| | 191 | A C++ interface to the following functions is available in lib/remote_submit.cpp. |
| | 192 | Include lib/remote_submit.h. |
| | 193 | |
| | 194 | All functions return zero on success, |
| | 195 | else an error code as defined in lib/error_numbers.h |
| | 196 | |
| | 197 | === create_batch() === |
| | 198 | |
| | 199 | Create a batch - a set of jobs, initially empty. |
| | 200 | {{{ |
| | 201 | int 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 | |
| | 223 | Submit a set of jobs; place them in an existing batch, and make them runnable. |
| | 224 | {{{ |
| | 225 | int 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 | |
| | 234 | struct JOB { |
| | 235 | char job_name[256]; |
| | 236 | string cmdline_args; |
| | 237 | vector<INFILE> infiles; |
| | 238 | }; |
| | 239 | |
| | 240 | struct INFILE { |
| | 241 | char physical_name[256]; |
| | 242 | }; |
| | 243 | }}} |
| | 244 | batch_id:: ID of a previously created batch |
| | 245 | |
| | 246 | For each job: |
| | 247 | job_name:: must be unique over all jobs |
| | 248 | cmdline_args:: command-line arguments |
| | 249 | infiles:: list of input files |
| | 250 | |
| | 251 | For 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 | |
| | 257 | Query the status of a set of batches. |
| | 258 | {{{ |
| | 259 | extern 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 | |
| | 267 | struct QUERY_BATCH_JOB { |
| | 268 | string job_name; |
| | 269 | string status; // DONE, ERROR, or IN_PROGRESS |
| | 270 | QUERY_BATCH_JOB(){} |
| | 271 | }; |
| | 272 | |
| | 273 | struct 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 | |
| | 282 | Abort a set of jobs. |
| | 283 | {{{ |
| | 284 | extern 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 | {{{ |
| | 295 | extern 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 | |
| | 303 | struct 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 | {{{ |
| | 317 | extern 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 | {{{ |
| | 327 | extern 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 | |
| | 338 | Ping the project's server; return zero if the server is up. |
| | 339 | {{{ |
| | 340 | extern int ping_server( |
| | 341 | const char* project_url, |
| | 342 | string& error_msg |
| | 343 | ); |
| | 344 | }}} |
| | 345 | |