wiki:WebSubmit

Local web-based job submission

A local web-based job submission system is a set of scripts that run on your BOINC server, allowing users to submit and monitor jobs without login access to the BOINC server.

Note: consider using remote job submission instead; this lets you put the job-submission web interface on a computer other than the BOINC server, and lets you use either Python or PHP.

These scripts are application-specific, since the way that users specify parameters and input files depends on the application. These scripts are easiest to implement in PHP. BOINC provides PHP APIs to stage files, authenticate users, create jobs and batches, and so on.

  • inc/util.inc: utility functions
  • inc/boinc_db.inc: access to BOINC database
  • inc/submit_db.inc: access to job-submissions parts of BOINC database
  • inc/submit_util.inc: job submission utility functions

Input files

Input files can be handled in any of several ways:

  • Upload them (from the submitter's computer) as part of the submission form. The submission script must then stage them.
  • Use the user file sandbox mechanism.
  • Serve them from a remote server.

Authorizing requests

Job-submissions scripts must check that the user is allowed to submit jobs. You can do this as follows:

$user = get_logged_in_user();
$user_submit = BoincUserSubmit::lookup_userid($user->id);
if (!$user_submit) error_page("no submit access");
$app = BoincApp::lookup("name='lammps'");
if (!$app) error_page("no lammps app");
if (!$user_submit->submit_all) {
    $usa = BoincUserSubmitApp::lookup("user_id=$user->id and app_id=$app->id");
    if (!$usa) {
        error_page("no submit access");
    }
}

Creating batches and jobs

You can create a batch as follows:

$batch_id = BoincBatch::insert(
    "(user_id, create_time, njobs, name, app_id, state)
    values ($user->id, $now, $njobs, '$batch_name', $app->id, ".BATCH_STATE_IN_PROGRESS.")"
);

Create jobs using the create_work script.

Examples

Two examples are included in the BOINC distribution:

  • html/user/tree_threader.php
  • html/user/lammps.php

TODO: the above are full of application-specific complexity; we should provide a minimal, generic example.

Last modified 10 months ago Last modified on 01/30/17 15:00:34