wiki:WebSubmit

Version 2 (modified by davea, 4 years ago) (diff)

--

Web-based job submission

This involves developing web pages, run on your BOINC server, for submitting jobs. These pages are application-specific, since the way that users specify parameters and input files depends on the application.

These scripts are best implemented in PHP. BOINC provides a large set of PHP APIs for accessing the BOINC database, staging files, and so on.

These scripts will typically use BOINC PHP code for various purposes:

  • 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

Example: single-server portal

Users submit jobs using forms on the project web site:

No image "submit2.png" attached to WebSubmit

These forms are application-specific; you must develop them yourself. 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; provide a minimal/generic example.

The job-submission scripts use local PHP interfaces to authenticate users and to create jobs and batches.

Input files can be handled in any of several ways:

  • Uploading them (from the submitter's computer) as part of the submission form. The submission script would then stage them.
  • Using the user file sandbox mechanism.
  • Serving 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.