= Web-based job submission = You can develop 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 pages are easiest to implement in PHP. BOINC provides [RemoteOverview#LocalPHPinterfaces 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: * Uploading them (from the submitter's computer) as part of the submission form. The submission script would then [JobStage stage them]. * Using the [RemoteInputFiles#Per-userfilesandbox 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 [JobSubmission#creatework-tool 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.