Version 1 (modified by 11 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
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.